Grey Hack

Grey Hack

37 rating
Automate Wi-Fi Hacking (Beginner Scripting Tutorial)
Oleh Nathan
A beginner example - step by step - to create a script to automate the first thing you do in a new game of Grey Hack.
2
   
Penghargaan
Favorit
Difavoritkan
Batalkan favorit
How To
We all have to do it each time we start the game - hack a wi-fi for an internet connection - here we take it a step further and write a beginner friendly script for it.

Each block of code is broken in separate sections and each line is commented (anything after "//" is a comment) so you can follow along and understand the step by step process of the script line by line, block by block, you can take the code blocks and paste them into your code editor (it will display the code better than steam does and make it easier to read and understand) to piece together the whole script, then you can save the whole script and run it in your terminal and it will do what is shown in the example images.

I recommend you have the manual open and any line of the script you don't understand you can search and get some more explanation. In the example we want to know what the "current_path" part of the script means, it's all in the manual. Good luck and keep learning.

Airmon
Airmon is the first step, we run it to see devices capable of monitoring, which is required to capture packets which are in turn used to piece the password together.

cryptools = include_lib("/lib/crypto.so") // import library containing all the "air" tools. // airmon get_shell.launch("/bin/airmon") // list all monitor capable device states device = user_input("[+]Choose Interface: ") // ask for user to pick device if not device[0:4] == "wlan" then exit end if // check they at least chose a wireless Interface using slice print("\n[-]New State...\n") cryptools.airmon("start", device) // start the device in monitor mode get_shell.launch("/bin/airmon") // show new state

Result:

iwlist
iwlist shows all available wireless networks with all the required information; the BSSID & ESSID & PWR (the strength of the signal) realistically, higher % is a stronger faster connection. We find the highest PWR (76%, nice) and target it by entering the details.

The number of ACKs to capture has to be at least 7000, however more gives a higher chance to successfully collect the whole password, we input 8000 in the example.

// iwlist print("[-]Choose BSSID & ESSID (more PWR% is better)\n") get_shell.launch("/bin/iwlist", device) // list detected wireless networks b = user_input("\n[+]BSSID: ") // ask for BSSID e = user_input("\n[+]ESSID: ") // ask for corrisponding ESSID acks = user_input("\n[+]ACKs (>7000): ").to_int // ask for ACK count to aim for, and convert to int print("\n") if acks < 7000 then acks = 7000 end if // if user enters less than 7000 (the minimum for success) then set it to 7000

Result:

Aireplay
Aireplay takes our input from iwlist and starts capturing those packets, when it has the required amount (we chose 8000) it stops capturing and saves the capture in a file called "file.cap".

// aireplay cryptools.aireplay(b, e, acks) // run aireplay with the user input from above print("\n[-]Got Required amount of ACKs...") print("[-]Waiting for file.cap to be written...\n") wait(5) // without this aircrack runs immediately and file.cap isnt written yet print("[-]Cracking...\n")

Aircrack
aircrack takes the "file.cap" aireplay created and cracks it, it could fail without enough ACKs, 7000 is the minimum but it could take much more, in this case our 8000 was enough and so it displays the key (the wireless password) and now we can connect to that wireless router with that key.

// aircrack capfile = current_path + "/file.cap" // set file.cap path get_shell.launch("/bin/aircrack", capfile) // aircrack the file and display result print("\n[-]Stopping device monitoring...\n")

Airmon (again)
The same way we enabled monitor mode on the device, we can now disable it and stop monitoring as we are done capturing packets.

// airmon cryptools.airmon("stop", device) // turn off monitor mode get_shell.launch("/bin/airmon") // show new state

Cleaning Up
Covering your tracks is an important step, we offer the user to delete the evidence (the "file.cap"). In the example we chose to keep the file because the rules are made to be broken, Goodbye... :)

// clean up capfile = get_shell.host_computer.File(current_path + "/file.cap") // prep capfile for potential deletion confirm = user_input("Destroy file.cap (y/N): ") if confirm == "Y" or confirm == "y" or confirm == "Yes" or confirm == "yes" then capfile.delete end if // delete capfile if user input is yes print("\n[-]Goodbye...\n")

11 Komentar
Joe Bishop 15 Sep 2024 @ 9:45am 
Had to rewrite all if statements to follow this format:

if condition then
function
end if

This allows the code editor to read it as intended and be able to save without errors.
KenDoll 1 Jul 2023 @ 1:42am 
I get this error in the first Airmon script, Compiler Error: got Keyword(end if) where number, string, or identifier is required [line 6]
Nathan  [pembuat] 21 Sep 2022 @ 3:21am 
Let me know if the latest update breaks the script, I will fix it. :steamthumbsup:
Ril 10 Agu 2022 @ 11:13am 
Thank you very much for this tutorial Nathan!

I made my own script with automatic wifi connection and the option save the wifi information into a file :)

It's called "wificon": https://gist.github.com/RilDev/311a1510418d27097207f4a966aedce4
tihpuher 10 Jan 2022 @ 5:30pm 
I made it. Full rework/remake/reinvent for script!

https://steamcommunity.com/sharedfiles/filedetails/?id=2715476912
Isco 1 Sep 2021 @ 4:20pm 
Nice one still up to the date.Keep it like that.
Napo_II 25 Jul 2021 @ 8:56pm 
1a big love
KenDoll 7 Feb 2021 @ 8:26am 
IF i'm able to do so, i'll give you the addition to add in here if you want, as long as i get some credit xD
Nathan  [pembuat] 6 Feb 2021 @ 7:29am 
A starting point for that would be:

[code]
get_shell.host_computer.wifi_networks()
[/code]

This returns the list, simply learn how to parse strings (It's in the "scripting basics" part of the manual) then you can modify the script to do that. Share your modification for others. :)
KenDoll 6 Feb 2021 @ 6:32am 
Just an edit to my other comment, had time real quick to load up a SP world and pasted this all in and works wonderfully :D, only thing that would make it better is, instead of having to type/copy the info for the essid/bssid, is somehow make it go to a list and you just select the # to hack... (i know this is a basic probably barebones script but come on xD)