|
|
|
@ -4,6 +4,9 @@
|
|
|
|
|
from django.db.models import TextChoices |
|
|
|
|
from django.utils.translation import ugettext_lazy as _ |
|
|
|
|
|
|
|
|
|
from assets.const import Protocol |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Replay & Command Storage Choices |
|
|
|
|
# -------------------------------- |
|
|
|
|
|
|
|
|
@ -48,11 +51,59 @@ class TerminalType(TextChoices):
|
|
|
|
|
lion = 'lion', 'Lion' |
|
|
|
|
core = 'core', 'Core' |
|
|
|
|
celery = 'celery', 'Celery' |
|
|
|
|
magnus = 'magnus', 'Magnus' |
|
|
|
|
razor = 'razor', 'Razor' |
|
|
|
|
magnus = 'magnus', 'Magnus' |
|
|
|
|
razor = 'razor', 'Razor' |
|
|
|
|
tinker = 'tinker', 'Tinker' |
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
|
def types(cls): |
|
|
|
|
return set(dict(cls.choices).keys()) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class NativeClient: |
|
|
|
|
# Koko |
|
|
|
|
ssh = 'ssh', 'ssh' |
|
|
|
|
putty = 'putty', 'PuTTY' |
|
|
|
|
xshell = 'xshell', 'Xshell' |
|
|
|
|
|
|
|
|
|
# Magnus |
|
|
|
|
mysql = 'mysql', 'MySQL Client' |
|
|
|
|
psql = 'psql', 'psql' |
|
|
|
|
sqlplus = 'sqlplus', 'sqlplus' |
|
|
|
|
redis = 'redis-cli', 'redis-cli' |
|
|
|
|
|
|
|
|
|
# Razor |
|
|
|
|
mstsc = 'mstsc', 'Remote Desktop' |
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
|
def commands(cls, name, os): |
|
|
|
|
return { |
|
|
|
|
'ssh': 'ssh {username}@{hostname} -p {port}', |
|
|
|
|
'putty': 'putty -ssh {username}@{hostname} -P {port}', |
|
|
|
|
'xshell': '-url ssh://root:passwd@192.168.10.100', |
|
|
|
|
'mysql': 'mysql -h {hostname} -P {port} -u {username} -p', |
|
|
|
|
'psql': { |
|
|
|
|
'default': 'psql -h {hostname} -p {port} -U {username} -W', |
|
|
|
|
'windows': 'psql /h {hostname} /p {port} /U {username} -W', |
|
|
|
|
}, |
|
|
|
|
'sqlplus': 'sqlplus {username}/{password}@{hostname}:{port}', |
|
|
|
|
'redis': 'redis-cli -h {hostname} -p {port} -a {password}', |
|
|
|
|
'mstsc': 'mstsc /v:{hostname}:{port}', |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ConnectMethod(TextChoices): |
|
|
|
|
web_cli = 'web_cli', _('Web CLI') |
|
|
|
|
web_gui = 'web_gui', _('Web GUI') |
|
|
|
|
native_client = 'native_client', _('Native Client') |
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
|
def methods(cls): |
|
|
|
|
return { |
|
|
|
|
Protocol.ssh: [cls.web_cli, cls.native_client], |
|
|
|
|
Protocol.rdp: ([cls.web_gui], [cls.native_client]), |
|
|
|
|
Protocol.vnc: [cls.web_gui], |
|
|
|
|
Protocol.telnet: [cls.web_cli, cls.native_client], |
|
|
|
|
Protocol.mysql: [cls.web_cli, cls.web_gui, cls.native_client], |
|
|
|
|
Protocol.sqlserver: [cls.web_cli, cls.web_gui], |
|
|
|
|
} |
|
|
|
|