59 static int GetServerProtoVersion(
lua_State *luastate,
const Flow *f)
61 void *state = FlowGetAppState(f);
67 void *tx = rs_ssh_state_get_tx(state, 0);
68 if (rs_ssh_tx_get_protocol(tx, &
protocol, &b_len, STREAM_TOCLIENT) != 1)
70 if (
protocol == NULL || b_len == 0) {
77 static int SshGetServerProtoVersion(
lua_State *luastate)
88 r = GetServerProtoVersion(luastate, f);
93 static int GetServerSoftwareVersion(
lua_State *luastate,
const Flow *f)
95 void *state = FlowGetAppState(f);
99 const uint8_t *software = NULL;
102 void *tx = rs_ssh_state_get_tx(state, 0);
103 if (rs_ssh_tx_get_software(tx, &software, &b_len, STREAM_TOCLIENT) != 1)
105 if (software == NULL || b_len == 0) {
112 static int SshGetServerSoftwareVersion(
lua_State *luastate)
123 r = GetServerSoftwareVersion(luastate, f);
128 static int GetClientProtoVersion(
lua_State *luastate,
const Flow *f)
130 void *state = FlowGetAppState(f);
137 void *tx = rs_ssh_state_get_tx(state, 0);
138 if (rs_ssh_tx_get_protocol(tx, &
protocol, &b_len, STREAM_TOSERVER) != 1)
140 if (
protocol == NULL || b_len == 0) {
147 static int SshGetClientProtoVersion(
lua_State *luastate)
158 r = GetClientProtoVersion(luastate, f);
163 static int GetClientSoftwareVersion(
lua_State *luastate,
const Flow *f)
165 void *state = FlowGetAppState(f);
169 const uint8_t *software = NULL;
172 void *tx = rs_ssh_state_get_tx(state, 0);
173 if (rs_ssh_tx_get_software(tx, &software, &b_len, STREAM_TOSERVER) != 1)
175 if (software == NULL || b_len == 0) {
182 static int SshGetClientSoftwareVersion(
lua_State *luastate)
193 r = GetClientSoftwareVersion(luastate, f);
202 lua_pushcfunction(luastate, SshGetServerProtoVersion);
203 lua_setglobal(luastate,
"SshGetServerProtoVersion");
205 lua_pushcfunction(luastate, SshGetServerSoftwareVersion);
206 lua_setglobal(luastate,
"SshGetServerSoftwareVersion");
208 lua_pushcfunction(luastate, SshGetClientProtoVersion);
209 lua_setglobal(luastate,
"SshGetClientProtoVersion");
211 lua_pushcfunction(luastate, SshGetClientSoftwareVersion);
212 lua_setglobal(luastate,
"SshGetClientSoftwareVersion");