mirror of
https://github.com/byt3bl33d3r/MITMf.git
synced 2025-07-07 13:32:18 -07:00
Merged patch from Alexander Georgiev (alexander.georgiev@daloo.de) to disable automatic setup & flushing of iptables rules
This commit is contained in:
parent
acdbb03dfb
commit
3dc7283109
2 changed files with 13 additions and 7 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit 35d67b82050a7e7315132185129f5e65a0893b75
|
Subproject commit 2e1baf59cd11bfba38781ec536be930e28cec07c
|
|
@ -41,6 +41,7 @@ class Spoof(Plugin):
|
||||||
self.target = options.target
|
self.target = options.target
|
||||||
self.arpmode = options.arpmode
|
self.arpmode = options.arpmode
|
||||||
self.port = self.options.listen
|
self.port = self.options.listen
|
||||||
|
self.manualiptables = options.manualiptables #added by alexander.georgiev@daloo.de
|
||||||
self.debug = False
|
self.debug = False
|
||||||
self.send = True
|
self.send = True
|
||||||
|
|
||||||
|
@ -51,7 +52,8 @@ class Spoof(Plugin):
|
||||||
self.debug = True
|
self.debug = True
|
||||||
|
|
||||||
print "[*] Spoof plugin online"
|
print "[*] Spoof plugin online"
|
||||||
os.system('iptables -F && iptables -X && iptables -t nat -F && iptables -t nat -X')
|
if not self.manualiptables:
|
||||||
|
os.system('iptables -F && iptables -X && iptables -t nat -F && iptables -t nat -X')
|
||||||
|
|
||||||
if self.arp == True:
|
if self.arp == True:
|
||||||
if self.icmp == True:
|
if self.icmp == True:
|
||||||
|
@ -95,15 +97,17 @@ class Spoof(Plugin):
|
||||||
elif self.dnscfg:
|
elif self.dnscfg:
|
||||||
self.dnscfg = ConfigObj(self.dnscfg)
|
self.dnscfg = ConfigObj(self.dnscfg)
|
||||||
|
|
||||||
os.system('iptables -t nat -A PREROUTING -p udp --dport 53 -j NFQUEUE')
|
if not self.manualiptables:
|
||||||
|
os.system('iptables -t nat -A PREROUTING -p udp --dport 53 -j NFQUEUE')
|
||||||
print "[*] DNS Spoofing enabled"
|
print "[*] DNS Spoofing enabled"
|
||||||
self.start_dns_queue()
|
self.start_dns_queue()
|
||||||
|
|
||||||
print '[*] Setting up ip_forward and iptables'
|
|
||||||
file = open('/proc/sys/net/ipv4/ip_forward', 'w')
|
file = open('/proc/sys/net/ipv4/ip_forward', 'w')
|
||||||
file.write('1')
|
file.write('1')
|
||||||
file.close()
|
file.close()
|
||||||
os.system('iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port %s' % self.port)
|
if not self.manualiptables:
|
||||||
|
print '[*] Setting up iptables rules'
|
||||||
|
os.system('iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port %s' % self.port)
|
||||||
|
|
||||||
t = threading.Thread(name='send_packets', target=self.send_packets, args=(pkt,self.interface,self.debug,))
|
t = threading.Thread(name='send_packets', target=self.send_packets, args=(pkt,self.interface,self.debug,))
|
||||||
t.setDaemon(True)
|
t.setDaemon(True)
|
||||||
|
@ -198,15 +202,17 @@ class Spoof(Plugin):
|
||||||
options.add_argument('--domain', type=str, dest='domain', help='Domain to spoof [e.g google.com]')
|
options.add_argument('--domain', type=str, dest='domain', help='Domain to spoof [e.g google.com]')
|
||||||
options.add_argument('--dnsip', type=str, dest='dnsip', help='IP address to resolve dns queries to')
|
options.add_argument('--dnsip', type=str, dest='dnsip', help='IP address to resolve dns queries to')
|
||||||
options.add_argument("--dnscfg", type=file, help="Specify a config file")
|
options.add_argument("--dnscfg", type=file, help="Specify a config file")
|
||||||
|
options.add_argument('--manualiptables', dest='manualiptables', action='store_true', default=False, help='Do not setup iptables of flush iptables rules automatically')
|
||||||
|
|
||||||
def finish(self):
|
def finish(self):
|
||||||
self.send = False
|
self.send = False
|
||||||
sleep(3)
|
sleep(3)
|
||||||
print '\n[*] Resetting ip_forward and iptables'
|
|
||||||
file = open('/proc/sys/net/ipv4/ip_forward', 'w')
|
file = open('/proc/sys/net/ipv4/ip_forward', 'w')
|
||||||
file.write('0')
|
file.write('0')
|
||||||
file.close()
|
file.close()
|
||||||
os.system('iptables -F && iptables -X && iptables -t nat -F && iptables -t nat -X')
|
if not self.manualiptables:
|
||||||
|
print '\n[*] Flushing iptables rules'
|
||||||
|
os.system('iptables -F && iptables -X && iptables -t nat -F && iptables -t nat -X')
|
||||||
|
|
||||||
if self.dns == True:
|
if self.dns == True:
|
||||||
self.q.unbind(socket.AF_INET)
|
self.q.unbind(socket.AF_INET)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue