Skip to content

Instantly share code, notes, and snippets.

@AKosterin
Last active January 8, 2023 08:45
Show Gist options
  • Save AKosterin/347db85f2ff50e352ab24267f19757ae to your computer and use it in GitHub Desktop.
Save AKosterin/347db85f2ff50e352ab24267f19757ae to your computer and use it in GitHub Desktop.
Grey Hack Scripts
host_comp = get_shell.host_computer
crypto = include_lib("/lib/crypto.so")
if not crypto then exit("Error: Missing crypto library")
get_net_devices = function (computer)
devices = []
for device in computer.network_devices.split("\n")
if device.len > 0 then
params = device.split(" ")
devices.push({"interface":params[0],"chipset":params[1],"monitor_mode":(params[2] == "True")})
end if
end for
return devices
end function
get_wifi_devices = function (computer)
devices = get_net_devices(computer)
for device in devices
if device.interface.indexOf("wlan") != 0 then
devices.remove(devices.indexOf(device))
end if
end for
return devices
end function
get_wifi_networks = function (computer, interface)
networks = []
for network in host_comp.wifi_networks(wifi_devs[0].interface)
if network.len > 0 then
params = network.split(" ")
networks.push({"bssid":params[0],"pwr":params[1].remove("%").to_int,"essid":params[2],"acks":ceil(300000/params[1].remove("%").to_int)})
end if
end for
return networks
end function
start_airmon_mode = function (device)
if not device.monitor_mode then
output = crypto.airmon("start", device.interface)
if not output then exit("airmon: " + device.interface + " not found")
if typeof(output) == "string" then exit(output)
end if
end function
stop_airmon_mode = function (device)
if device.monitor_mode then
output = crypto.airmon("stop", device.interface)
if not output then exit("airmon: " + device.interface + " not found")
if typeof(output) == "string" then exit(output)
end if
end function
select_wifi_network_for_hack = function (computer, interface)
networks = get_wifi_networks(computer, interface)
if networks == null then
exit("Error: networks not found")
end if
networks.sort("pwr").reverse
info = "Num BSSID PWR ESSID ACKs\n"
for i in range (1, networks.len)
network = networks[i-1]
info = info + "[" + i + "] " + network.bssid + " " + network.pwr + "% " + network.essid + " " + network.acks + "\n"
end for
print(format_columns(info))
net_num = user_input("Select WiFi network number for attack [1-" + networks.len + "]: ").to_int
if typeof(net_num) != "number" or net_num < 1 or net_num > networks.len then exit("Error: incorrect WiFi number select")
return networks[net_num-1]
end function
wifi_devs = get_wifi_devices(host_comp)
if wifi_devs.len < 1 then exit("Error: Wifi devices not found")
start_airmon_mode(wifi_devs[0])
network = select_wifi_network_for_hack(host_comp, wifi_devs[0].interface)
data = crypto.aireplay(network.bssid, network.essid, network.acks)
if typeof(data) == "string" then exit(data)
cap_file = host_comp.File("file.cap")
if not cap_file or not cap_file.has_permission("r") or not cap_file.is_binary then exit("Error: correct file.cap not available")
password = crypto.aircrack(cap_file.path)
cap_file.delete
if not password then exit("Error: Key not found")
host_comp.connect_wifi(wifi_devs[0].interface, network.bssid, network.essid, password)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment