Preventing the analyzed device to reach TinyCheck

This commit is contained in:
Félix Aime 2021-02-26 13:25:10 +01:00
parent 4488a52631
commit e4d63a7ef5

View File

@ -290,8 +290,14 @@ class Network(object):
try: try:
sp.Popen("echo 1 > /proc/sys/net/ipv4/ip_forward", sp.Popen("echo 1 > /proc/sys/net/ipv4/ip_forward",
shell=True).wait() shell=True).wait()
# Enable forwarding.
sp.Popen(["iptables", "-A", "POSTROUTING", "-t", "nat", "-o", sp.Popen(["iptables", "-A", "POSTROUTING", "-t", "nat", "-o",
self.iface_out, "-j", "MASQUERADE"]).wait() self.iface_out, "-j", "MASQUERADE"]).wait()
# Prevent the device to reach the 80 of TinyCheck.
sp.Popen(["iptables", "-A", "INPUT", "-i", self.iface_in, "-d",
"192.168.100.1", "-p", "tcp", "--dport", "80", "-j" "DROP"]).wait()
return True return True
except: except:
return False return False