-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfindEM.py
More file actions
37 lines (32 loc) · 1.09 KB
/
findEM.py
File metadata and controls
37 lines (32 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import nmap3
import netifaces as ni
from rich.console import Console
console = Console()
nmap = nmap3.NmapHostDiscovery()
#Below is what is deciding what to do in different cases, then its doing the scan
try:
ni.ifaddresses('wlan0')
ip = ni.ifaddresses('wlan0')[ni.AF_INET][0]['addr']
ip = str(ip+'/24')
results = nmap.nmap_no_portscan(ip)
except:
try:
interface = str(input('Enter Your Interface name e.g. wlan0: '))
ni.ifaddresses(interface)
ip = ni.ifaddresses(interface)[ni.AF_INET][0]['addr']
ip = str(ip+'/24')
results = nmap.nmap_no_portscan(ip)
except KeyboardInterrupt:
print("\nGood Bye!")
console.print(f'[yellow]MAC ADDRESS [blue]--- [yellow]DEVICE NAME', style="bold")
#Below is what's printing the result to the user
try:
for result in results:
try:
mac = results[result]['macaddress']['addr']
name = results[result]['macaddress']['vendor']
console.print(f'[yellow]{mac} [blue] --- [yellow]{name}', style="bold")
except:
pass
except NameError:
pass