forked from p15670423/monkey
parent
8e9f5647f6
commit
189e1338ba
|
@ -145,9 +145,6 @@ class Configuration(object):
|
||||||
# sets whether or not to retry failed hosts on next scan
|
# sets whether or not to retry failed hosts on next scan
|
||||||
retry_failed_explotation = True
|
retry_failed_explotation = True
|
||||||
|
|
||||||
# addresses of internet servers to ping and check if the monkey has internet acccess.
|
|
||||||
internet_services = ["updates.infectionmonkey.com", "www.google.com"]
|
|
||||||
|
|
||||||
keep_tunnel_open_time = 60
|
keep_tunnel_open_time = 60
|
||||||
|
|
||||||
# Monkey files directory name
|
# Monkey files directory name
|
||||||
|
|
|
@ -19,7 +19,7 @@ from common.common_consts.timeouts import (
|
||||||
SHORT_REQUEST_TIMEOUT,
|
SHORT_REQUEST_TIMEOUT,
|
||||||
)
|
)
|
||||||
from infection_monkey.config import GUID, WormConfiguration
|
from infection_monkey.config import GUID, WormConfiguration
|
||||||
from infection_monkey.network.info import check_internet_access, local_ips
|
from infection_monkey.network.info import local_ips
|
||||||
from infection_monkey.transport.http import HTTPConnectProxy
|
from infection_monkey.transport.http import HTTPConnectProxy
|
||||||
from infection_monkey.transport.tcp import TcpProxy
|
from infection_monkey.transport.tcp import TcpProxy
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ class ControlClient(object):
|
||||||
proxies = {}
|
proxies = {}
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def wakeup(parent=None, has_internet_access=None):
|
def wakeup(parent=None):
|
||||||
if parent:
|
if parent:
|
||||||
LOG.debug("parent: %s" % (parent,))
|
LOG.debug("parent: %s" % (parent,))
|
||||||
|
|
||||||
|
@ -48,15 +48,11 @@ class ControlClient(object):
|
||||||
if not parent:
|
if not parent:
|
||||||
parent = GUID
|
parent = GUID
|
||||||
|
|
||||||
if has_internet_access is None:
|
|
||||||
has_internet_access = check_internet_access(WormConfiguration.internet_services)
|
|
||||||
|
|
||||||
monkey = {
|
monkey = {
|
||||||
"guid": GUID,
|
"guid": GUID,
|
||||||
"hostname": hostname,
|
"hostname": hostname,
|
||||||
"ip_addresses": local_ips(),
|
"ip_addresses": local_ips(),
|
||||||
"description": " ".join(platform.uname()),
|
"description": " ".join(platform.uname()),
|
||||||
"internet_access": has_internet_access,
|
|
||||||
"config": WormConfiguration.as_dict(),
|
"config": WormConfiguration.as_dict(),
|
||||||
"parent": parent,
|
"parent": parent,
|
||||||
"launch_time": str(datetime.now().strftime(DEFAULT_TIME_FORMAT)),
|
"launch_time": str(datetime.now().strftime(DEFAULT_TIME_FORMAT)),
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
"command_servers": [
|
"command_servers": [
|
||||||
"192.0.2.0:5000"
|
"192.0.2.0:5000"
|
||||||
],
|
],
|
||||||
"internet_services": [
|
|
||||||
"monkey.guardicore.com",
|
|
||||||
"www.google.com"
|
|
||||||
],
|
|
||||||
"keep_tunnel_open_time": 60,
|
"keep_tunnel_open_time": 60,
|
||||||
"subnet_scan_list": [
|
"subnet_scan_list": [
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,6 @@ from random import randint # noqa: DUO102
|
||||||
|
|
||||||
import netifaces
|
import netifaces
|
||||||
import psutil
|
import psutil
|
||||||
import requests
|
|
||||||
from requests import ConnectionError
|
|
||||||
|
|
||||||
from common.network.network_range import CidrRange
|
from common.network.network_range import CidrRange
|
||||||
from infection_monkey.utils.environment import is_windows_os
|
from infection_monkey.utils.environment import is_windows_os
|
||||||
|
@ -125,23 +123,6 @@ def get_free_tcp_port(min_range=1000, max_range=65535):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def check_internet_access(services):
|
|
||||||
"""
|
|
||||||
Checks if any of the services are accessible, over HTTPS
|
|
||||||
:param services: List of IPs/hostnames
|
|
||||||
:return: boolean depending on internet access
|
|
||||||
"""
|
|
||||||
for host in services:
|
|
||||||
try:
|
|
||||||
requests.get("https://%s" % (host,), timeout=TIMEOUT, verify=False) # noqa: DUO123
|
|
||||||
return True
|
|
||||||
except ConnectionError:
|
|
||||||
# Failed connecting
|
|
||||||
pass
|
|
||||||
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def get_interfaces_ranges():
|
def get_interfaces_ranges():
|
||||||
"""
|
"""
|
||||||
Returns a list of IPs accessible in the host in each network interface, in the subnet.
|
Returns a list of IPs accessible in the host in each network interface, in the subnet.
|
||||||
|
|
Loading…
Reference in New Issue