forked from p34709852/monkey
split pth to be able to run standalone and in website
This commit is contained in:
parent
cec7ef6071
commit
cad048119d
|
@ -0,0 +1,21 @@
|
||||||
|
import hashlib
|
||||||
|
import binascii
|
||||||
|
import copy
|
||||||
|
import flask_restful
|
||||||
|
from pthreport import PassTheHashReport
|
||||||
|
|
||||||
|
from cc.auth import jwt_required
|
||||||
|
from cc.services.edge import EdgeService
|
||||||
|
from cc.services.node import NodeService
|
||||||
|
from cc.database import mongo
|
||||||
|
|
||||||
|
class PthMap(flask_restful.Resource):
|
||||||
|
@jwt_required()
|
||||||
|
def get(self, **kw):
|
||||||
|
graph = PassTheHashReport()
|
||||||
|
|
||||||
|
return \
|
||||||
|
{
|
||||||
|
"nodes": [{"id": x, "label": Machine(x).GetIp()} for x in graph.vertices],
|
||||||
|
"edges": [{"id": str(s) + str(t), "from": s, "to": t, "label": label} for s, t, label in graph.edges]
|
||||||
|
}
|
|
@ -1,38 +1,15 @@
|
||||||
import hashlib
|
import hashlib
|
||||||
import binascii
|
import binascii
|
||||||
import copy
|
import copy
|
||||||
from pymongo import MongoClient
|
|
||||||
|
|
||||||
class mongo(object):
|
if __name__ == "__main__":
|
||||||
|
from pymongo import MongoClient
|
||||||
|
|
||||||
|
class mongo(object):
|
||||||
db = MongoClient().monkeyisland
|
db = MongoClient().monkeyisland
|
||||||
|
else:
|
||||||
#class PthMap(flask_restful.Resource):
|
|
||||||
class PthMap(object):
|
|
||||||
#@jwt_required()
|
|
||||||
def get(self, **kw):
|
|
||||||
graph = PassTheHashMap()
|
|
||||||
|
|
||||||
return \
|
|
||||||
{
|
|
||||||
"nodes": [{"id": x, "label": Machine(x).GetIp()} for x in graph.vertices],
|
|
||||||
"edges": [{"id": str(s) + str(t), "from": s, "to": t, "label": label} for s, t, label in graph.edges]
|
|
||||||
}
|
|
||||||
|
|
||||||
if not __name__ == "__main__":
|
|
||||||
import flask_restful
|
|
||||||
|
|
||||||
from cc.auth import jwt_required
|
|
||||||
from cc.services.edge import EdgeService
|
|
||||||
from cc.services.node import NodeService
|
|
||||||
from cc.database import mongo
|
from cc.database import mongo
|
||||||
|
|
||||||
PthMapOrig = PthMap
|
|
||||||
|
|
||||||
class PthMap(flask_restful.Resource):
|
|
||||||
@jwt_required()
|
|
||||||
def get(self, **kw):
|
|
||||||
return PthMapOrig.get(self, **kw)
|
|
||||||
|
|
||||||
DsRole_RoleStandaloneWorkstation = 0
|
DsRole_RoleStandaloneWorkstation = 0
|
||||||
DsRole_RoleMemberWorkstation = 1
|
DsRole_RoleMemberWorkstation = 1
|
||||||
DsRole_RoleStandaloneServer = 2
|
DsRole_RoleStandaloneServer = 2
|
||||||
|
@ -88,8 +65,8 @@ def cache(foo):
|
||||||
elif type(o) == PthMap:
|
elif type(o) == PthMap:
|
||||||
return "PthMapSingleton"
|
return "PthMapSingleton"
|
||||||
|
|
||||||
elif type(o) == PassTheHashMap:
|
elif type(o) == PassTheHashReport:
|
||||||
return "PassTheHashMapSingleton"
|
return "PassTheHashReportSingleton"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
assert False, "%s of type %s is not hashable" % (repr(o), type(o))
|
assert False, "%s of type %s is not hashable" % (repr(o), type(o))
|
||||||
|
@ -564,7 +541,7 @@ class Machine(object):
|
||||||
|
|
||||||
return names
|
return names
|
||||||
|
|
||||||
class PassTheHashMap(object):
|
class PassTheHashReport(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.vertices = self.GetAllMachines()
|
self.vertices = self.GetAllMachines()
|
||||||
|
|
||||||
|
@ -944,7 +921,7 @@ class PassTheHashMap(object):
|
||||||
return shared_admins
|
return shared_admins
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
pth = PassTheHashMap()
|
pth = PassTheHashReport()
|
||||||
|
|
||||||
print """<style>table, td {border: ridge;} .hidden * {color:white; border:white;}</style>"""
|
print """<style>table, td {border: ridge;} .hidden * {color:white; border:white;}</style>"""
|
||||||
print "<h1>Pass The Hash Report</h1>"
|
print "<h1>Pass The Hash Report</h1>"
|
||||||
|
|
Loading…
Reference in New Issue