Skip to content

Instantly share code, notes, and snippets.

@Blackhawk95
Last active April 10, 2018 17:24
Show Gist options
  • Save Blackhawk95/a3c0975853ae02d36eca1601934f0b38 to your computer and use it in GitHub Desktop.
Save Blackhawk95/a3c0975853ae02d36eca1601934f0b38 to your computer and use it in GitHub Desktop.
iptables commands rocks
3.
abhijithm@archlabs ~ % ping 192.168.43.35
PING 192.168.43.35 (192.168.43.35) 56(84) bytes of data.
^C
--- 192.168.43.35 ping statistics ---
32 packets transmitted, 0 received, 100% packet loss, time 37674ms
4.
HAHA i blockedd facebook
abhijithm@archlabs ~ % sudo iptables -A OUTPUT -p tcp -m string --string "facebook.com" --algo kmp -j REJECT
##########TABLE#########
abhijithm@archlabs ~ % sudo iptables -L -v -n
Chain INPUT (policy ACCEPT 1096 packets, 553K bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 1328 packets, 187K bytes)
pkts bytes target prot opt in out source destination
0 0 REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 STRING match "facebook.com" ALGO name kmp TO 65535 reject-with icmp-port-unreachable
6.
abhijithm@archlabs ~ % ping 192.168.43.35
PING 192.168.43.35 (192.168.43.35) 56(84) bytes of data.
^C
--- 192.168.43.35 ping statistics ---
29 packets transmitted, 0 received, 100% packet loss, time 28674ms
12.
127 abhijithm@archlabs ~ % ping 192.168.43.35 | perl -nle 'use Time::Piece; BEGIN {$|++} print localtime->datetime, " ", $_'
2018-04-10T17:08:55 64 bytes from 192.168.43.35: icmp_seq=133 ttl=64 time=4.40 ms
2018-04-10T17:08:56 64 bytes from 192.168.43.35: icmp_seq=134 ttl=64 time=6.54 ms
2018-04-10T17:08:57 64 bytes from 192.168.43.35: icmp_seq=135 ttl=64 time=2.64 ms
2018-04-10T17:08:58 64 bytes from 192.168.43.35: icmp_seq=136 ttl=64 time=2.19 ms
2018-04-10T17:08:59 64 bytes from 192.168.43.35: icmp_seq=137 ttl=64 time=3.17 ms
2018-04-10T17:10:01 64 bytes from 192.168.43.35: icmp_seq=198 ttl=64 time=6.05 ms
2018-04-10T17:10:02 64 bytes from 192.168.43.35: icmp_seq=199 ttl=64 time=57.4 ms
2018-04-10T17:10:03 64 bytes from 192.168.43.35: icmp_seq=200 ttl=64 time=13.2 ms
2018-04-10T17:10:04 64 bytes from 192.168.43.35: icmp_seq=201 ttl=64 time=2.62 ms
2018-04-10T17:10:05 64 bytes from 192.168.43.35: icmp_seq=202 ttl=64 time=10.9 ms
14.
abhijithm@archlabs ~ % ping 192.168.43.35
PING 192.168.43.35 (192.168.43.35) 56(84) bytes of data.
^C
--- 192.168.43.35 ping statistics ---
8 packets transmitted, 0 received, 100% packet loss, time 7149ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment