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
|
retry_failed_explotation = True
|
||||||
|
|
||||||
|
internet_services = ["www.guardicore.com", "www.google.com"]
|
||||||
|
|
||||||
###########################
|
###########################
|
||||||
# scanners config
|
# scanners config
|
||||||
###########################
|
###########################
|
||||||
|
|
|
@ -3,7 +3,7 @@ import logging
|
||||||
import requests
|
import requests
|
||||||
import platform
|
import platform
|
||||||
import monkeyfs
|
import monkeyfs
|
||||||
from network.info import local_ips
|
from network.info import local_ips, check_internet_access
|
||||||
from socket import gethostname
|
from socket import gethostname
|
||||||
from config import WormConfiguration, GUID
|
from config import WormConfiguration, GUID
|
||||||
from transport.tcp import TcpProxy
|
from transport.tcp import TcpProxy
|
||||||
|
@ -38,6 +38,7 @@ class ControlClient(object):
|
||||||
'hostname': hostname,
|
'hostname': hostname,
|
||||||
'ip_addresses': local_ips(),
|
'ip_addresses': local_ips(),
|
||||||
'description': " ".join(platform.uname()),
|
'description': " ".join(platform.uname()),
|
||||||
|
'internet_access': check_internet_access(WormConfiguration.internet_services),
|
||||||
'config': WormConfiguration.as_dict(),
|
'config': WormConfiguration.as_dict(),
|
||||||
'parent': parent}
|
'parent': parent}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
import socket
|
import socket
|
||||||
import struct
|
import struct
|
||||||
|
@ -58,3 +59,10 @@ def get_free_tcp_port(min_range=1000, max_range=65535):
|
||||||
return port
|
return port
|
||||||
|
|
||||||
return None
|
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 =
|
var html =
|
||||||
"<label>Name:</label> " + monkey.hostname + "</br>" +
|
"<label>Name:</label> " + monkey.hostname + "</br>" +
|
||||||
"<label>Description:</label> " + monkey.description + "</br>" +
|
"<label>Description:</label> " + monkey.description + "</br>" +
|
||||||
|
"<label>Internet Access:</label> " + monkey.internet_access + "</br>" +
|
||||||
"<label>IP Address:</label></br>"
|
"<label>IP Address:</label></br>"
|
||||||
|
|
||||||
for (var i = 0; i < monkey.ip_addresses.length; i++) {
|
for (var i = 0; i < monkey.ip_addresses.length; i++) {
|
||||||
|
|
Loading…
Reference in New Issue