diff --git a/lib/query.py b/lib/query.py index 379ad1b..d2c7f1e 100644 --- a/lib/query.py +++ b/lib/query.py @@ -25,8 +25,8 @@ def query_sqlite(workspace, target=None, repeat=None, summary=None): loadavg = float('0.00') banner = "celerystalk Status | Workspace Name: {0} | CPU Load Avg: {1}".format(workspace, str(loadavg)) print("*" * terminal_width) - print(" " * ((terminal_width / 2) - (len(banner) / 2)) + banner) - print("\n" + " " * ((terminal_width / 2) - 40) + "Submitted: {0} | Queued: {3} | Running: {2} | Completed: {1} | Cancelled: {4} | Paused: {5}".format(total_count[0][0], completed_count[0][0], len(running_rows), pending_count[0][0], len(cancelled_rows), len(paused_rows))) + print(" " * ( int(terminal_width / 2) - int(len(banner) / 2)) + banner) + print("\n" + " " * ( int(terminal_width / 2) - 40) + "Submitted: {0} | Queued: {3} | Running: {2} | Completed: {1} | Cancelled: {4} | Paused: {5}".format(total_count[0][0], completed_count[0][0], len(running_rows), pending_count[0][0], len(cancelled_rows), len(paused_rows))) print("*" * terminal_width) if summary: diff --git a/lib/report.py b/lib/report.py index 807164c..5511dd5 100644 --- a/lib/report.py +++ b/lib/report.py @@ -358,7 +358,7 @@ def report(workspace,target_list=None): print("\n") print("*" * terminal_width) banner = "Combined Report files" - print(" " * ((terminal_width / 2) - (len(banner) / 2)) + banner ) + print(" " * ( int(terminal_width / 2) - int(len(banner) / 2)) + banner ) print("*" * terminal_width + "\n") print("[+] Report file (All workspace hosts): {0} (has screenshots!!!)".format(combined_report_file_name)) @@ -366,7 +366,7 @@ def report(workspace,target_list=None): print("*" * terminal_width) banner = "Suggestions for viewing your html report:" - print(" " * ((terminal_width / 2) - (len(banner) / 2)) + banner ) + print(" " * (int(terminal_width / 2) - int(len(banner) / 2)) + banner ) print("*" * terminal_width + "\n") print("[+] Option 1: Open with local firefox (works over ssh with x forwarding)") print("\t\tfirefox " + combined_report_file_name + " &") diff --git a/lib/utils.py b/lib/utils.py index 6ec735a..5bac156 100644 --- a/lib/utils.py +++ b/lib/utils.py @@ -329,15 +329,15 @@ def get_terminal_width(): :return: the current width of the terminal """ command = ['tput', 'cols'] + width = 80 try: width = int(subprocess.check_output(command)) except OSError as e: print("Invalid Command '{0}': exit status ({1})".format( command[0], e.errno)) - width = 20 + except subprocess.CalledProcessError as e: print("Command '{0}' returned non-zero exit status: ({1})".format( command, e.returncode)) - width = 20 - finally: + else: ## finnaly return width \ No newline at end of file