Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #HwScript
- echo -e "Enter your target ip/url:"
- read ip
- echo -e "Enter your scan type: (SYN, CONNECT, ACK, UDP, FIN, XMAS)"
- read -r type
- case $type in
- SYN)
- type=sS
- ;;
- CONNECT)
- type=sT
- ;;
- ACK)
- type=sA
- ;;
- *)
- echo -e "Script does not support this type. Make sure to choose one of the six provided and type in all caps."
- exit 1
- esac
- echo -e "Would you like to output to a file or to the shell? (f/s)"
- read -r fs
- if [ $fs = f ]; then
- nmap -$type -v $ip >> /root/Desktop/output.txt
- echo -e "Generated file 'output.txt' on Desktop"
- if grep -q 'http' /root/Desktop/output.txt ; then
- echo -e "It appears your target is listening on port 80, would you like to try and grab the header? (y/n)"
- read new1
- if [ $new1 = y ]; then
- echo -e "Would you like to append this to your output file? (y/n)"
- read new2
- if [ $new2 = y ]; then
- nmap -sV --script=http-headers $ip >> /root/Desktop/output.txt
- else
- nmap -sV --script=http-headers $ip
- fi
- fi
- fi
- else
- echo -e "Outputting to shell"
- nmap -$type -v $ip | tee temp.txt
- fi
- if grep -q 'http' /root/temp.txt ; then
- echo -e "It appears your target is listening on port 80, would you like to try and grab the header? (y/n)"
- read new3
- if [ $new3 = y ]; then
- echo -e "Would you like to output to a file or to the shell? (y/n)"
- read new4
- if [ $new4 = y ]; then
- nmap -sV --script=http-headers $ip >> /root/Desktop/output.txt
- echo -e "Generated file 'output.txt on Desktop"
- rm -preserve-root temp.txt
- else
- nmap -sV --script=http-headers $ip
- rm --preserve-root temp.txt
- fi
- else rm --preserve-root temp.txt
- fi
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement