Merge pull request #844 from kost/fixemptybomutils

Fix empty bomutils folder
readme-wiki
Chris Ross 2017-12-03 01:21:34 -05:00 committed by GitHub
commit 8ddeb63137
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 101 additions and 1 deletions

View File

@ -2839,6 +2839,24 @@ except Exception as e:
else: else:
print helpers.color("[!] Please provide a valid zipfile path", color="red") print helpers.color("[!] Please provide a valid zipfile path", color="red")
def do_shellb(self, line):
"""Execute a shell command as a background job"""
cmd = line.strip()
if self.mainMenu.modules.modules['python/management/osx/shellb']:
module = self.mainMenu.modules.modules['python/management/osx/shellb']
if line.strip() != '':
module.options['Command']['Value'] = line.strip()
module.options['Agent']['Value'] = self.mainMenu.agents.get_agent_name_db(self.sessionID)
module_menu = ModuleMenu(self.mainMenu, 'python/management/osx/shellb')
msg = "[*] Tasked agent to execute %s in the background" % (str(module.options['Path']['Value']))
print helpers.color(msg,color="green")
self.mainMenu.agents.save_agent_log(self.sessionID, msg)
module_menu.do_execute("")
else:
print helpers.color("[!] python/management/osx/shellb module not loaded")
def do_viewrepo(self, line): def do_viewrepo(self, line):
"View the contents of a repo. if none is specified, all files will be returned" "View the contents of a repo. if none is specified, all files will be returned"
repoName = line.strip() repoName = line.strip()

View File

@ -29,7 +29,7 @@ class Module:
'NeedsAdmin': False, 'NeedsAdmin': False,
# True if the method doesn't touch disk/is reasonably opsec safe # True if the method doesn't touch disk/is reasonably opsec safe
'OpsecSafe': False, 'OpsecSafe': True,
# the module language # the module language
'Language' : 'python', 'Language' : 'python',

View File

@ -0,0 +1,82 @@
import shlex
class Module:
def __init__(self, mainMenu, params=[]):
# metadata info about the module, not modified during runtime
self.info = {
# name for the module that will appear in module menus
'Name': 'shellb',
# list of one or more authors for the module
'Author': ['@xorrior'],
# more verbose multi-line description of the module
'Description': ('execute a shell command in the background'),
# True if the module needs to run in the background
'Background' : True,
# File extension to save the file as
'OutputExtension' : '',
# if the module needs administrative privileges
'NeedsAdmin' : False,
# True if the method doesn't touch disk/is reasonably opsec safe
'OpsecSafe' : False,
# the module language
'Language' : 'python',
# the minimum language version needed
'MinLanguageVersion' : '2.6',
# list of any references/other comments
'Comments': [ ]
}
# any options needed by the module, settable during runtime
self.options = {
# format:
# value_name : {description, required, default_value}
'Agent' : {
# The 'Agent' option is the only one that MUST be in a module
'Description' : 'Agent to execute module on.',
'Required' : True,
'Value' : ''
},
'Command' : {
# The 'Agent' option is the only one that MUST be in a module
'Description' : 'Command to execute.',
'Required' : True,
'Value' : ''
}
}
# save off a copy of the mainMenu object to access external functionality
# like listeners/agent handlers/etc.
self.mainMenu = mainMenu
# During instantiation, any settable option parameters
# are passed as an object set to the module and the
# options dictionary is automatically set. This is mostly
# in case options are passed on the command line
if params:
for param in params:
# parameter format is [Name, Value]
option, value = param
if option in self.options:
self.options[option]['Value'] = value
def generate(self):
cmdstring = self.options['Command']['Value']
script = """
import shlex
arg = shlex.split("%s")
p = subprocess.Popen(arg, stdout=PIPE)
res = p.stdout.read()
print res
""" % (cmdstring)
return script

View File