-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
44 lines (31 loc) · 1.02 KB
/
test.py
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
from __future__ import annotations
import traceback
import sys
from twisted.conch.insults import insults
from twisted.protocols.policies import TimeoutMixin
from twisted.python import failure, log
from commands import __all__
class StingerBaseProtocol(insults.TerminalProtocol, TimeoutMixin):
"""
Base protocol for interactive and non-interactive use
"""
commands = {}
for c in __all__:
try:
module = __import__(
f'commands.{c}', globals(), locals(), ['commands']
)
commands.update(module.commands)
except Exception as e:
exc_type, exc_value, exc_traceback = sys.exc_info()
log.error(
"Failed to import command {}: {}: {}".format(
c,
e,
"".join(
traceback.format_exception(exc_type, exc_value, exc_traceback)
),
)
)
def __init__(self):
self.password_input = False