Skip to content

Commit

Permalink
Added commandline Arguments to instantly generate a known payload
Browse files Browse the repository at this point in the history
  • Loading branch information
ThoughtfulDev committed Jul 8, 2017
1 parent 1ee01d4 commit eeae7cf
Showing 1 changed file with 54 additions and 1 deletion.
55 changes: 54 additions & 1 deletion PyDuck.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,54 @@ def main():
loadModules()
startShell()

def main_quick():
"Fast payload generation using command line arguments"
init(autoreset=True)
output.cls()
output.banner()
loadModules()
#
# format: ./PyDuck.py <module> <duck_drive> [list of attributes in format]
# format of attributes: attribute=value
#
global loadedModule
global moduleAttributes
modulename = sys.argv[1]
if modulename in modules:
if os.path.isfile('modules/' + modulename + '/module.json'):
with open('modules/' + modulename + '/module.json', 'r') as module:
module_content = module.read().replace('\n', '')
loadedModule = json.loads(module_content)

moduleAttributes = loadedModule['attributes']
# add default attributes: lang,drive
moduleAttributes['language'] = 'us'
moduleAttributes['sdcard_mount'] = sys.argv[2]
attr_args = []
if len(sys.argv) > 3:
for i in range(3, len(sys.argv)):
attr_args.append(sys.argv[i])
# check for uac bypass and add attribute
if loadedModule['requirements']['has_uac_bypass'].lower() == "true":
moduleAttributes['uac_bypass_key'] = 'y'


for a in attr_args:
sep = a.split('=')
if sep[0] in moduleAttributes:
output.success("Setting " + sep[0] + " to " + sep[1])
moduleAttributes[sep[0]] = sep[1]
else:
output.error("Attribute " + sep[0] + " not found..exiting")
sys.exit(1)

cmdUseGenerate(modulename)

else:
output.error("Module '" + modulename + "' does not exist")
else:
output.error("Module '" + modulename + "' does not exist")

def loadModules():
output.info("Loading Modules...")
global modules
Expand Down Expand Up @@ -306,4 +354,9 @@ def cmdUseGenerate(modulename):

#Main entry point
if __name__ == "__main__":
main()
if len(sys.argv) == 1:
main()
elif len(sys.argv) >= 3:
main_quick()
else:
print('usage: python PyDuck.py [ <module> <ducky_mount> [list of module attributes in format: attr=value] ]')

0 comments on commit eeae7cf

Please sign in to comment.