forked from p15670423/monkey
Outdated sort, byte/string mixups fixed
This commit is contained in:
parent
ea40620373
commit
c40ec2adaf
|
@ -287,7 +287,7 @@ class Configuration(object):
|
||||||
:param sensitive_data: the data to hash.
|
:param sensitive_data: the data to hash.
|
||||||
:return: the hashed data.
|
:return: the hashed data.
|
||||||
"""
|
"""
|
||||||
password_hashed = hashlib.sha512(sensitive_data).hexdigest()
|
password_hashed = hashlib.sha512(sensitive_data.encode()).hexdigest()
|
||||||
return password_hashed
|
return password_hashed
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -71,9 +71,9 @@ class VSFTPDExploiter(HostExploiter):
|
||||||
if self.socket_connect(ftp_socket, self.host.ip_addr, FTP_PORT):
|
if self.socket_connect(ftp_socket, self.host.ip_addr, FTP_PORT):
|
||||||
ftp_socket.recv(RECV_128).decode('utf-8')
|
ftp_socket.recv(RECV_128).decode('utf-8')
|
||||||
|
|
||||||
if self.socket_send_recv(ftp_socket, USERNAME + '\n'):
|
if self.socket_send_recv(ftp_socket, USERNAME + b'\n'):
|
||||||
time.sleep(FTP_TIME_BUFFER)
|
time.sleep(FTP_TIME_BUFFER)
|
||||||
self.socket_send(ftp_socket, PASSWORD + '\n')
|
self.socket_send(ftp_socket, PASSWORD + b'\n')
|
||||||
ftp_socket.close()
|
ftp_socket.close()
|
||||||
LOG.info('Backdoor Enabled, Now we can run commands')
|
LOG.info('Backdoor Enabled, Now we can run commands')
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -55,7 +55,8 @@ class PingScanner(HostScanner, HostFinger):
|
||||||
PING_TIMEOUT_FLAG,
|
PING_TIMEOUT_FLAG,
|
||||||
str(timeout), host.ip_addr],
|
str(timeout), host.ip_addr],
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE)
|
stderr=subprocess.PIPE,
|
||||||
|
text=True)
|
||||||
|
|
||||||
output = " ".join(sub_proc.communicate())
|
output = " ".join(sub_proc.communicate())
|
||||||
regex_result = self._ttl_regex.search(output)
|
regex_result = self._ttl_regex.search(output)
|
||||||
|
|
|
@ -52,7 +52,7 @@ class NodeService:
|
||||||
exploit["origin"] = NodeService.get_monkey_label(NodeService.get_monkey_by_id(edge["from"]))
|
exploit["origin"] = NodeService.get_monkey_label(NodeService.get_monkey_by_id(edge["from"]))
|
||||||
exploits.append(exploit)
|
exploits.append(exploit)
|
||||||
|
|
||||||
exploits.sort(key=NodeService._cmp_exploits_by_timestamp)
|
exploits = sorted(exploits, key=lambda exploit: exploit['timestamp'])
|
||||||
|
|
||||||
new_node["exploits"] = exploits
|
new_node["exploits"] = exploits
|
||||||
new_node["accessible_from_nodes"] = accessible_from_nodes
|
new_node["accessible_from_nodes"] = accessible_from_nodes
|
||||||
|
@ -71,14 +71,6 @@ class NodeService:
|
||||||
domain_name = " (" + node["domain_name"] + ")"
|
domain_name = " (" + node["domain_name"] + ")"
|
||||||
return node["os"]["version"] + " : " + node["ip_addresses"][0] + domain_name
|
return node["os"]["version"] + " : " + node["ip_addresses"][0] + domain_name
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def _cmp_exploits_by_timestamp(exploit_1, exploit_2):
|
|
||||||
if exploit_1["timestamp"] == exploit_2["timestamp"]:
|
|
||||||
return 0
|
|
||||||
if exploit_1["timestamp"] > exploit_2["timestamp"]:
|
|
||||||
return 1
|
|
||||||
return -1
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_monkey_os(monkey):
|
def get_monkey_os(monkey):
|
||||||
os = "unknown"
|
os = "unknown"
|
||||||
|
|
Loading…
Reference in New Issue