def save(command, path, pid, process_start_time, exit_status): """Save a command to Bashhub""" pid_start_time = unix_time_to_epoc_millis(process_start_time) command = command.strip() # Check if we have commands saving turned on if not bashhub_globals.BH_SAVE_COMMANDS: return # Check if we should ignore this command. if "#ignore" in command: return # Check if we should filter this command. bh_filter = bashhub_globals.BH_FILTER if bh_filter and re.findall(bh_filter, command): return # Check that we have an auth token. if bashhub_globals.BH_AUTH() == "": print("No auth token found. Run 'bashhub setup' to login.") return command = CommandForm(command, path, exit_status, pid, pid_start_time) rest_client.save_command(command)
def save(command, path, pid, process_start_time, exit_status): """Save a command to bashhub.com""" pid_start_time = unix_time_to_epoc_millis(process_start_time) command = command.strip() # Check if we should ignore this commannd or not. if "#ignore" in command: return context = UserContext(pid, pid_start_time, BH_USER_ID, BH_SYSTEM_ID) command = CommandForm(command, path, exit_status, context) rest_client.save_command(command)
def save(command, path, pid, process_start_time, exit_status): """Save a command to bashhub.com""" pid_start_time = unix_time_to_epoc_millis(process_start_time) command = command.strip() # Check if we should ignore this command. if "#ignore" in command: return # Check if we should filter this command. bh_filter = bashhub_globals.BH_FILTER if bh_filter and re.findall(bh_filter, command): return context = UserContext(pid, pid_start_time, BH_USER_ID, BH_SYSTEM_ID) command = CommandForm(command, path, exit_status, context) rest_client.save_command(command)