forked from p15670423/monkey
Agent: Remove disused MonkeyHTTPServer
This commit is contained in:
parent
732568b34f
commit
f3d4f972a0
|
@ -4,8 +4,6 @@ import urllib.parse
|
||||||
import urllib.request
|
import urllib.request
|
||||||
from threading import Lock
|
from threading import Lock
|
||||||
|
|
||||||
from infection_monkey.exploit.tools.helpers import try_get_target_monkey
|
|
||||||
from infection_monkey.model import DOWNLOAD_TIMEOUT
|
|
||||||
from infection_monkey.network.firewall import app as firewall
|
from infection_monkey.network.firewall import app as firewall
|
||||||
from infection_monkey.network.info import get_free_tcp_port
|
from infection_monkey.network.info import get_free_tcp_port
|
||||||
from infection_monkey.network.tools import get_interface_to_target
|
from infection_monkey.network.tools import get_interface_to_target
|
||||||
|
@ -62,24 +60,3 @@ class HTTPTools(object):
|
||||||
"http://%s:%s/%s" % (local_ip, local_port, urllib.parse.quote(host.os["type"])),
|
"http://%s:%s/%s" % (local_ip, local_port, urllib.parse.quote(host.os["type"])),
|
||||||
httpd,
|
httpd,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class MonkeyHTTPServer(HTTPTools):
|
|
||||||
def __init__(self, host):
|
|
||||||
super(MonkeyHTTPServer, self).__init__()
|
|
||||||
self.http_path = None
|
|
||||||
self.http_thread = None
|
|
||||||
self.host = host
|
|
||||||
|
|
||||||
def start(self):
|
|
||||||
# Get monkey exe for host and it's path
|
|
||||||
src_path = try_get_target_monkey(self.host)
|
|
||||||
self.http_path, self.http_thread = MonkeyHTTPServer.try_create_locked_transfer(
|
|
||||||
self.host, src_path
|
|
||||||
)
|
|
||||||
|
|
||||||
def stop(self):
|
|
||||||
if not self.http_path or not self.http_thread:
|
|
||||||
raise RuntimeError("Can't stop http server that wasn't started!")
|
|
||||||
self.http_thread.join(DOWNLOAD_TIMEOUT)
|
|
||||||
self.http_thread.stop()
|
|
||||||
|
|
Loading…
Reference in New Issue