Create a gist now

Instantly share code, notes, and snippets.

@tunelko /penmap.sh
Last active Oct 19, 2017

What would you like to do?
#!/bin/sh
# -----------------------------------------------------------------------------
# Author: @tunelko
# Modifier: DiaLluvioso
# -----------------------------------------------------------------------------
# Useful for pentesting on information gathering phase.
# Displays fancy and formatted HTML report generated by xalan.
# note: it requires xalan (xml to html converter) but is installed if needed.
# -----------------------------------------------------------------------------
# * Change nmap arguments as needed !
# -----------------------------------------------------------------------------
set -e
doscan(){
if test $2 -eq 1; then
nmap -sS -sV -O -oX $1-output.xml $1
xalan -in $1-output.xml -out $1-output.html
echo "[*] Scan finished report saved in $(pwd)\n[*] Opening file"
xdg-open $1-output.html
rm $1-output.xml
elif test $2 -eq 2; then
echo "2"
nmap -p 1-65535 -T4 -A -ox $1-output.xml $1
xalan -in $1-output.xml -out $1-output.html
echo "[*] Scan finished report saved in $(pwd)\n[*] Opening file"
xdg-open $1-output.html
rm $1-output.xml
else
echo "[!] Argument <type> must be 1 or 2"
fi
}
if test -n "$(dpkg-query -W -f='${Status}' nmap 2>/dev/null| grep not-installed)"; then
apt-get install nmap
elif test -n "$(dpkg-query -W -f='${Status}' xalan 2>/dev/null| grep not-installed)"; then
apt-get install xalan
fi
if test $# -ne 2; then
echo "[!] Invalid arguments\nUsage: $0 <host> <type>\nExample: $0 127.0.0.1 1\nTypes:\n 1) Fast scan\n 2) Full scan"
else
doscan $1 $2
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment