]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
http: adds test for connect and protocol change 326/head
authorPhilippe Antoine <contact@catenacyber.fr>
Tue, 8 Sep 2020 07:21:18 +0000 (09:21 +0200)
committerPhilippe Antoine <contact@catenacyber.fr>
Tue, 8 Sep 2020 09:04:32 +0000 (11:04 +0200)
12 files changed:
tests/http-connect/http-connect-fragmented/README.md [new file with mode: 0644]
tests/http-connect/http-connect-fragmented/input.pcap [new file with mode: 0644]
tests/http-connect/http-connect-fragmented/input.txt [new file with mode: 0644]
tests/http-connect/http-connect-fragmented/test.yaml [new file with mode: 0644]
tests/http-connect/http-connect-simple/README.md [new file with mode: 0644]
tests/http-connect/http-connect-simple/input.pcap [new file with mode: 0644]
tests/http-connect/http-connect-simple/input.txt [new file with mode: 0644]
tests/http-connect/http-connect-simple/test.yaml [new file with mode: 0644]
tests/http-connect/http-connect-tls/README.md [new file with mode: 0644]
tests/http-connect/http-connect-tls/input.pcap [new file with mode: 0644]
tests/http-connect/http-connect-tls/input.txt [new file with mode: 0644]
tests/http-connect/http-connect-tls/test.yaml [new file with mode: 0644]

