Skip to contentSkip to conversation

iptables: libxt_string.man add example

PATCH Superseded Laurence J. Lane 2 participants 7 messages Aug 23, 2013 – Aug 24, 2013 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iptables: libxt_string.man add example

Show delimeters for hex string pattern.

http://bugs.debian.org/699904

---
 extensions/libxt_string.man | 7 +++++++
 1 file changed, 7 insertions(+)
extensions/libxt_string.man +7 -0
index b6b271d..ebea1d3 100644
@@ -16,3 +16,10 @@ Matches the given pattern.
 .TP
 [\fB!\fP] \fB\-\-hex\-string\fP \fIpattern\fP
 Matches the given pattern in hex notation.
+.TP
+Example:
+.PP
+   Log HTTP GET requests for /test:
+.PP
+   iptables \-A INPUT \-p tcp \-\-dport 80 \-m string \-\-algo bm \-\-string 'GET /test' \-j LOG
+   iptables \-A INPUT \-p tcp \-\-dport 80 \-m string \-\-algo bm \-\-hex\-string '|474554202F74657374|' \-j LOG
Signature · 1 line
1.8.4.rc3
#1 lore raw

The markup is wrong.

Quoted 27 lines · Laurence J. Lane

Show delimeters for hex string pattern.

http://bugs.debian.org/699904

---
 extensions/libxt_string.man | 7 +++++++
 1 file changed, 7 insertions(+)
extensions/libxt_string.man +7 -1
index b6b271d..ebea1d3 100644
@@ -16,3 +16,10 @@ Matches the given pattern.
 .TP
 [\fB!\fP] \fB\-\-hex\-string\fP \fIpattern\fP
 Matches the given pattern in hex notation.
+.TP
+Example:
+.PP
+   Log HTTP GET requests for /test:
+.PP
+   iptables \-A INPUT \-p tcp \-\-dport 80 \-m string \-\-algo bm \-\-string 'GET /test' \-j LOG
+   iptables \-A INPUT \-p tcp \-\-dport 80 \-m string \-\-algo bm \-\-hex\-string '|474554202F74657374|' \-j LOG
--

1.8.4.rc3

#2 lore raw

PATCH v2 1/1 iptables: libxt_string.man add example

Show use of hex pattern delimeters.

http://bugs.debian.org/699904

---
 extensions/libxt_string.man | 6 ++++++
 1 file changed, 6 insertions(+)
extensions/libxt_string.man +6 -0
index b6b271d..ab395b2 100644
@@ -16,3 +16,9 @@ Matches the given pattern.
 .TP
 [\fB!\fP] \fB\-\-hex\-string\fP \fIpattern\fP
 Matches the given pattern in hex notation.
+.TP
+Example: log HTTP GET requests for /test using string and hex string patterns
+.IP
+iptables \-A INPUT \-p tcp \-\-dport 80 \-m string \-\-algo bm \-\-string 'GET /test' \-j LOG
+.IP
+iptables \-A INPUT \-p tcp \-\-dport 80 \-m string \-\-algo bm \-\-hex\-string '|474554202F74657374|' \-j LOG
Signature · 1 line
1.8.4.rc3
maintainer
#3 lore raw
Quoted 5 lines · Laurence J. Lane
extensions/libxt_string.man +0 -0
index b6b271d..ab395b2 100644

extensions/libxt_string.man Matches the given pattern. · line 24

Quoted 9 lines
extensions/libxt_string.man +6 -0
@@ -16,3 +16,9 @@ Matches the given pattern.
 .TP
 [\fB!\fP] \fB\-\-hex\-string\fP \fIpattern\fP
 Matches the given pattern in hex notation.
+.TP
+Example: log HTTP GET requests for /test using string and hex string patterns
+.IP
+iptables \-A INPUT \-p tcp \-\-dport 80 \-m string \-\-algo bm \-\-string 'GET /test' \-j LOG
+.IP
+iptables \-A INPUT \-p tcp \-\-dport 80 \-m string \-\-algo bm \-\-hex\-string '|474554202F74657374|' \-j LOG

The second example doesn't make much sense to me, IMHO, since there is no reason to use hex instead of ascii for this.

What about something like
-p udp --dport 53 -m string --algo bm --from 40 --to 57 --hex-string '|03|www|09|netfilter|03|org|00|'

?

#4 lore raw

PATCH v3 1/1 iptables: libxt_string.man add examples

Add usage examples for string and hex string patterns.

Reference: http://bugs.debian.org/699904

---
 extensions/libxt_string.man | 10 ++++++++++
 1 file changed, 10 insertions(+)
extensions/libxt_string.man +10 -0
index b6b271d..3a2fa08 100644
@@ -16,3 +16,13 @@ Matches the given pattern.
 .TP
 [\fB!\fP] \fB\-\-hex\-string\fP \fIpattern\fP
 Matches the given pattern in hex notation.
+.TP
+Examples:
+.IP
+# The string pattern can be used for simple text characaters.
+.br
+iptables \-A INPUT \-p tcp \-\-dport 80 \-m string \-\-algo bm \-\-string 'GET /index.html' \-j LOG
+.IP
+# The hex string pattern can be used for non-printable characaters, like |0D 0A| or |0D0A|.
+.br
+iptables \-p udp \-\-dport 53 \-m string \-\-algo bm \-\-from 40 \-\-to 57 \-\-hex\-string '|03|www|09|netfilter|03|org|00|'
Signature · 1 line
1.8.4.rc3
#5 lore raw

PATCH v4 1/1 iptables: libxt_string.man add examples

Add usage examples for string and hex string patterns.

Reference: http://bugs.debian.org/699904

---
 extensions/libxt_string.man | 10 ++++++++++
 1 file changed, 10 insertions(+)
extensions/libxt_string.man +10 -0
index b6b271d..78cfafb 100644
@@ -16,3 +16,13 @@ Matches the given pattern.
 .TP
 [\fB!\fP] \fB\-\-hex\-string\fP \fIpattern\fP
 Matches the given pattern in hex notation.
+.TP
+Examples:
+.IP
+# The string pattern can be used for simple text characaters.
+.br
+iptables \-A INPUT \-p tcp \-\-dport 80 \-m string \-\-algo bm \-\-string 'GET /index.html' \-j LOG
+.IP
+# The hex string pattern can be used for non-printable characaters, like |0D 0A| or |0D0A|.
+.br
+iptables \-p udp \-\-dport 53 \-m string \-\-algo bm \-\-from 40 \-\-to 57 \-\-hex\-string '|03|www|09|netfilter|03|org|00|'  \-j LOG
Signature · 1 line
1.8.4.rc3