Files
greyhack/source/wifi.src

39 lines
1.0 KiB
Plaintext

crypto = include_lib("/lib/crypto.so")
computer = get_shell.host_computer
cappath = current_path + "/file.cap"
info = "BSSID STRENGTH ESSID"
netname = ""
command = ""
if params.len > 0 then command = params[0]
for letter in computer.network_devices
if letter == " " then
break
end if
netname = netname + letter
end for
nets = computer.wifi_networks(netname)
for net in nets
bssid = net.split(" ")[0]
strength = net.split(" ")[1][0:2].to_int
essid = net.split(" ")[2]
if command == "-l" then
info = info + "\n" + net
continue
else if command == essid or command == bssid or command == "" then
crypto.airmon("start", netname)
crypto.aireplay(bssid, essid, floor(300000 / strength))
pwd = crypto.aircrack(cappath)
print(pwd)
capfile = computer.File(cappath)
capfile.delete
crypto.airmon("stop", netname)
connected = computer.connect_wifi(netname, bssid, essid, pwd)
if connected then
print("Connected to " + essid)
end if
end if
end for
if command == "-l" then
print(format_columns(info))
end if