Some Useful Scripts of Mine – Grey Hack

admin

These scripts are for beginners. There are three libraries available for code import. There are also two scripts for hacking (.

Learning scripts for beginners

You will find 5 scripts here that you can study in separate sections. Each script can be found in its section. Three scripts allow you to include (using import_code) for other scripts. I hope my scripts can help you, as they helped me. Plus, I learned to program as fast as possible thanks to my programming background. Check out my entire collection here.
Grey Hack repository at [github.com]

. After close to 300 hours of play in Grey Hack, this knowledge has been mys. All of the scripts that I wrote, that are still good, are available.

– Phil

Autohack Source Version 1.0

NOTE: This script will hack all sorts of stuff and give root access shells as soon as possible if you are a guest.

import_code("/home/<game-user>/source/getlib.src")
import_code("/home/<game-user>/source/gethacks.src")
import_code("/home/<game-user>/source/shelltype.src")

if params.len > 2 then exit("Usage: autohack <addr> <port>\nport = Can equal 0 for router.")
if params.len == 1 or params.len == 2 then
 if not is_valid_ip(params[0]) then exit("Error: Invalid IP address.")
 if (params[1].val < 0 or params[1].val > 65535) then exit("Error: Invalid port number.")

 result = null
 if params.len == 2 then
 result = get_remote_hacks(params[0], params[1].val)
 else
 result = get_remote_hacks(params[0])
 end if
 if not result then exit()

 shell = null
 metax = result["dump"]
 hacks = result["hacks"]
 if not hacks or hacks.len == 0 then exit()

 for hack in hacks
 print("Address: " + hack["memory"])
 for value in hack["values"]
 print(" --> " + value)
 result = metax.overflow(hack["memory"], value, "pa*s")
 if not result then continue

 if typeof(result) == "computer" then
 // Do something with computer type.
 else if typeof(result) == "file" then
 // Do something with file type.
 else if typeof(result) == "shell" then
 // Do something with shell type.
 shell = result
 else
 print("Unknown type of exploit result.")
 end if
 if shell then break
 end for
 if shell then break
 end for

 // Do something with the shell.
 if shell != null then
 files = []
 filenames = ["metaxploit.so", "crypto.so", "autohack"]
 dirs = ["/lib/", parent_path(launch_path) + "/", parent_path(program_path) + "/"]
 
 for filename in filenames
 for dir in dirs
 if get_shell.host_computer.File(dir + filename) then
 files = files + [dir + filename]
 break
 end if
 end for
 end for
 if files.len == 0 then exit("Error: Cannot get files for transfer.")
 
 // Transfer files
 for file in files
 get_shell.scp(file, "/home/guest", shell)
 end for
 
 shell.launch("/home/guest/autohack", "")
 end if
else
 // Local exploit.
 default = get_shell_type(get_shell)
 if default["user"] == "root" then
 print("Starting root shell...")
 default["shell"].start_terminal
 end if
 
 // Login to normal user account.
 print("Logging into normal user account...")
 homedir = default["shell"].host_computer.File("/home")
 if not homedir then exit("Error: Could not get home directory.")
 username = null
 usershell = null
 for dir in homedir.get_folders
 if dir.name - [dir.name]  != "guest" then
 username = dir.name - [dir.name] 
 usershell = get_shell(username, "pa*s")
 if usershell != null then break
 end if
 end for
 if not usershell then default["shell"].start_terminal
 
 // Get root access.
 print("Getting root access...")
 crypto = get_library("crypto.so")
 if not crypto then exit("Error: Crypto not found on system.")
 file = usershell.host_computer.File("/etc/pa*swd")
 if not file then exit("Error: Cannot get pa*swd file.")
 if not file.has_permission("r") then exit("/etc/pa*swd: Permission denied.")
 if file.is_binary or file.is_folder then exit("File is either binary or a folder.")
 roothash = file.get_content.split("\n")[0].split(":")[1]
 if not roothash then exit("Error: Cannot get root hash.")
 pa*sword = crypto.decipher(roothash)
 if not pa*sword then exit("Error: Failed to decrypt root pa*sword.")
 print("User: root\nPa*s: " + pa*sword)
 get_shell("root", pa*sword).start_terminal
end if

 

Version 1.0 of AutowifiSource

NOTE: It is simple to hack wifi. Select the interface and network and let the script take care of the rest.

// Gather all network devices into an array.
array = []
devices = get_shell.host_computer.network_devices
for device in devices.split("\n")
 array = array + [device.split(" ")[0]]
end for

// List all network devices and get user option.
option = null
while not option or (option.val < 0 or option.val > array.len)
 i = 1

 for device in array
 if device == "" then continue
 print(i + ". " + device)
 i = i + 1
 end for

 print("0. Exit\n")
 option = user_input("Enter choice? ")
end while

// Check if option is exit.
if option.val == 0 then exit("Quitting wifi autohack...")

netdev = array[option.val - 1]
networks = get_shell.host_computer.wifi_networks(array[option.val - 1])
option = null
while not option or (option.val < 0 or option.val > networks.len)
 // List all wifi networks.
 i = 1
 info = "OPTION BSSID PWR ESSID"
 
 for network in networks
 info = info + "\n" + i + ". " + network
 i = i + 1
 end for

 print(format_columns(info))
 print("0. Exit")
 
 option = user_input("Enter choice? ")
end while

// Check if option is exit.
if option.val == 0 then exit("Quitting wifi autohack...")

// Process and connect to network.
bssid = networks[option.val - 1].split(" ")[0]
essid = networks[option.val - 1].split(" ")[2]

import_code("/home/5n4k3/source/getlib.src")

// Use crypto
crypt = get_library("crypto.so")
if not crypt then exit()

// Crack wifi pa*sword.
crypt.airmon("start", netdev)
crypt.aireplay(bssid, essid, 15000)
crypt.airmon("stop", netdev)
pa*s = crypt.aircrack(parent_path(launch_path) + "/file.cap")

// Connect to wifi network.
print("Trying to connect to " + essid)
if not get_shell.host_computer.connect_wifi(netdev, bssid, essid, pa*s) then
 print("Failed to connect to " + essid)
end if

 

GetLib Source Version (Library to Import a Library Module)

NOTE: This source is for import_code() function in scripting. Autohack relies upon this.

///////////////////////////////////////////
// Get local library.
// Returns: Metalib library.
///////////////////////////////////////////
get_library = function(libname = "metaxploit.so")
 mx = null
 libpaths = ["/lib/", parent_path(program_path) + "/"]
 for libpath in libpaths
 mx = include_lib(libpath + libname)
 if not mx then
 print("Warning: Library not found at '" + libpath + "'.")
 else
 print("Information: Found library '" + libname + "'.")
 break
 end if
 end for
 return mx
end function

 

GetHacksSource Version 1.0 (Libraries to get remote and locally hacks)

NOTE: This library may be used in autohack. Also, it can be used to import_code() function in scripting.

//////////////////////////////////////
// Description: Get all remote hacks.
// Returns: Hacks
//////////////////////////////////////
get_remote_hacks = function(addr = null, port = 0)
 result = {}
 
 // Run against a remote address/port combination
 if not is_valid_ip(addr) then
 print("Error: Invalid IP address given.")
 return result
 end if
 
 mx = get_library()
 if not mx then return result
 
 netsession = mx.net_use(addr, port)
 if not netsession then
 print("Error: Cannot get net session.")
 return result
 end if
 
 dump = netsession.dump_lib
 if not dump then
 print("Error: Cannot dump library.")
 return result
 end if

 hacks = [] 
 addresses = mx.scan(dump)
 for mem in addresses
 pair = {}
 values = []
 //print("Address: " + mem)
 data = mx.scan_address(dump, mem)
 strings = data.split("Unsafe check: ")
 for string in strings
 if string == strings[0] then continue
 
 value = string[string.indexOf("<b>")+3:string.indexOf("</b>")]
 //print(" --> " + value)
 values = values + [value]
 end for
 pair["memory"] = mem
 pair["values"] = values
 hacks = hacks + [pair]
 end for
 result["dump"] = dump
 result["hacks"] = hacks
 return result
end function

//////////////////////////////////////
// Description: Get all local hacks.
// Returns: Hacks
//////////////////////////////////////
get_local_hacks = function()
 filenames = ["net.so", "init.so", "kernel_module.so", "kernel_router.so"]
 hacks = []

 mx = get_library()
 if not mx then return hacks

 for filename in filenames
 dump = mx.load("/lib/" + filename)
 if not dump then
 print("Error: Could not find " + filename)
 continue
 end if
 print("Getting local hacks for /lib/" + filename)

 hacks = [] 
 addresses = mx.scan(dump)
 for mem in addresses
 hack = {}
 values = []
 //print("Address: " + mem)
 data = mx.scan_address(dump, mem)
 strings = data.split("Unsafe check: ")
 for string in strings
 if string == strings[0] then continue
 
 value = string[string.indexOf("<b>")+3:string.indexOf("</b>")]
 //print(" --> " + value)
 values = values + [value]
 end for
 hack["metalib"] = dump
 hack["memory"] = mem
 hack["values"] = values
 hacks = hacks + [hack]
 end for
 end for
 return hacks
end function

 

ShellType Source Version (Gets information about the shell owner of a given shell)

NOTE: This tiny library grants shell owners (access levels like “root”,), or “guest”, and also allows them to use autohack script.

////////////////////////////////////////////////////////
// Function to return shell object with user and type.
////////////////////////////////////////////////////////
get_shell_type = function(result)
 shell = {}
 if typeof(result) == "shell" then
 if result.host_computer.touch("/home/guest", "anonymous.dat") then
 file = result.host_computer.File("/home/guest/anonymous.dat")
 if not file then
 print("File doesn't exist.")
 exit()
 end if
 shell["user"] = file.owner
 shell["shell"] = result
 file.delete
 end if
 end if
 return shell
end function

 

Written by theplague1988

I hope you enjoy the Some Useful Scripts of Mine – Grey Hack guide. This is all for now! If you have something to add to this guide or forget to add some information, please let us know via comment! We check each comment manually!

TAGGED:
Share This Article