def task_save_terminal_log(user, hostname, ip, protocol, port, username, cmd, detail, address, useragent, start_time): event = TerminalLog() event.user = user event.hostname = hostname event.ip = ip event.protocol = protocol event.port = port event.username = username event.cmd = cmd event.detail = detail event.address = address event.useragent = useragent event.start_time = start_time event.save()
def terminal_log(user, hostname, ip, protocol, port, username, cmd, res, address, useragent, start_time): event = TerminalLog() event.user = user event.hostname = hostname event.ip = ip event.protocol = protocol event.port = port event.username = username event.cmd = cmd # event.res = res event.address = address event.useragent = useragent event.start_time = start_time event.save() event_detail = TerminalLogDetail() event_detail.terminallog = event event_detail.res = res event_detail.save()
def terminal_log(user, hostname, ip, protocol, port, username, cmd, detail, address, useragent, start_time): _user = '' try: _user = user.username except Exception: _user = user if platform.system().lower() in ['linux', 'unix']: task_save_terminal_log.delay(_user, hostname, ip, protocol, port, username, cmd, detail, address, useragent, start_time) else: event = TerminalLog() event.user = _user event.hostname = hostname event.ip = ip event.protocol = protocol event.port = port event.username = username event.cmd = cmd event.detail = detail event.address = address event.useragent = useragent event.start_time = start_time event.save()