Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove internet access check #1420

Merged
merged 5 commits into from
Aug 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a
Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]
### Removed
- Internet access check on agent start. #1402
- The "internal.monkey.internet_services" configuration option that enabled
internet access checks. #1402

### Fixed
- Misaligned buttons and input fields on exploiter and network configuration
Expand Down
1 change: 0 additions & 1 deletion envs/monkey_zoo/blackbox/config_templates/base_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@ class BaseTemplate(ConfigTemplate):
],
"monkey.post_breach.post_breach_actions": [],
"internal.general.keep_tunnel_open_time": 0,
"internal.monkey.internet_services": [],
}
3 changes: 0 additions & 3 deletions monkey/infection_monkey/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,6 @@ def as_dict(self):
# sets whether or not to retry failed hosts on next scan
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

# Monkey files directory name
Expand Down
8 changes: 2 additions & 6 deletions monkey/infection_monkey/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
SHORT_REQUEST_TIMEOUT,
)
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.tcp import TcpProxy

Expand All @@ -40,23 +40,19 @@ class ControlClient(object):
proxies = {}

@staticmethod
def wakeup(parent=None, has_internet_access=None):
def wakeup(parent=None):
if parent:
LOG.debug("parent: %s" % (parent,))

hostname = gethostname()
if not parent:
parent = GUID

if has_internet_access is None:
has_internet_access = check_internet_access(WormConfiguration.internet_services)

monkey = {
"guid": GUID,
"hostname": hostname,
"ip_addresses": local_ips(),
"description": " ".join(platform.uname()),
"internet_access": has_internet_access,
"config": WormConfiguration.as_dict(),
"parent": parent,
"launch_time": str(datetime.now().strftime(DEFAULT_TIME_FORMAT)),
Expand Down
4 changes: 0 additions & 4 deletions monkey/infection_monkey/example.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
"command_servers": [
"192.0.2.0:5000"
],
"internet_services": [
"monkey.guardicore.com",
"www.google.com"
],
"keep_tunnel_open_time": 60,
"subnet_scan_list": [

Expand Down
19 changes: 0 additions & 19 deletions monkey/infection_monkey/network/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

import netifaces
import psutil
import requests
from requests import ConnectionError

from common.network.network_range import CidrRange
from infection_monkey.utils.environment import is_windows_os
Expand Down Expand Up @@ -125,23 +123,6 @@ def get_free_tcp_port(min_range=1000, max_range=65535):
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():
"""
Returns a list of IPs accessible in the host in each network interface, in the subnet.
Expand Down
1 change: 0 additions & 1 deletion monkey/monkey_island/cc/models/monkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class Monkey(Document):
dead = BooleanField()
description = StringField()
hostname = StringField()
internet_access = BooleanField()
ip_addresses = ListField(StringField())
launch_time = StringField()
keepalive = DateTimeField()
Expand Down
10 changes: 0 additions & 10 deletions monkey/monkey_island/cc/services/config_schema/internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,6 @@
"monkey propagating to "
"a high number of machines",
},
"internet_services": {
"title": "Internet services",
"type": "array",
"uniqueItems": True,
"items": {"type": "string"},
"default": ["monkey.guardicore.com", "www.google.com"],
"description": "List of internet services to try and communicate with to "
"determine internet"
" connectivity (use either ip or domain)",
},
"self_delete_in_cleanup": {
"title": "Self delete on cleanup",
"type": "boolean",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@
"monkey": {
"victims_max_find": 100,
"victims_max_exploit": 100,
"internet_services": [
"monkey.guardicore.com",
"www.google.com"
],
"self_delete_in_cleanup": true,
"use_file_logging": true,
"serialize_config": false,
Expand Down