From d75299be255c6fbc62bdb3f414ead3d9896dd1ba Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Thu, 12 Mar 2020 15:56:06 +0200 Subject: [PATCH] Removed unnecessary comments, unused file, improved parsing of linux requests --- envs/monkey_zoo/docs/fullDocs.md | 36 +++++++++++ monkey/infection_monkey/monkey.py | 4 -- monkey/infection_monkey/transport/http.py | 5 +- monkey/infection_monkey/tunnel.py | 5 +- .../monkey_island/cc/resources/bootloader.py | 4 +- .../map/preview-pane/PthPreviewPane.js | 59 ------------------- 6 files changed, 41 insertions(+), 72 deletions(-) delete mode 100644 monkey/monkey_island/cc/ui/src/components/map/preview-pane/PthPreviewPane.js diff --git a/envs/monkey_zoo/docs/fullDocs.md b/envs/monkey_zoo/docs/fullDocs.md index a8c0687fc..1605a4792 100644 --- a/envs/monkey_zoo/docs/fullDocs.md +++ b/envs/monkey_zoo/docs/fullDocs.md @@ -546,6 +546,42 @@ fullTest.conf is a good config to start, because it covers all machines. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Nr. 12 Tunneling M4

+

(10.2.0.12)

(Exploitable)
OS:Windows server 2019 x64
Software:OpenSSL
Default service’s port:445
Root password::t67TC5ZD+mz
Server’s config:Default
Notes:Accessible only trough Nr.10
+ diff --git a/monkey/infection_monkey/monkey.py b/monkey/infection_monkey/monkey.py index 2e6470cc0..80d2d8642 100644 --- a/monkey/infection_monkey/monkey.py +++ b/monkey/infection_monkey/monkey.py @@ -216,10 +216,6 @@ class InfectionMonkey(object): # if host was exploited, before continue to closing the tunnel ensure the exploited host had its chance to # connect to the tunnel - - #TODO change back - time.sleep(WormConfiguration.keep_tunnel_open_time) - if len(self._exploited_machines) > 0: time_to_sleep = WormConfiguration.keep_tunnel_open_time LOG.info("Sleeping %d seconds for exploited machines to connect to tunnel", time_to_sleep) diff --git a/monkey/infection_monkey/transport/http.py b/monkey/infection_monkey/transport/http.py index efb39a71c..80a977561 100644 --- a/monkey/infection_monkey/transport/http.py +++ b/monkey/infection_monkey/transport/http.py @@ -110,11 +110,10 @@ class FileServHTTPRequestHandler(http.server.BaseHTTPRequestHandler): class HTTPConnectProxyHandler(http.server.BaseHTTPRequestHandler): timeout = 30 # timeout with clients, set to None not to make persistent connection proxy_via = None # pseudonym of the proxy in Via header, set to None not to modify original Via header - #protocol_version = "HTTP/1.1" def do_POST(self): - content_length = int(self.headers['Content-Length']) # <--- Gets the size of data - post_data = self.rfile.read(content_length).decode() # <--- Gets the data itself + content_length = int(self.headers['Content-Length']) + post_data = self.rfile.read(content_length).decode() try: r = requests.post(url=self.path, data=post_data) except requests.exceptions.ConnectionError as e: diff --git a/monkey/infection_monkey/tunnel.py b/monkey/infection_monkey/tunnel.py index 3a7d23256..3544f46f3 100644 --- a/monkey/infection_monkey/tunnel.py +++ b/monkey/infection_monkey/tunnel.py @@ -126,10 +126,7 @@ class MonkeyTunnel(Thread): def run(self): self._broad_sock = _set_multicast_socket(self._timeout) self.l_ips = local_ips() - - #TODO change back - self.local_port = 5002 - #self.local_port = get_free_tcp_port() + self.local_port = get_free_tcp_port() if not self.local_port: return diff --git a/monkey/monkey_island/cc/resources/bootloader.py b/monkey/monkey_island/cc/resources/bootloader.py index ce70c20f6..29260b911 100644 --- a/monkey/monkey_island/cc/resources/bootloader.py +++ b/monkey/monkey_island/cc/resources/bootloader.py @@ -27,9 +27,9 @@ class Bootloader(flask_restful.Resource): @staticmethod def get_request_contents_linux(request_data: bytes) -> Dict[str, str]: - parsed_data = json.loads(request_data.decode().replace("\n", "") + parsed_data = json.loads(request_data.decode().replace("\"\n", "") + .replace("\n", "") .replace("NAME=\"", "") - .replace("\"\"", "\"") .replace("\":\",", "\":\"\",")) return parsed_data diff --git a/monkey/monkey_island/cc/ui/src/components/map/preview-pane/PthPreviewPane.js b/monkey/monkey_island/cc/ui/src/components/map/preview-pane/PthPreviewPane.js deleted file mode 100644 index a5ffa3020..000000000 --- a/monkey/monkey_island/cc/ui/src/components/map/preview-pane/PthPreviewPane.js +++ /dev/null @@ -1,59 +0,0 @@ -import React from 'react'; -import PreviewPaneComponent from 'components/map/preview-pane/PreviewPane'; - -class PthPreviewPaneComponent extends PreviewPaneComponent { - nodeInfo(asset) { - return ( -
-
- - - - - - - - - - - - - - - - - - -
Hostname{asset.hostname}
IP Addresses{asset.ips.map(val =>
{val}
)}
Services{asset.services.map(val =>
{val}
)}
Compromised Users{asset.users.map(val =>
{val}
)}
- - ); - } - - edgeInfo(edge) { - return ( -
- - - - - - - -
Compromised Users{edge.users.map(val =>
{val}
)}
-
- ); - } - - getInfoByProps() { - switch (this.props.type) { - case 'edge': - return this.edgeInfo(this.props.item); - case 'node': - return this.nodeInfo(this.props.item); - } - - return null; - } -} - -export default PthPreviewPaneComponent;