-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmon.py
More file actions
executable file
·40 lines (32 loc) · 1.4 KB
/
mon.py
File metadata and controls
executable file
·40 lines (32 loc) · 1.4 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
37
38
39
40
#!/bin/python3
import argparse
import os
def setMonitorMode(interface):
os.system('nmcli dev disconnect %s' % interface)
os.system('ifconfig %s down' % interface)
os.system('iwconfig %s mode monitor' % interface)
os.system('ifconfig %s up' % interface)
def setManagedMode(interface):
os.system('ifconfig %s down' % interface)
os.system('iwconfig %s mode managed' % interface)
os.system('ifconfig %s up' % interface)
if __name__ == "__main__":
macVictim = ""
parser = argparse.ArgumentParser(
description="This script put your network interface in monitor mode or in managed mode.")
parser.add_argument("-i", "--interface", required=True, help="Network interface")
parser.add_argument("-mt", "--monitorMode", required=False, action='store_true',
help="This option put your interface in monitor mode")
parser.add_argument("-mg", "--managedMode", required=False, action='store_true',
help="This option put your interface in managed mode")
args = parser.parse_args()
if args.monitorMode:
if args.managedMode:
print("You need to specify only one option: -mt or -mg")
else:
setMonitorMode(args.interface)
else:
if not args.managedMode:
print("You need to specify one of these options: -mt or -mg")
else:
setManagedMode(args.interface)