Files
baremetal-basics/nms
T
2026-11-09 22:21:23 +00:00

40 lines
1.3 KiB
Bash

#!/bin/bash
#for arg in "$@"; do
ts=$(date +%Y-%m-%d-%T)
hst=$1
#prt=$("-p $2")
a=$@
rm nms-"$hst".log
clear
echo "================================================================================" | tee nms-"$hst".log
echo "DATE: $ts" | tee -a nms-"$hst".log
echo "HOST: $hst" | tee -a nms-"$hst".log
echo "--------------------------------------------------------------------------------" | tee -a nms-"$hst".log
#read x
echo "Running Nmap scan on $hst..."
nmap -Anv --script vulners,http-sql-injection,http-unsafe-output-escaping,http-enum.nse "$a" | tee -a nms-"$hst".log
echo "--------------------------------------------------------------------------------"
echo " PRESS R FOR REPORT OR Q TO EXIT "
echo "================================================================================"
read -r -n 1 -s key
if [ "$key" = "R" ] || [ "$key" = "r" ]; then
echo "================================================================================"
echo " GENERATING REPORT FILE: nms-"$hst".pdf..."
echo "--------------------------------------------------------------------------------"
soffice --headless --convert-to pdf --outdir ./ nms-"$hst".log
rm nms-"$hst".log
open nms-"$hst".pdf
exit
else
if [ "$key" = "q" ] || [ "$key" = "Q" ]; then
rm nms-"$hst".log
exit
fi
fi
echo 'Done.'
#read -n1
#clear
rm nms-"$@".log
#done