Open main menu
Posts
Gists
Guilds
Users
Decipher
Docs
Open user menu
Log in
Sign up
Create a new gist
Posts
Gists
Guilds
Users
Decipher
Docs
Files
hackwifi.src
lib/deps.src
lib/color.src
hackwifi.src
import_code("/usr/src/lib/color.src")
import_code("/usr/src/lib/deps.src")
initdb = function(filepath)
// get wifi device name
netdev = get_shell.host_computer.network_devices.split(" ")[0]
globals.netdev = netdev
// scan networks
networks = {}
for network in get_shell.host_computer.wifi_networks(netdev)
networks[network.split(" ")[2]] = {}
networks[network.split(" ")[2]].bssid = {}
networks[network.split(" ")[2]].power = {}
networks[network.split(" ")[2]].bssid = network.split(" ")[0]
networks[network.split(" ")[2]].power = network.split(" ")[1]
end for
globals.networks = networks
// create database file if not exist
filepath = filepath.split("/")
file = get_shell.host_computer.File(filepath.join("/"))
if typeof(file) == "null" then
filename = filepath.pop
dir = []
for folder in filepath
dir.push(folder)
get_shell.host_computer.create_folder(dir.join("/").remove(dir[-1]),dir[-1])
end for
get_shell.host_computer.touch(dir.join("/"),filename)
file = get_shell.host_computer.File(dir.join("/")+"/"+filename)
// init database content
for essid in networks.indexes
if file.get_content == "" then
file.set_content(essid+":")
else if file.get_content != "" then
getfile = file.get_content
file.set_content(getfile+char(10)+essid+":")
end if
end for
end if
end function
checkdb = function(filepath,essid)
file = get_shell.host_computer.File(filepath)
db = file.get_content.split(char(10))
for line in db
if line.split(":")[0] == essid and line.split(":")[1] == "" then
print("<color=yellow>[INFO] No PW for "+line.split(":")[0]+"</color>")
return 0
break
end if
if line.split(":")[0] == essid and line.split(":")[1] != "" then
print("<color=yellow>[INFO] PW exists: "+line+"</color>")
return 1
break
end if
end for
end function
upddb = function(filepath)
file = get_shell.host_computer.File(filepath)
db = file.get_content.split(char(10))
obj = {}
for line in db
obj[line.split(":")[0]] = {}
// check password is there
if line.split(":")[1] != "" then
obj[line.split(":")[0]] = line.split(":")[1]
end if
// if not there check essid and include
if line.split(":")[1] == "" and line.split(":")[0] == essid then
obj[line.split(":")[0]] = password
end if
end for
newdb = []
for index in obj.indexes
if obj[index] == "" then
newdb.push(index+":")
end if
if obj[index] != "" then
newdb.push(index+":"+obj[index])
end if
end for
file.set_content(newdb.join(char(10)))
end function
connects = function()
file = get_shell.host_computer.File(filepath)
db = file.get_content.split(char(10))
obj = {}
for line in db
obj[line.split(":")[0]] = {}
obj[line.split(":")[0]] = line.split(":")[1]
end for
list = []
for x in obj.indexes
list.push(x)
end for
list.shuffle
print("Connecting to <color=yellow>"+list[0]+"</color>")
get_shell.host_computer.connect_wifi(netdev,networks[list[0]].bssid,list[0],obj[list[0]])
end function
libraries = libs([current_path,"/lib"],["crypto.so","metaxploit.so"])
CrypTools = libraries["cryptoLib"]
filepath = home_dir+"/"+"Config"+"/"+"Wifi.txt"
initdb(filepath)
for essid in networks.indexes
if checkdb(filepath,essid) then continue
acks = round(300000/networks[essid].power.remove("%").to_int,0)+1
print("<color=yellow>[INFO] "+essid+" -> "+acks+" ACKs</color>")
CrypTools.airmon("start",netdev)
CrypTools.aireplay(networks[essid].bssid,essid,acks)
CrypTools.airmon("stop",netdev)
filecap = get_shell.host_computer.File(parent_path(program_path)+"/"+"file.cap")
password = CrypTools.aircrack(filecap.path)
upddb(filepath)
print("<color=yellow>[INFO] "+essid+":"+password+"</color>")
end for
connects()
lib/deps.src
libs = function(dirs,names)
obj = {}
for name in names
for dir in dirs
file = get_shell.host_computer.File(dir+"/"+name)
if typeof(file) != "null" then
if file.has_permission("r") then
if file.is_binary then
print(msg(file,"info"))
obj.push( typeof( include_lib(file.path) ) )
obj[typeof( include_lib(file.path) )] = include_lib(file.path)
break
end if
if not file.is_binary then print(msg(file,"warn","binary"))
end if
if not file.has_permission("r") then print(msg(file,"warn","read"))
end if
if typeof(file) == "null" then print(msg(dir+"/"+name,"warn","notfound"))
end for
end for
return obj
end function
// Example:
// import_code("/usr/src/lib/color.src")
// libs(["path1","path2"],["libname1.so","libname2.so"])
//libs([current_path,"/lib"],["crypto.so","metaxploit.so"])
lib/color.src
msg = function(file,type,error)
tocolor = function(color)
return "<color="+color+">"+self.str+"</color>"
end function
convert = function(text)
obj = {}
obj.str = str(text)
obj.tocolor = @tocolor
return obj
end function
if type == "warn" then
color = "red"
if error == "binary" then
msg = "[WARN] "+file.path+" is not a binary."
else if error == "read" then
msg = "[WARN] "+file.path+" has no read permissions."
else if error == "notfound" then
msg = "[WARN] "+file+" does not exist."
else if error == "nocontent" then
msg = "[WARN] "+file.path+" has no content."
end if
else if type == "info" then
color = "yellow"
msg = "[INFO] Loaded "+file.path
end if
return convert(msg).tocolor(color)
end function
// Example:
// msg("string").tocolor("yellow")