Results 1 to 4 of 4

Thread: script to automate launch of msfconsole and db_autopwn

  1. #1
    Junior Member
    Join Date
    Dec 2008
    Posts
    41

    Default 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 .......
    ...............
    ...

  2. #2
    Senior Member iproute's Avatar
    Join Date
    Jan 2010
    Location
    Midwest, USA
    Posts
    192

    Default 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

  3. #3
    Junior Member
    Join Date
    Dec 2008
    Posts
    41

    Default 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?
    Last edited by HaVaNa7; 03-16-2011 at 12:04 PM.

  4. #4
    Senior Member iproute's Avatar
    Join Date
    Jan 2010
    Location
    Midwest, USA
    Posts
    192

    Default 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

Similar Threads

  1. Bash Script to automate WEP cracking
    By Hobo4ssassin in forum Experts Forum
    Replies: 8
    Last Post: 03-27-2011, 09:25 PM
  2. No Sessions Created msfconsole db_autopwn
    By AlexDaGr8est in forum Beginners Forum
    Replies: 2
    Last Post: 01-03-2011, 11:27 AM
  3. Replies: 10
    Last Post: 07-12-2010, 03:04 PM
  4. Help - Cant automate ARP
    By netnoob in forum OLD Newbie Area
    Replies: 3
    Last Post: 04-18-2008, 10:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •