forked from p15670423/monkey
Merge pull request #207 from VakarisZ/RDP_grinder_utf_fix
Fixes the problem of rdp grinder not being able to handle utf encoded credentials.
This commit is contained in:
commit
472518bacf
|
@ -15,6 +15,7 @@ from infection_monkey.exploit.tools import get_target_monkey
|
||||||
from infection_monkey.model import RDP_CMDLINE_HTTP_BITS, RDP_CMDLINE_HTTP_VBS
|
from infection_monkey.model import RDP_CMDLINE_HTTP_BITS, RDP_CMDLINE_HTTP_VBS
|
||||||
from infection_monkey.network.tools import check_tcp_port
|
from infection_monkey.network.tools import check_tcp_port
|
||||||
from infection_monkey.exploit.tools import build_monkey_commandline
|
from infection_monkey.exploit.tools import build_monkey_commandline
|
||||||
|
from infection_monkey.utils import utf_to_ascii
|
||||||
|
|
||||||
__author__ = 'hoffer'
|
__author__ = 'hoffer'
|
||||||
|
|
||||||
|
@ -298,6 +299,10 @@ class RdpExploiter(HostExploiter):
|
||||||
|
|
||||||
LOG.info("RDP connected to %r", self.host)
|
LOG.info("RDP connected to %r", self.host)
|
||||||
|
|
||||||
|
user = utf_to_ascii(user)
|
||||||
|
password = utf_to_ascii(password)
|
||||||
|
command = utf_to_ascii(command)
|
||||||
|
|
||||||
client_factory = CMDClientFactory(user, password, "", command)
|
client_factory = CMDClientFactory(user, password, "", command)
|
||||||
|
|
||||||
reactor.callFromThread(reactor.connectTCP, self.host.ip_addr, RDP_PORT, client_factory)
|
reactor.callFromThread(reactor.connectTCP, self.host.ip_addr, RDP_PORT, client_factory)
|
||||||
|
|
|
@ -30,3 +30,8 @@ def is_64bit_python():
|
||||||
def is_windows_os():
|
def is_windows_os():
|
||||||
return sys.platform.startswith("win")
|
return sys.platform.startswith("win")
|
||||||
|
|
||||||
|
|
||||||
|
def utf_to_ascii(string):
|
||||||
|
# Converts utf string to ascii. Safe to use even if string is already ascii.
|
||||||
|
udata = string.decode("utf-8")
|
||||||
|
return udata.encode("ascii", "ignore")
|
||||||
|
|
Loading…
Reference in New Issue