-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebugger.py
More file actions
45 lines (40 loc) · 1.11 KB
/
debugger.py
File metadata and controls
45 lines (40 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Interface
# Interface for the tool. Very minimalistic, but has all the main
# functionalities
#
# Software is free software released under the "Original BSD license"
#
# Copyright (c) 2016 Pieter-Jan Moreels
# Copyright (c) 2016 NorthernSec
# Imports
import sys
import json
from bson import json_util
from main import *
from TIME.lib.Toolkit import *
def debug(obj):
text = json.dumps(to_dict(obj), indent=2, default=json_util.default)
open("TIME_debug.log", "a").write(text)
if __name__ == '__main__':
print("Type 'help' for more info")
while True:
try:
data = input("> ")
if data.startswith("."):
data = "exec " + data[1:]
if data.lower().startswith("exec "):
data = data.split(maxsplit=1)
payload = data[1] if len(data) > 1 else None
if payload:
try:
exec(payload)
except Exception as e:
print(e)
else:
if not interpretCommand(data):
print("Unknown command. Press type help for help.")
except (EOFError, KeyboardInterrupt):
sys.exit()