script to automate launch of msfconsole and db_autopwn
Hi to all, i'm creating a simple script to automate the launch of msfconsole and a session of db_autopwn but when it execute ./msfconsole the scipt stops with msf> promt... what can i do to send commands to msf> ?
Code:
#!/bin/sh
/bin/su - postgres -c "pg_ctl -D ~/metasploitdb start"
sleep 3
cd /pentest/exploits/framework3
./msfconsole
db_connect postgres@127.0.0.1/postgres
db_nmap .......
...............
...
Re: script to automate launch of msfconsole and db_autopwn
use ./msfconsole -r resourcefile.rc
and in your resource file you put in your metasploit commands
Riferimento: Re: script to automate launch of msfconsole and db_autopwn
./msfconsole -r /usr/share/autoexploit/autopwnrc.rc
Thnaks!!
Other problem: in the script i ask to insert target's ip:
Code:
/bin/su - postgres -c "pg_ctl -D ~/metasploitdb start"
sleep 3
cd /pentest/exploits/framework3
echo -n "Inserisci l'IP del target: "
read -e IP
./msfconsole -r /usr/share/autoexploit/autopwnrc.rc
but in autopwnrc.rc when i set db_nmap $IP cant be read, is there any other command or way to do this?
Re: script to automate launch of msfconsole and db_autopwn
maybe try
Code:
/bin/su - postgres -c "pg_ctl -D ~/metasploitdb start"
sleep 3
cd /pentest/exploits/framework3
echo -n "Inserisci l'IP del target: "
read -e IP
echo $IP > /root/ip-targets.txt
./msfconsole -r /usr/share/autoexploit/autopwnrc.rc
and in your resource file
Code:
db_nmap -iL /root/ip-targets.txt