forked from p34709852/monkey
Cosmetic changes and small refactors
This commit is contained in:
parent
45be010470
commit
f35340e7ae
|
@ -100,9 +100,9 @@
|
||||||
"post_breach_actions" : [],
|
"post_breach_actions" : [],
|
||||||
"custom_post_breach" : { "linux": "",
|
"custom_post_breach" : { "linux": "",
|
||||||
"windows": "",
|
"windows": "",
|
||||||
"linux_file": "",
|
"linux_file": None,
|
||||||
"windows_file": "",
|
"windows_file": None,
|
||||||
"windows_file_info": {"name": "", "size": "0" },
|
"windows_file_info": None,
|
||||||
"linux_file_info": {"name": "", "size":"0"}
|
"linux_file_info": None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,6 +113,10 @@ class InfectionMonkey(object):
|
||||||
system_info = system_info_collector.get_info()
|
system_info = system_info_collector.get_info()
|
||||||
ControlClient.send_telemetry("system_info_collection", system_info)
|
ControlClient.send_telemetry("system_info_collection", system_info)
|
||||||
|
|
||||||
|
for action_class in WormConfiguration.post_breach_actions:
|
||||||
|
action = action_class()
|
||||||
|
action.act()
|
||||||
|
|
||||||
PostBreach().execute()
|
PostBreach().execute()
|
||||||
|
|
||||||
if 0 == WormConfiguration.depth:
|
if 0 == WormConfiguration.depth:
|
||||||
|
|
|
@ -29,7 +29,7 @@ from cc.resources.telemetry import Telemetry
|
||||||
from cc.resources.telemetry_feed import TelemetryFeed
|
from cc.resources.telemetry_feed import TelemetryFeed
|
||||||
from cc.resources.pba_file_download import PBAFileDownload
|
from cc.resources.pba_file_download import PBAFileDownload
|
||||||
from cc.services.config import ConfigService
|
from cc.services.config import ConfigService
|
||||||
from cc.resources.file_upload import FileUpload
|
from cc.resources.pba_file_upload import FileUpload
|
||||||
|
|
||||||
__author__ = 'Barak'
|
__author__ = 'Barak'
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ from cc.services.config import ConfigService, WINDOWS_PBA_INFO, LINUX_PBA_INFO
|
||||||
import os
|
import os
|
||||||
from werkzeug.utils import secure_filename
|
from werkzeug.utils import secure_filename
|
||||||
import logging
|
import logging
|
||||||
from cc.database import mongo
|
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
|
@ -45,6 +45,7 @@ WINDOWS_PBA_INFO.append('windows_file_info')
|
||||||
LINUX_PBA_INFO = copy.deepcopy(PBA_CONF_PATH)
|
LINUX_PBA_INFO = copy.deepcopy(PBA_CONF_PATH)
|
||||||
LINUX_PBA_INFO.append('linux_file_info')
|
LINUX_PBA_INFO.append('linux_file_info')
|
||||||
|
|
||||||
|
|
||||||
class ConfigService:
|
class ConfigService:
|
||||||
default_config = None
|
default_config = None
|
||||||
|
|
||||||
|
@ -157,7 +158,7 @@ class ConfigService:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def update_config(config_json, should_encrypt):
|
def update_config(config_json, should_encrypt):
|
||||||
# Island file upload on file_upload endpoint and sets correct config there
|
# Island file upload happens on pba_file_upload endpoint and config is set there
|
||||||
ConfigService.keep_PBA_files(config_json)
|
ConfigService.keep_PBA_files(config_json)
|
||||||
if should_encrypt:
|
if should_encrypt:
|
||||||
try:
|
try:
|
||||||
|
@ -173,7 +174,7 @@ class ConfigService:
|
||||||
def keep_PBA_files(config_json):
|
def keep_PBA_files(config_json):
|
||||||
"""
|
"""
|
||||||
file_upload endpoint handles file upload and sets config asynchronously.
|
file_upload endpoint handles file upload and sets config asynchronously.
|
||||||
This brings file info in config up to date.
|
This saves file info from being overridden.
|
||||||
"""
|
"""
|
||||||
if ConfigService.get_config():
|
if ConfigService.get_config():
|
||||||
linux_info = ConfigService.get_config_value(LINUX_PBA_INFO)
|
linux_info = ConfigService.get_config_value(LINUX_PBA_INFO)
|
||||||
|
@ -250,6 +251,7 @@ class ConfigService:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def r_get_properties(schema):
|
def r_get_properties(schema):
|
||||||
|
""" Recursively gets all nested properties in schema"""
|
||||||
if "default" in schema:
|
if "default" in schema:
|
||||||
return schema["default"]
|
return schema["default"]
|
||||||
if "properties" in schema:
|
if "properties" in schema:
|
||||||
|
|
|
@ -132,7 +132,8 @@ class ReportService:
|
||||||
(NodeService.get_displayed_node_by_id(edge['from'], True)
|
(NodeService.get_displayed_node_by_id(edge['from'], True)
|
||||||
for edge in EdgeService.get_displayed_edges_by_to(node['id'], True)))),
|
for edge in EdgeService.get_displayed_edges_by_to(node['id'], True)))),
|
||||||
'services': node['services'],
|
'services': node['services'],
|
||||||
'domain_name': node['domain_name']
|
'domain_name': node['domain_name'],
|
||||||
|
'pba_results': node['pba_results'] if 'pba_results' in node else 'None'
|
||||||
})
|
})
|
||||||
|
|
||||||
logger.info('Scanned nodes generated for reporting')
|
logger.info('Scanned nodes generated for reporting')
|
||||||
|
@ -156,7 +157,6 @@ class ReportService:
|
||||||
'exploits': list(set(
|
'exploits': list(set(
|
||||||
[ReportService.EXPLOIT_DISPLAY_DICT[exploit['exploiter']] for exploit in monkey['exploits'] if
|
[ReportService.EXPLOIT_DISPLAY_DICT[exploit['exploiter']] for exploit in monkey['exploits'] if
|
||||||
exploit['result']])),
|
exploit['result']])),
|
||||||
'pba_results': monkey['pba_results'] if 'pba_results' in monkey else 'None'
|
|
||||||
}
|
}
|
||||||
for monkey in exploited]
|
for monkey in exploited]
|
||||||
|
|
||||||
|
|
|
@ -462,7 +462,7 @@ class ReportPageComponent extends AuthComponent {
|
||||||
<BreachedServers data={this.state.report.glance.exploited}/>
|
<BreachedServers data={this.state.report.glance.exploited}/>
|
||||||
</div>
|
</div>
|
||||||
<div style={{marginBottom: '20px'}}>
|
<div style={{marginBottom: '20px'}}>
|
||||||
<PostBreach data={this.state.report.glance.exploited}/>
|
<PostBreach data={this.state.report.glance.scanned}/>
|
||||||
</div>
|
</div>
|
||||||
<div style={{marginBottom: '20px'}}>
|
<div style={{marginBottom: '20px'}}>
|
||||||
<ScannedServers data={this.state.report.glance.scanned}/>
|
<ScannedServers data={this.state.report.glance.scanned}/>
|
||||||
|
|
|
@ -21,13 +21,6 @@ let renderPostBreach = function (machine, pbaList) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let renderMachine = function (val) {
|
|
||||||
if (val.pba_results.length === 0){
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return <div>{val.label} {renderIpAddresses(val)}</div>
|
|
||||||
};
|
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
Header: 'Post breach actions',
|
Header: 'Post breach actions',
|
||||||
|
|
Loading…
Reference in New Issue