forked from p15670423/monkey
Merge branch 'develop' of https://github.com/guardicore/monkey into develop
This commit is contained in:
commit
1aab83c79e
|
@ -82,4 +82,5 @@ MonkeyZoo/*
|
||||||
!MonkeyZoo/config.tf
|
!MonkeyZoo/config.tf
|
||||||
!MonkeyZoo/MonkeyZooDocs.pdf
|
!MonkeyZoo/MonkeyZooDocs.pdf
|
||||||
|
|
||||||
|
# vim swap files
|
||||||
|
*.swp
|
||||||
|
|
|
@ -89,25 +89,8 @@ kernel=`uname -m`
|
||||||
linux_dist=`lsb_release -a 2> /dev/null`
|
linux_dist=`lsb_release -a 2> /dev/null`
|
||||||
|
|
||||||
# If a user haven't installed mongo manually check if we can install it with our script
|
# If a user haven't installed mongo manually check if we can install it with our script
|
||||||
if [[ ! -f "$MONGO_BIN_PATH/mongod" ]] && { [[ ${kernel} != "x86_64" ]] || \
|
log_message "Installing MongoDB"
|
||||||
{ [[ ${linux_dist} != *"Debian"* ]] && [[ ${linux_dist} != *"Ubuntu"* ]]; }; }; then
|
${ISLAND_PATH}/linux/install_mongo.sh ${MONGO_BIN_PATH} || handle_error
|
||||||
echo "Script does not support your operating system for mongodb installation.
|
|
||||||
Reference monkey island readme and install it manually"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Download mongo
|
|
||||||
if [[ ! -f "$MONGO_BIN_PATH/mongod" ]]; then
|
|
||||||
log_message "Downloading mongodb"
|
|
||||||
if [[ ${linux_dist} == *"Debian"* ]]; then
|
|
||||||
wget -c -N -O "/tmp/mongo.tgz" ${MONGO_DEBIAN_URL}
|
|
||||||
elif [[ ${linux_dist} == *"Ubuntu"* ]]; then
|
|
||||||
wget -c -N -O "/tmp/mongo.tgz" ${MONGO_UBUNTU_URL}
|
|
||||||
fi
|
|
||||||
tar --strip 2 --wildcards -C ${MONGO_BIN_PATH} -zxvf /tmp/mongo.tgz mongo*/bin/* || handle_error
|
|
||||||
else
|
|
||||||
log_message "Mongo db already installed"
|
|
||||||
fi
|
|
||||||
|
|
||||||
log_message "Installing openssl"
|
log_message "Installing openssl"
|
||||||
sudo apt-get install openssl
|
sudo apt-get install openssl
|
||||||
|
|
|
@ -30,14 +30,14 @@ class AwsInstance(object):
|
||||||
self.region = self._parse_region(
|
self.region = self._parse_region(
|
||||||
urllib2.urlopen(AWS_LATEST_METADATA_URI_PREFIX + 'meta-data/placement/availability-zone').read())
|
urllib2.urlopen(AWS_LATEST_METADATA_URI_PREFIX + 'meta-data/placement/availability-zone').read())
|
||||||
except urllib2.URLError as e:
|
except urllib2.URLError as e:
|
||||||
logger.error("Failed init of AwsInstance while getting metadata: {}".format(e.message))
|
logger.warning("Failed init of AwsInstance while getting metadata: {}".format(e.message))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.account_id = self._extract_account_id(
|
self.account_id = self._extract_account_id(
|
||||||
urllib2.urlopen(
|
urllib2.urlopen(
|
||||||
AWS_LATEST_METADATA_URI_PREFIX + 'dynamic/instance-identity/document', timeout=2).read())
|
AWS_LATEST_METADATA_URI_PREFIX + 'dynamic/instance-identity/document', timeout=2).read())
|
||||||
except urllib2.URLError as e:
|
except urllib2.URLError as e:
|
||||||
logger.error("Failed init of AwsInstance while getting dynamic instance data: {}".format(e.message))
|
logger.warning("Failed init of AwsInstance while getting dynamic instance data: {}".format(e.message))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _parse_region(region_url_response):
|
def _parse_region(region_url_response):
|
||||||
|
|
|
@ -7,6 +7,7 @@ import urllib2
|
||||||
import httplib
|
import httplib
|
||||||
import unicodedata
|
import unicodedata
|
||||||
import re
|
import re
|
||||||
|
import ssl
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from infection_monkey.exploit.web_rce import WebRCE
|
from infection_monkey.exploit.web_rce import WebRCE
|
||||||
|
@ -47,7 +48,7 @@ class Struts2Exploiter(WebRCE):
|
||||||
headers = {'User-Agent': 'Mozilla/5.0'}
|
headers = {'User-Agent': 'Mozilla/5.0'}
|
||||||
request = urllib2.Request(url, headers=headers)
|
request = urllib2.Request(url, headers=headers)
|
||||||
try:
|
try:
|
||||||
return urllib2.urlopen(request).geturl()
|
return urllib2.urlopen(request, context=ssl._create_unverified_context()).geturl()
|
||||||
except urllib2.URLError:
|
except urllib2.URLError:
|
||||||
LOG.error("Can't reach struts2 server")
|
LOG.error("Can't reach struts2 server")
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -13,6 +13,7 @@ from infection_monkey.config import WormConfiguration, EXTERNAL_CONFIG_FILE
|
||||||
from infection_monkey.dropper import MonkeyDrops
|
from infection_monkey.dropper import MonkeyDrops
|
||||||
from infection_monkey.model import MONKEY_ARG, DROPPER_ARG
|
from infection_monkey.model import MONKEY_ARG, DROPPER_ARG
|
||||||
from infection_monkey.monkey import InfectionMonkey
|
from infection_monkey.monkey import InfectionMonkey
|
||||||
|
# noinspection PyUnresolvedReferences
|
||||||
import infection_monkey.post_breach # dummy import for pyinstaller
|
import infection_monkey.post_breach # dummy import for pyinstaller
|
||||||
|
|
||||||
__author__ = 'itamar'
|
__author__ = 'itamar'
|
||||||
|
@ -70,7 +71,8 @@ def main():
|
||||||
print("Loaded Configuration: %r" % WormConfiguration.as_dict())
|
print("Loaded Configuration: %r" % WormConfiguration.as_dict())
|
||||||
|
|
||||||
# Make sure we're not in a machine that has the kill file
|
# Make sure we're not in a machine that has the kill file
|
||||||
kill_path = os.path.expandvars(WormConfiguration.kill_file_path_windows) if sys.platform == "win32" else WormConfiguration.kill_file_path_linux
|
kill_path = os.path.expandvars(
|
||||||
|
WormConfiguration.kill_file_path_windows) if sys.platform == "win32" else WormConfiguration.kill_file_path_linux
|
||||||
if os.path.exists(kill_path):
|
if os.path.exists(kill_path):
|
||||||
print("Kill path found, finished run")
|
print("Kill path found, finished run")
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -250,8 +250,9 @@ SCHEMA = {
|
||||||
"default": [
|
"default": [
|
||||||
],
|
],
|
||||||
"description":
|
"description":
|
||||||
"List of IPs/subnets the monkey should scan."
|
"List of IPs/subnets/hosts the monkey should scan."
|
||||||
" Examples: \"192.168.0.1\", \"192.168.0.5-192.168.0.20\", \"192.168.0.5/24\""
|
" Examples: \"192.168.0.1\", \"192.168.0.5-192.168.0.20\", \"192.168.0.5/24\","
|
||||||
|
" \"printer.example\""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue