Files
greyhack/source/wifi.src

51 lines
1.4 KiB
Plaintext

if params.len < 1 or params[0] == "-h" or params[0] == "--help" then
current_program = get_shell.host_computer.File(program_path)
print "Usage: " + current_program.name + " [-l|-a|<ESSID>|<BSSID>]"
print " -l list nearby networks"
print " -a crack and connect to all networks"
print " MyNetwork crack and connect by ESSID"
print " AA:BB:CC:DD:EE:FF crack and connect by BSSID"
exit
end if
crypto = include_lib("/lib/crypto.so")
computer = get_shell.host_computer
cappath = current_path + "/file.cap"
info = "BSSID STRENGTH ESSID"
netname = ""
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 == "-a" 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