Agent: Remove disused methods in WebRCE
This commit is contained in:
parent
7facf302a4
commit
77e0cae441
|
@ -5,7 +5,6 @@ from typing import List, Tuple
|
|||
|
||||
from common.utils.attack_utils import BITS_UPLOAD_STRING, ScanStatus
|
||||
from infection_monkey.exploit.HostExploiter import HostExploiter
|
||||
from infection_monkey.exploit.tools.helpers import get_target_monkey
|
||||
from infection_monkey.exploit.tools.http_tools import HTTPTools
|
||||
from infection_monkey.model import (
|
||||
BITSADMIN_CMDLINE_HTTP,
|
||||
|
@ -407,51 +406,6 @@ class WebRCE(HostExploiter):
|
|||
self.add_executed_cmd(command)
|
||||
return resp
|
||||
|
||||
def get_monkey_upload_path(self, url_to_monkey):
|
||||
"""
|
||||
Gets destination path from one of WEB_RCE predetermined paths(self.monkey_target_paths).
|
||||
:param url_to_monkey: Hosted monkey's url. egz :
|
||||
http://localserver:9999/monkey/windows-64.exe
|
||||
:return: Corresponding monkey path from self.monkey_target_paths
|
||||
"""
|
||||
if not url_to_monkey or ("linux" not in url_to_monkey and "windows" not in url_to_monkey):
|
||||
logger.error(
|
||||
"Can't get destination path because source path %s is invalid.", url_to_monkey
|
||||
)
|
||||
return False
|
||||
try:
|
||||
if "linux" in url_to_monkey:
|
||||
return self.monkey_target_paths["linux"]
|
||||
elif "windows" in url_to_monkey:
|
||||
return self.monkey_target_paths["win64"]
|
||||
else:
|
||||
logger.error(
|
||||
"Could not figure out what type of monkey server was trying to upload, "
|
||||
"thus destination path can not be chosen."
|
||||
)
|
||||
return False
|
||||
except KeyError:
|
||||
logger.error(
|
||||
'Unknown key was found. Please use "linux" and "win64" keys to '
|
||||
"initialize custom dict of monkey's destination paths"
|
||||
)
|
||||
return False
|
||||
|
||||
def get_monkey_paths(self):
|
||||
"""
|
||||
Gets local (used by server) and destination (where to download) paths.
|
||||
:return: dict of source and destination paths
|
||||
"""
|
||||
src_path = get_target_monkey(self.host)
|
||||
if not src_path:
|
||||
logger.info("Can't find suitable monkey executable for host %r", self.host)
|
||||
return False
|
||||
# Determine which destination path to use
|
||||
dest_path = self.get_monkey_upload_path(src_path)
|
||||
if not dest_path:
|
||||
return False
|
||||
return {"src_path": src_path, "dest_path": dest_path}
|
||||
|
||||
def get_default_dropper_path(self):
|
||||
"""
|
||||
Gets default dropper path for the host.
|
||||
|
|
Loading…
Reference in New Issue