forked from p34709852/monkey
Fix some bugs and todos
This commit is contained in:
parent
95d35fc8aa
commit
746ff9c26a
|
@ -3,6 +3,7 @@ import bson
|
|||
from bson.json_util import dumps
|
||||
from flask import Flask, send_from_directory, redirect, make_response
|
||||
import flask_restful
|
||||
from werkzeug.exceptions import NotFound
|
||||
|
||||
from cc.database import mongo
|
||||
from cc.resources.client_run import ClientRun
|
||||
|
@ -20,15 +21,14 @@ from cc.services.config import ConfigService
|
|||
|
||||
__author__ = 'Barak'
|
||||
|
||||
def serve_static_file(path):
|
||||
print 'requested', path
|
||||
if path.startswith('api/'):
|
||||
return make_response(404)
|
||||
return send_from_directory('ui/dist', path)
|
||||
|
||||
def serve_static_file(static_path):
|
||||
if static_path.startswith('api/'):
|
||||
raise NotFound()
|
||||
return send_from_directory('ui/dist', static_path)
|
||||
|
||||
|
||||
def serve_home():
|
||||
# TODO: remove this or merge with frontend.
|
||||
return serve_static_file('index.html')
|
||||
|
||||
|
||||
|
@ -71,7 +71,7 @@ def init_app(mongo_url):
|
|||
ConfigService.init_config()
|
||||
|
||||
app.add_url_rule('/', 'serve_home', serve_home)
|
||||
app.add_url_rule('/<path:path>', 'serve_static_file', serve_static_file)
|
||||
app.add_url_rule('/<path:static_path>', 'serve_static_file', serve_static_file)
|
||||
|
||||
api.add_resource(Root, '/api')
|
||||
api.add_resource(Monkey, '/api/monkey', '/api/monkey/', '/api/monkey/<string:guid>')
|
||||
|
|
|
@ -18,11 +18,7 @@ class EdgeService:
|
|||
@staticmethod
|
||||
def get_displayed_edges_by_to(to):
|
||||
edges = mongo.db.edge.find({"to": ObjectId(to)})
|
||||
new_edges = []
|
||||
# TODO: find better solution for this
|
||||
for i in range(edges.count()):
|
||||
new_edges.append(EdgeService.edge_to_displayed_edge(edges[i]))
|
||||
return new_edges
|
||||
return [EdgeService.edge_to_displayed_edge(edge) for edge in edges]
|
||||
|
||||
@staticmethod
|
||||
def edge_to_displayed_edge(edge):
|
||||
|
@ -154,7 +150,6 @@ class EdgeService:
|
|||
|
||||
@staticmethod
|
||||
def services_to_displayed_services(services):
|
||||
# TODO: Consider returning extended information on services.
|
||||
return [x + ": " + services[x]["name"] for x in services]
|
||||
|
||||
@staticmethod
|
||||
|
|
|
@ -35,12 +35,7 @@ class ConfigurePageComponent extends React.Component {
|
|||
|
||||
onSubmit = ({formData}) => {
|
||||
this.currentFormData = formData;
|
||||
let newConfig = this.state.configuration;
|
||||
if (this.currentFormData != {}) {
|
||||
newConfig[this.currentSection] = this.currentFormData;
|
||||
this.currentFormData = {};
|
||||
}
|
||||
this.setState({configuration: newConfig});
|
||||
this.updateConfigSection();
|
||||
fetch('/api/configuration',
|
||||
{
|
||||
method: 'POST',
|
||||
|
@ -62,17 +57,20 @@ class ConfigurePageComponent extends React.Component {
|
|||
this.currentFormData = formData;
|
||||
};
|
||||
|
||||
// TODO: remove code duplication
|
||||
setSelectedSection = (key) => {
|
||||
updateConfigSection = () => {
|
||||
let newConfig = this.state.configuration;
|
||||
if (Object.keys(this.currentFormData).length > 0) {
|
||||
newConfig[this.currentSection] = this.currentFormData;
|
||||
this.currentFormData = {};
|
||||
}
|
||||
this.setState({configuration: newConfig});
|
||||
};
|
||||
|
||||
setSelectedSection = (key) => {
|
||||
this.updateConfigSection();
|
||||
this.currentSection = key;
|
||||
this.setState({
|
||||
selectedSection: key,
|
||||
configuration: newConfig
|
||||
selectedSection: key
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -30,8 +30,6 @@ class PreviewPaneComponent extends React.Component {
|
|||
}
|
||||
|
||||
infectedAssetInfo(asset) {
|
||||
// TODO: Have exploit info expandable (show detailed attempts)
|
||||
// TODO: consider showing scans with exploits on same timeline
|
||||
return (
|
||||
<div>
|
||||
{this.assetInfo(asset)}
|
||||
|
|
|
@ -18,6 +18,7 @@ if sys.platform == "win32":
|
|||
return socket.gethostbyname_ex(local_hostname)[2]
|
||||
else:
|
||||
import fcntl
|
||||
|
||||
def local_ips():
|
||||
result = []
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue