forked from p34709852/monkey
Added internet access check
Shown in the monkey properties in the island
This commit is contained in:
parent
d437015e1b
commit
84496dd3f5
|
@ -137,6 +137,8 @@ class Configuration(object):
|
|||
|
||||
retry_failed_explotation = True
|
||||
|
||||
internet_services = ["www.guardicore.com", "www.google.com"]
|
||||
|
||||
###########################
|
||||
# scanners config
|
||||
###########################
|
||||
|
|
|
@ -3,7 +3,7 @@ import logging
|
|||
import requests
|
||||
import platform
|
||||
import monkeyfs
|
||||
from network.info import local_ips
|
||||
from network.info import local_ips, check_internet_access
|
||||
from socket import gethostname
|
||||
from config import WormConfiguration, GUID
|
||||
from transport.tcp import TcpProxy
|
||||
|
@ -38,6 +38,7 @@ class ControlClient(object):
|
|||
'hostname': hostname,
|
||||
'ip_addresses': local_ips(),
|
||||
'description': " ".join(platform.uname()),
|
||||
'internet_access': check_internet_access(WormConfiguration.internet_services),
|
||||
'config': WormConfiguration.as_dict(),
|
||||
'parent': parent}
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import os
|
||||
import sys
|
||||
import socket
|
||||
import struct
|
||||
|
@ -58,3 +59,10 @@ def get_free_tcp_port(min_range=1000, max_range=65535):
|
|||
return port
|
||||
|
||||
return None
|
||||
|
||||
def check_internet_access(services):
|
||||
ping_str = "-n 1" if sys.platform.startswith("win") else "-c 1"
|
||||
for host in services:
|
||||
if os.system("ping " + ping_str + " " + host) == 0:
|
||||
return True
|
||||
return False
|
||||
|
|
|
@ -269,6 +269,7 @@ function buildMonkeyDescription(monkey) {
|
|||
var html =
|
||||
"<label>Name:</label> " + monkey.hostname + "</br>" +
|
||||
"<label>Description:</label> " + monkey.description + "</br>" +
|
||||
"<label>Internet Access:</label> " + monkey.internet_access + "</br>" +
|
||||
"<label>IP Address:</label></br>"
|
||||
|
||||
for (var i = 0; i < monkey.ip_addresses.length; i++) {
|
||||
|
|
Loading…
Reference in New Issue