Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #----------------------------------------------------------
- # RED TEAM OPERATIONS (netool t00lkit - msfdb.db)
- # use metasploit database to store scans made by nmap
- # to be used later in netool toolkit by red team members.
- # ---------------------------------------------------------
- # WARNING: THIS SCRIPT WILL NOT WORK OUTSIDE NETOOL T00LKIT
- # ---------------------------------------------------------
- PLANNING:
- When you are working with other team members, with various individuals scanning at different times
- and from different locations, it helps to know how to import a basic nmap generated XML export file
- into the metasploit db Framework.
- First, we scan the Windows machine using the -oX option to generate a Target.xml file.
- -------------------------------------------
- nmap -sS -Pn -oX $H0m3/opensource/logs/intrusive.log $target
- -------------------------------------------
- After generating the XML file, we use the db_import command to import it into our database.
- We can then verify that the import worked by using the “hosts” command, which lists the
- systems entries that have been created, as shown here:
- -------------------------------------------
- msf> db_status
- msf> db_import Subnet1.xml
- msf> hosts
- -------------------------------------------
- # ---------------------------------
- # to be inserted into netool.sh
- # ---------------------------------
- #!/bin/sh
- # -----------------------------------
- # search for specific port open in the external network
- # -----------------------------------
- sh_extlan () {
- Colors;
- echo ${YellowF}'-|' This module searches For random targets with a ${Reset};
- echo ${YellowF}'-|' Specified open port In external network '(WAN)' ${Reset};
- echo ${YellowF}'-|' We can scan ports with this module In 2 ways ${Reset};
- echo ${YellowF}'-|' [${GreenF} 80,135,445 ${YellowF}] OR [${GreenF} 1-1000 ${YellowF}] ${Reset};
- # chose to run or to leave to main menu
- read -p "[+]::{run|quit}(choise):" pass
- if test "$pass" = "run"
- then
- Colors;
- NUM=$(zenity --scale --title "SCAN WAN NETWORK" --text "Nº LIMIT OF HOSTS TO FOUND" --min-value=1 --max-value=1027 --value=1 --step 1) > /dev/null 2>&1
- PORT=$(zenity --title="PORTS TO SEARCH" --text " example: 21,139,445" --width 300 --entry) > /dev/null 2>&1
- output=$(zenity --list --title "LOGFILE OUTPUT FORMAT" --text "log => port scan to toolkit database\nxml => port scan to msf database" --radiolist --column "Pick" --column "Option" TRUE "output in log (t00lkit db)" FALSE "Output in xml (msf db)" --width 330 --height 180) > /dev/null 2>&1
- sh_cshh
- else
- Colors;
- echo ${RedF}[x]::[ QUITTING ] ${Reset};
- sleep 2
- clear
- sh_2menu
- fi
- }
- sh_cshh () {
- Colors;
- if [ "$output" = "output in log (t00lkit db)" ]; then
- echo ${BlueF}[*]${RedF}::${BlueF}[Please wait]${RedF}::${GreenF}[ RUNING SCANS ] ${Reset};
- nmap -e $inter -iR $NUM -sS -Pn -p $PORT --open -oN ~/opensource/logs/Random-Hosts.log | zenity --progress --pulsate --title "SCANING WAN NETWORK" --text="LOGFILE: Random-Hosts.log\nHOSTS: $NUM ONLY: open PORTS: $PORT" --percentage=0 --auto-close > /dev/null 2>&1
- cat ~/opensource/logs/Random-Hosts.log | zenity --title "SCAN WAN NETWORK REPORT" --text-info --width 730 --height 500 > /dev/null 2>&1
- chown $usera ~/opensource/logs/Random-Hosts.log > /dev/null 2>&1
- sleep 1
- sh_hdtt3
- else
- Colors;
- echo ${BlueF}[*]${RedF}::${BlueF}[Please wait]${RedF}::${GreenF}[ RUNING SCANS ] ${Reset};
- echo "" > ~/opensource/logs/Random-Hosts.xml
- nmap -e $inter -iR $NUM -sS -Pn -p $PORT --open -oX ~/opensource/logs/Random-Hosts.xml $ipscan | zenity --progress --pulsate --title "SCANING WAN NETWORK" --text="LOGFILE: Random-Hosts.xml\nHOSTS: $NUM ONLY: open PORTS: $PORT" --percentage=0 --auto-close > /dev/null 2>&1
- chown $usera ~/opensource/logs/Random-Hosts.xml > /dev/null 2>&1
- sh_fff
- fi
- }
- sh_hdtt3 () {
- Colors;
- # store scans in database?
- dbt=$(zenity --list --title "T00LKIT DATABASE" --text "Store scan on t00lkit database?" --radiolist --column "Pick" --column "Option" TRUE "Append scan to DataBase" FALSE "Clear Database and Append scan" FALSE "Clear Database and manually input" --width 330 --height 180) > /dev/null 2>&1
- if [ "$dbt" = "Append scan to DataBase" ]; then
- dtr=`date`
- fill=`cat $H0m3/opensource/logs/Random-Hosts.log`
- echo "" >> $H0m3/opensource/modules/database.db
- echo "" >> $H0m3/opensource/modules/database.db
- echo "|[ $dtr ]|" >> $H0m3/opensource/modules/database.db
- echo "$fill" >> $H0m3/opensource/modules/database.db
- zenity --info --title="T00LKIT DATABASE" --text "Scan Appended to DataBase" --width 300 > /dev/null 2>&1
- chown $usera $H0m3/opensource/modules/database.db > /dev/null 2>&1
- cd ~/opensource
- sh_2menu
- elif [ "$dbt" = "Clear Database and Append scan" ]; then
- dtr=`date`
- fill=`cat $H0m3/opensource/logs/Random-Hosts.log`
- echo "" > $H0m3/opensource/modules/database.db
- echo "|[ $dtr ]|" >> $H0m3/opensource/modules/database.db
- echo "$fill" >> $H0m3/opensource/modules/database.db
- zenity --info --title="T00LKIT DATABASE" --text "Database clean and\nnew scan Appended" --width 300 > /dev/null 2>&1
- chown $usera $H0m3/opensource/modules/database.db > /dev/null 2>&1
- cd ~/opensource
- sh_2menu
- elif [ "$dbt" = "Clear Database and manually input" ]; then
- dtr=`date`
- mad=$(zenity --title="INPUT TARGET TO DATABASE" --text "You can input TARGET-IP, NOTES , ETC..." --entry --width 300) > /dev/null 2>&1
- echo "" > $H0m3/opensource/modules/database.db
- echo "|[ $dtr ]|" >> $H0m3/opensource/modules/database.db
- echo "$mad" >> $H0m3/opensource/modules/database.db
- zenity --info --title="T00LKIT DATABASE" --text "Database clean with\nnew Append" --width 300 > /dev/null 2>&1
- chown $usera $H0m3/opensource/modules/database.db > /dev/null 2>&1
- cd ~/opensource
- sh_2menu
- else
- Colors;
- echo ${RedF}[x]::[ QUITTING ]${Reset};
- sleep 2
- cd ~/opensource
- sh_2menu
- fi
- }
- sh_fff () {
- Colors;
- echo ${BlueF}[*]${RedF}::${BlueF}[Please wait]${RedF}::${GreenF}[ BUILDING RC FILE ] ${Reset};
- # generate resource file
- echo "db_import $H0m3/opensource/logs/Random-Hosts.xml" > $H0m3/opensource/logs/msfdb.rc
- echo "hosts" >> $H0m3/opensource/logs/msfdb.rc
- chown $usera $H0m3/opensource/logs/msfdb.rc > /dev/null 2>&1
- sleep 2
- echo ${BlueF}[*]${RedF}::${BlueF}[Please wait]${RedF}::${GreenF}[ START MSF SERVICES ] ${Reset};
- # start postgresql+metasploit db
- # /etc/init.d/postgresql start > /dev/null 2>&1
- # /etc/init.d/metasploit start > /dev/null 2>&1
- service metasploit start > /dev/null 2>&1
- echo ${BlueF}[*]${RedF}::${BlueF}[Please wait]${RedF}::${GreenF}[ START METASPLOIT ] ${Reset};
- # access msfdatabase
- xterm -T "METASPLOIT" -geometry 110x23 -e "sudo msfconsole -r $H0m3/opensource/logs/msfdb.rc"
- sleep 2
- clear
- # clear recent files made
- echo ${BlueF}[*]${RedF}::${BlueF}[Please wait]${RedF}::${GreenF}[ CLEANING FILES ] ${Reset};
- rm $H0m3/opensource/logs/msfdb.rc > /dev/null 2>&1
- rm $H0m3/opensource/logs/Random-Hosts.xml > /dev/null 2>&1
- rm $H0m3/opensource/logs/report.log > /dev/null 2>&1
- service metasploit stop > /dev/null 2>&1
- cd ~/opensource
- sh_2menu
- }
- #EOF
Advertisement
Add Comment
Please, Sign In to add comment