53 JsonBuilder *js_resplist = NULL;
55 js_resplist = jb_new_array();
61 const char *command_name = NULL;
62 uint8_t command_name_length;
65 &command_name_length)) {
66 SCLogDebug(
"Unable to fetch info for FTP command code %d [index %d]",
71 jb_open_object(jb,
"ftp");
73 jb_set_string(jb,
"command", command_name);
74 uint32_t min_length = command_name_length + 1;
76 jb_set_string_from_bytes(jb,
"command_data", (
const uint8_t *)tx->
request + min_length,
86 bool reply_truncated =
false;
91 bool is_cc_array_open =
false;
94 uint8_t *where = response->
str;
97 if (response->
len > 0 && response->
len <= UINT16_MAX) {
98 length = (uint16_t)response->
len - 1;
99 }
else if (response->
len > UINT16_MAX) {
102 if (!reply_truncated && response->
truncated) {
103 reply_truncated =
true;
110 if (isdigit(where[0]) && isdigit(where[1]) && isdigit(where[2])) {
111 if (!is_cc_array_open) {
112 jb_open_array(jb,
"completion_code");
113 is_cc_array_open =
true;
115 jb_append_string_from_bytes(jb, (
const uint8_t *)where, 3);
121 jb_append_string_from_bytes(js_resplist, (
const uint8_t *)where +
offset, pos -
offset);
130 if (is_cc_array_open) {
134 jb_close(js_resplist);
135 jb_set_object(jb,
"reply", js_resplist);
137 jb_free(js_resplist);
141 jb_set_uint(jb,
"dynamic_port", tx->
dyn_port);
159 if (reply_truncated) {