forked from p15670423/monkey
try
This commit is contained in:
parent
f6ebf0b51c
commit
2724e671f7
|
@ -2,7 +2,7 @@ import hashlib
|
||||||
import binascii
|
import binascii
|
||||||
import copy
|
import copy
|
||||||
import flask_restful
|
import flask_restful
|
||||||
from pthreport import PassTheHashReport, Machine
|
from pthreport import PassTheHashReport, Machine, get_report_html
|
||||||
|
|
||||||
from cc.auth import jwt_required
|
from cc.auth import jwt_required
|
||||||
from cc.services.edge import EdgeService
|
from cc.services.edge import EdgeService
|
||||||
|
@ -19,6 +19,11 @@ class PthMap(flask_restful.Resource):
|
||||||
|
|
||||||
return \
|
return \
|
||||||
{
|
{
|
||||||
"nodes": [{"id": x, "label": Machine(x).GetIp()} for x in v],
|
"graph": {
|
||||||
"edges": [{"id": str(s) + str(t), "from": s, "to": t, "label": label} for s, t, label in e]
|
"nodes": [{"id": x, "label": Machine(x).GetIp()} for x in v],
|
||||||
|
"edges": [{"id": str(s) + str(t), "from": s, "to": t, "label": label} for s, t, label in e]
|
||||||
|
},
|
||||||
|
|
||||||
|
"report_html": get_report_html()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1229,3 +1229,23 @@ def main():
|
||||||
print """</div>"""
|
print """</div>"""
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|
||||||
|
from cStringIO import StringIO
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class Capturing(list):
|
||||||
|
def __enter__(self):
|
||||||
|
self._stdout = sys.stdout
|
||||||
|
sys.stdout = self._stringio = StringIO()
|
||||||
|
return self
|
||||||
|
def __exit__(self, *args):
|
||||||
|
self.extend(self._stringio.getvalue().splitlines())
|
||||||
|
del self._stringio # free up some memory
|
||||||
|
sys.stdout = self._stdout
|
||||||
|
|
||||||
|
def get_report_html():
|
||||||
|
with Capturing() as output:
|
||||||
|
main()
|
||||||
|
|
||||||
|
return "\n".join(output)
|
||||||
|
|
|
@ -29,6 +29,7 @@ class PassTheHashMapPageComponent extends AuthComponent {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
graph: {nodes: [], edges: []},
|
graph: {nodes: [], edges: []},
|
||||||
|
report_html: "",
|
||||||
selected: null,
|
selected: null,
|
||||||
selectedType: null,
|
selectedType: null,
|
||||||
killPressed: false,
|
killPressed: false,
|
||||||
|
@ -55,7 +56,7 @@ class PassTheHashMapPageComponent extends AuthComponent {
|
||||||
this.authFetch('/api/pthmap')
|
this.authFetch('/api/pthmap')
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(res => {
|
.then(res => {
|
||||||
this.setState({graph: res});
|
this.setState({graph: res["graph"], report_html: res["report_html"]});
|
||||||
this.props.onStatusChange();
|
this.props.onStatusChange();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -70,6 +71,7 @@ class PassTheHashMapPageComponent extends AuthComponent {
|
||||||
<div>
|
<div>
|
||||||
<Graph graph={this.state.graph} options={options} />
|
<Graph graph={this.state.graph} options={options} />
|
||||||
</div>
|
</div>
|
||||||
|
<div>{this.state.report_html}</div>
|
||||||
</Col>
|
</Col>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue