Skip to content

Instantly share code, notes, and snippets.

@tunelko
Last active May 23, 2020 16:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tunelko/da2d3646e9a417142d83e2b7004b22e6 to your computer and use it in GitHub Desktop.
Save tunelko/da2d3646e9a417142d83e2b7004b22e6 to your computer and use it in GitHub Desktop.
#!/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