diff --git a/tests/http-connect/http-connect-fragmented/README.md b/tests/http-connect/http-connect-fragmented/README.md
new file mode 100644 (file)
index 0000000..fd9a3e1
--- /dev/null
@@ -0,0 +1,7 @@
+# Description
+
+Test HTTP CONNECT followed by HTTP
+
+# PCAP
+
+The pcap comes from running txt2pcap.py with input.txt
diff --git a/tests/http-connect/http-connect-fragmented/input.pcap b/tests/http-connect/http-connect-fragmented/input.pcap
new file mode 100644 (file)
index 0000000..c102a81
Binary files /dev/null and b/tests/http-connect/http-connect-fragmented/input.pcap differ
diff --git a/tests/http-connect/http-connect-fragmented/input.txt b/tests/http-connect/http-connect-fragmented/input.txt
new file mode 100644 (file)
index 0000000..de079e1
--- /dev/null
@@ -0,0 +1,5 @@
+c2s CONNECT abc:443 HTTP/1.1\r\nUser-Agent: Victor/1.0\r\n\r\n
+s2c HTTP/1.1 200 OK\r\nServer: VictorServer/1.0\r\n\r\n
+c2s GE
+c2s T / HTTP/1.1\r\nUser-Agent: Victor/1.0\r\n\r\n
+s2c HTTP/1.1 200 OK\r\nServer: VictorServer/1.0\r\n\r\n
diff --git a/tests/http-connect/http-connect-fragmented/test.yaml b/tests/http-connect/http-connect-fragmented/test.yaml
new file mode 100644 (file)
index 0000000..d33f439
--- /dev/null
@@ -0,0 +1,28 @@
+requires:
+  features:
+    - HAVE_LIBJANSSON
+
+# disables checksum verification
+args:
+  - -k none
+
+checks:
+
+  # Check that there is one file event with content range.
+  - filter:
+      count: 1
+      match:
+        event_type: http
+        tx_id: 0
+        http.http_method: CONNECT
+        http.protocol: HTTP/1.1
+        http.status: 200
+  - filter:
+      count: 1
+      match:
+        event_type: http
+        # new transaction id as we reset after CONNECT
+        tx_id: 0
+        http.http_method: GET
+        http.protocol: HTTP/1.1
+        http.status: 200
diff --git a/tests/http-connect/http-connect-simple/README.md b/tests/http-connect/http-connect-simple/README.md
new file mode 100644 (file)
index 0000000..fd9a3e1
--- /dev/null
@@ -0,0 +1,7 @@
+# Description
+
+Test HTTP CONNECT followed by HTTP
+
+# PCAP
+
+The pcap comes from running txt2pcap.py with input.txt
diff --git a/tests/http-connect/http-connect-simple/input.pcap b/tests/http-connect/http-connect-simple/input.pcap
new file mode 100644 (file)
index 0000000..a5b7981
Binary files /dev/null and b/tests/http-connect/http-connect-simple/input.pcap differ
diff --git a/tests/http-connect/http-connect-simple/input.txt b/tests/http-connect/http-connect-simple/input.txt
new file mode 100644 (file)
index 0000000..bae5ed5
--- /dev/null
@@ -0,0 +1,4 @@
+c2s CONNECT abc:443 HTTP/1.1\r\nUser-Agent: Victor/1.0\r\n\r\n
+s2c HTTP/1.1 200 OK\r\nServer: VictorServer/1.0\r\n\r\n
+c2s GET / HTTP/1.1\r\nUser-Agent: Victor/1.0\r\n\r\n
+s2c HTTP/1.1 200 OK\r\nServer: VictorServer/1.0\r\n\r\n
\ No newline at end of file
diff --git a/tests/http-connect/http-connect-simple/test.yaml b/tests/http-connect/http-connect-simple/test.yaml
new file mode 100644 (file)
index 0000000..d33f439
--- /dev/null
@@ -0,0 +1,28 @@
+requires:
+  features:
+    - HAVE_LIBJANSSON
+
+# disables checksum verification
+args:
+  - -k none
+
+checks:
+
+  # Check that there is one file event with content range.
+  - filter:
+      count: 1
+      match:
+        event_type: http
+        tx_id: 0
+        http.http_method: CONNECT
+        http.protocol: HTTP/1.1
+        http.status: 200
+  - filter:
+      count: 1
+      match:
+        event_type: http
+        # new transaction id as we reset after CONNECT
+        tx_id: 0
+        http.http_method: GET
+        http.protocol: HTTP/1.1
+        http.status: 200
diff --git a/tests/http-connect/http-connect-tls/README.md b/tests/http-connect/http-connect-tls/README.md
new file mode 100644 (file)
index 0000000..fd9a3e1
--- /dev/null
@@ -0,0 +1,7 @@
+# Description
+
+Test HTTP CONNECT followed by HTTP
+
+# PCAP
+
+The pcap comes from running txt2pcap.py with input.txt
diff --git a/tests/http-connect/http-connect-tls/input.pcap b/tests/http-connect/http-connect-tls/input.pcap
new file mode 100644 (file)
index 0000000..0e78004
Binary files /dev/null and b/tests/http-connect/http-connect-tls/input.pcap differ
diff --git a/tests/http-connect/http-connect-tls/input.txt b/tests/http-connect/http-connect-tls/input.txt
new file mode 100644 (file)
index 0000000..273a81b
--- /dev/null
@@ -0,0 +1,3 @@
+c2s CONNECT abc:443 HTTP/1.1\r\nUser-Agent: Victor/1.0\r\n\r\n
+s2c HTTP/1.1 200 OK\r\nServer: VictorServer/1.0\r\n\r\n
+c2s \x16\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
\ No newline at end of file
diff --git a/tests/http-connect/http-connect-tls/test.yaml b/tests/http-connect/http-connect-tls/test.yaml
new file mode 100644 (file)
index 0000000..b577aed
--- /dev/null
@@ -0,0 +1,25 @@
+requires:
+  features:
+    - HAVE_LIBJANSSON
+
+# disables checksum verification
+args:
+  - -k none
+
+checks:
+
+  # Check that there is one file event with content range.
+  - filter:
+      count: 1
+      match:
+        event_type: http
+        tx_id: 0
+        http.http_method: CONNECT
+        http.protocol: HTTP/1.1
+        http.status: 200
+  - filter:
+      count: 1
+      match:
+        event_type: flow
+        app_proto: tls
+        app_proto_orig: http