forked from p34709852/monkey
Agent: Remove monkeyfs references in smb_tools.py
This commit is contained in:
parent
f57977dd53
commit
77f58b942b
|
@ -1,6 +1,7 @@
|
|||
import logging
|
||||
import ntpath
|
||||
import pprint
|
||||
from io import BytesIO
|
||||
|
||||
from impacket.dcerpc.v5 import srvs, transport
|
||||
from impacket.smb3structs import SMB2_DIALECT_002, SMB2_DIALECT_21
|
||||
|
@ -17,11 +18,16 @@ logger = logging.getLogger(__name__)
|
|||
class SmbTools(object):
|
||||
@staticmethod
|
||||
def copy_file(
|
||||
host, src_path, dst_path, username, password, lm_hash="", ntlm_hash="", timeout=60
|
||||
host,
|
||||
agent_file: BytesIO,
|
||||
dst_path,
|
||||
username,
|
||||
password,
|
||||
lm_hash="",
|
||||
ntlm_hash="",
|
||||
timeout=60,
|
||||
):
|
||||
# TODO assess the 60 second timeout
|
||||
# monkeyfs has been removed. Fix this in issue #1741
|
||||
# assert monkeyfs.isfile(src_path), "Source file to copy (%s) is missing" % (src_path,)
|
||||
|
||||
smb, dialect = SmbTools.new_smb_connection(
|
||||
host, username, password, lm_hash, ntlm_hash, timeout
|
||||
|
@ -139,21 +145,15 @@ class SmbTools(object):
|
|||
remote_full_path = ntpath.join(share_path, remote_path.strip(ntpath.sep))
|
||||
|
||||
try:
|
||||
# monkeyfs has been removed. Fix this in issue #1741
|
||||
"""
|
||||
with monkeyfs.open(src_path, "rb") as source_file:
|
||||
# make sure of the timeout
|
||||
smb.setTimeout(timeout)
|
||||
smb.putFile(share_name, remote_path, source_file.read)
|
||||
"""
|
||||
smb.setTimeout(timeout)
|
||||
smb.putFile(share_name, remote_path, agent_file.read)
|
||||
|
||||
file_uploaded = True
|
||||
T1105Telem(
|
||||
ScanStatus.USED, get_interface_to_target(host.ip_addr), host.ip_addr, dst_path
|
||||
).send()
|
||||
logger.info(
|
||||
"Copied monkey file '%s' to remote share '%s' [%s] on victim %r",
|
||||
src_path,
|
||||
"Copied monkey agent to remote share '%s' [%s] on victim %r",
|
||||
share_name,
|
||||
share_path,
|
||||
host,
|
||||
|
|
Loading…
Reference in New Issue