MCPcopy
hub / github.com/Pennyw0rth/NetExec / ProtocolLoader

Class ProtocolLoader

nxc/loaders/protocolloader.py:10–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8
9
10class ProtocolLoader:
11 def load_protocol(self, protocol_path):
12 loader = SourceFileLoader("protocol", protocol_path)
13 protocol = ModuleType(loader.name)
14 loader.exec_module(protocol)
15 return protocol
16
17 def get_protocols(self):
18 protocols = {}
19
20 proto_path = path_join(dirname(nxc.__file__), "protocols")
21 for protocol in listdir(proto_path):
22 if protocol[-3:] == ".py" and protocol[:-3] != "__init__":
23 protocol_path = path_join(proto_path, protocol)
24 protocol_name = protocol[:-3]
25
26 protocols[protocol_name] = {"path": protocol_path}
27
28 db_file_path = path_join(proto_path, protocol_name, "database.py")
29 db_nav_path = path_join(proto_path, protocol_name, "db_navigator.py")
30 protocol_args_path = path_join(proto_path, protocol_name, "proto_args.py")
31 if exists(db_file_path):
32 protocols[protocol_name]["dbpath"] = db_file_path
33 if exists(db_nav_path):
34 protocols[protocol_name]["nvpath"] = db_nav_path
35 if exists(protocol_args_path):
36 protocols[protocol_name]["argspath"] = protocol_args_path
37 return protocols

Callers 5

db_setupFunction · 0.90
mainFunction · 0.90
init_protocol_dbsFunction · 0.90
gen_cli_argsFunction · 0.90
__init__Method · 0.90

Calls

no outgoing calls

Tested by 1

db_setupFunction · 0.72