-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwispam.py
143 lines (121 loc) · 4.51 KB
/
wispam.py
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
import random, os, argparse, sys
try:
from scapy.all import ( Dot11,
Dot11Beacon,
Dot11Elt,
RadioTap,
sendp)
except ImportError:
print("scapy import edilemedi.")
print("'pip3 install scapy' yüklediğinize emin olun.")
sys.exit(0)
def randomMACVendor(vendor):
generated = ""
for i in range(0,3):
generated += ":" + hex(random.randint(0,255))[2:]
return vendor + generated
def random_mac():
generated = ""
for i in range(0,6):
generated += ":" + hex(random.randint(0,255))[2:]
return generated[1:]
# SSID listesini al
def getSSIDs(file):
SSIDs = []
ssidList = open(file)
for line in ssidList.readlines():
SSIDs.append(line[:-1])
ssidList.close()
return SSIDs
# Ag aygıtını izleme moduna alma komutu
def setMonitor(interface):
exitValue = 0
print(f"Setting {interface} in monitor mode...")
os.system(f"ifconfig {interface} down")
exitValue = os.system(f"iwconfig {interface} mode monitor")
os.system(f"ifconfig {interface} up")
if exitValue != 0:
print("")
print("İzleme moduna alırken bir hata oluştu")
print("Kartının izleme modunu destekledigine emin misin?")
sys.exit(0)
# Managed moda alma
def setManaged(interface):
os.system(f"ifconfig {interface} down")
os.system(f"ifconfig {interface} mode managed")
os.system(f"ifconfig {interface} up")
vendors = {"Nokia":"C0:41:21", "Apple":"BC:92:6B",
"Arduino":"A8:61:0A", "Motorola":"00:E0:0C", "Google":"54:60:09"}
beacon = Dot11Beacon(cap="ESS", timestamp=1)
rsn = Dot11Elt(ID='RSNinfo', info=(
'\x01\x00' #RSN Version 1
'\x00\x0f\xac\x02' #Group Cipher Suite : 00-0f-ac TKIP
'\x02\x00' #2 Pairwise Cipher Suites (next two lines)
'\x00\x0f\xac\x04' #AES Cipher
'\x00\x0f\xac\x02' #TKIP Cipher
'\x01\x00' #1 Authentication Key Managment Suite (line below)
'\x00\x0f\xac\x02' #Pre-Shared Key
'\x00\x00')) #RSN Capabilities (no extra capabilities)
# Parse arguments
DESCRIPTION = "Another silly beacon spammer ;)"
parser = argparse.ArgumentParser(description=DESCRIPTION)
parser.add_argument("-f", "--file", default="wifi.lst", help="File to import the SSIDs from (default wifi.lst)")
parser.add_argument("-v", "--vendor", default="Apple", help="Vendor to spoof (-l to list available vendors)")
parser.add_argument("-i", "--interface", help="Interface used to spam SSIDs")
parser.add_argument("-l", "--list-vendors",action="store_true", help="List vendors")
parser.add_argument("-r", "--random-mac",action="store_true", help="Uses a fully random BSSID instead of using a vendor")
args = parser.parse_args()
# OS Kontrolü
if sys.platform.lower() != "linux":
print("BU YAZILIM SADECE LİNUX DA CALISABİLİR")
sys.exit(0)
# ROOT Kontrolü
if os.getuid() != 0:
print("ROOT OLARAK CALISTIR")
sys.exit(0)
if args.list_vendors:
print("Vendors to choose (default Apple):\n")
for vendor in vendors:
print(vendor)
sys.exit(0)
# Aygıt KONTROLÜ
if not args.interface:
print("ARAYUZ BELIRTILMEMIS. CIKIYORUM")
sys.exit(0)
else:
interfaces = os.listdir("/sys/class/net/")
if args.interface not in interfaces:
print("ARAYUZ BULUNAMADI")
sys.exit(0)
# ARAYÜZÜ İZLEME MODUNA ALMA
setMonitor(args.interface)
# Ana KOD
try:
SSIDs=getSSIDs(args.file)
iface = args.interface
while True:
#For each SSID
for SSID in SSIDs:
# Set MAC
if args.random_mac:
sender=randomMAC
else:
sender = randomMACVendor(vendors[args.vendor])
# Create paquet
dot11 = Dot11(type=0, subtype=8, addr1='ff:ff:ff:ff:ff:ff',
addr2=sender, addr3=sender)
essid = Dot11Elt(ID='SSID',info=SSID, len=len(SSID))
frame = RadioTap()/dot11/beacon/essid/rsn
print("Sending paquet with SSID: " + SSID)
print("MAC: " + sender)
#Switch channel
channel = random.randint(1,11)
os.system(f"iw dev {args.interface} set channel {channel}")
print("Channel " + str(channel))
# Send beacons
sendp(frame, iface=iface, inter=0.010, loop=0, verbose=1, count=8)
print("\n")
except KeyboardInterrupt:
print(f"\n\nWiSPam Durdu. Setting {args.interface} in managed mode")
setManaged(args.interface)
print("Tamamlandı...")