]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
eve/http: add tx->request_port_number as http_port
authorMaurizio Abba <mabba@lastline.com>
Fri, 3 Aug 2018 12:51:13 +0000 (13:51 +0100)
committerVictor Julien <victor@inliniac.net>
Mon, 20 Aug 2018 09:03:00 +0000 (11:03 +0200)
Add the port specified in the hostname (if any) to the http object in
eve. The port may be different from the dest_port used by the TCP flow.

doc/userguide/output/eve/eve-json-format.rst
src/output-json-http.c

index da757f6d614778c1b64bb8ae4ca143ce220e631e..1a0cf09dc19fdf1ac352a8b0c4cffa7ce17c1771 100644 (file)
@@ -180,6 +180,21 @@ Event with non-extended logging:
       "http_content_type": "application\/x-gzip"
   }
 
+In case the hostname shows a port number, such as in case there is a header "Host: www.test.org:1337":
+
+::
+
+
+  "http": {
+      "http_port": 1337,
+      "hostname": "www.test.org",
+      "url" :"\/this\/is\/test.tar.gz",
+      "http_user_agent": "<User-Agent>",
+      "http_content_type": "application\/x-gzip"
+  }
+
+
+
 Event with extended logging:
 
 ::
index 17962de9b0e52ede642bd2bfb8533bef4e737fcd..ebb239b40caa17afbecd5fd55029f2fc9fe28644 100644 (file)
@@ -202,6 +202,18 @@ static void JsonHttpLogJSONBasic(json_t *js, htp_tx_t *tx)
         }
     }
 
+    /* port */
+    /* NOTE: this field will be set ONLY if the port is present in the
+     * hostname. It may be present in the header "Host" or in the URL.
+     * There is no connection (from the suricata point of view) between this
+     * port and the TCP destination port of the flow.
+     */
+    if (tx->request_port_number >= 0)
+    {
+        json_object_set_new(js, "http_port",
+                json_integer(tx->request_port_number));
+    }
+
     /* uri */
     if (tx->request_uri != NULL)
     {