Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
Build 218 - More python3 bugs knocked out. #112
Browse files Browse the repository at this point in the history
  • Loading branch information
sethsec committed Aug 26, 2019
1 parent a34b85c commit 639eddb
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 19 deletions.
2 changes: 1 addition & 1 deletion celerystalk
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ import csv

from lib.nmap import nmapcommand

build=str(217)
build=str(218)

def print_banner():

Expand Down
1 change: 1 addition & 0 deletions lib/cancel.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def cancel_tasks(id, workspace,ip=None):
elif ip:
running_tasks = db.get_running_tasks(workspace,ip)
pending_tasks = db.get_pending_tasks(workspace,ip)
paused_tasks = db.get_paused_tasks(workspace)
running_pending_paused_task_list = running_tasks + pending_tasks + paused_tasks
for task in running_pending_paused_task_list:
task_list.append(task[0])
Expand Down
20 changes: 10 additions & 10 deletions lib/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ def query_sqlite(workspace, target=None, repeat=None, summary=None):
if not terminal_width:
terminal_width = 80

completed_count = db.get_completed_task_count(workspace)
pending_count = db.get_pending_task_count(workspace)
total_count = db.get_total_tasks(workspace)
running_rows = db.get_running_tasks(workspace)
completed_rows = db.get_completed_tasks(workspace)
pending_rows = db.get_pending_tasks(workspace)
cancelled_rows = db.get_cancelled_tasks(workspace)
paused_rows = db.get_paused_tasks(workspace)
completed_count = lib.db.get_completed_task_count(workspace)
pending_count = lib.db.get_pending_task_count(workspace)
total_count = lib.db.get_total_tasks(workspace)
running_rows = lib.db.get_running_tasks(workspace)
completed_rows = lib.db.get_completed_tasks(workspace)
pending_rows = lib.db.get_pending_tasks(workspace)
cancelled_rows = lib.db.get_cancelled_tasks(workspace)
paused_rows = lib.db.get_paused_tasks(workspace)

loadavg = float("{0:.1f}".format(os.getloadavg()[0]))
banner = "celerystalk Status | Workspace Name: {0} | CPU Load Avg: {1}".format(workspace,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) - (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:
Expand Down
11 changes: 6 additions & 5 deletions lib/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def aquatone_parse_paths():
with open(aquatone_session_file, 'r') as aquatone_file:
aquatone_file_json = simplejson.load(aquatone_file)

for key,value in aquatone_file_json['pages'].iteritems():
for key,value in aquatone_file_json['pages'].items():
#print(page)
path = value['url']
screenshot_path = value['screenshotPath']
Expand Down Expand Up @@ -239,7 +239,7 @@ def report(workspace,config_file,target_list=None):

print("*" * terminal_width)
banner = "Text based report file per target"
print(" " * ((terminal_width / 2) - (len(banner) / 2)) + banner)
print(" " * int((terminal_width / 2) - (len(banner) / 2)) + banner)
print("*" * terminal_width + "\n")

# HTML Report
Expand Down Expand Up @@ -507,15 +507,15 @@ def report(workspace,config_file,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) - (len(banner) / 2)) + banner)
print("*" * terminal_width + "\n")

print("[+] Report file (All workspace hosts): {0} (has screenshots!!!)".format(combined_report_file_name))
print("[+] Report file (All workspace hosts): {0}\n".format(combined_report_file_name_txt))

print("*" * terminal_width)
banner = "Suggestions for viewing your html report:"
print(" " * ((terminal_width / 2) - (len(banner) / 2)) + banner )
print(" " * int((terminal_width / 2) - (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 + " &")
Expand Down Expand Up @@ -1032,7 +1032,8 @@ def convert_file_contents_to_html(normalized_output_file):
try:
with open(normalized_output_file, "r") as scan_file:
for line in scan_file:
line = unicode(line, errors='ignore')
# disabling this for python3. this might cause issues.
#line = unicode(line, errors='ignore')
try:
sanitized = bleach.clean(line)
except:
Expand Down
2 changes: 1 addition & 1 deletion lib/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def process_db_vhosts(workspace, simulation, target_list=None,dont_scan_ips=None
def replace_user_config_options(config_file,populated_command):
rep = lib.config_parser.get_user_config(config_file)
rep = dict((k, v) for k, v in rep)
for k,v in rep.iteritems():
for k,v in rep.items():
k = k.upper()
populated_command = populated_command.replace("[" + k + "]",v)
return populated_command
Expand Down
4 changes: 2 additions & 2 deletions lib/screenshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ def screenshot_command(arguments):
paths_len = len(lib.db.get_all_paths(workspace))
max_paths_len = len(get_max_screenshots(workspace,config_file))
max = lib.config_parser.get_screenshot_max(config_file)
print("[+]\n[+] There are [{0}] paths in the DB").format(str(paths_len))
print("[+]\n[+] There are [{0}] paths in the DB" % (str(paths_len)))
#print("[+] max_screenshots_per_vhost set to: [{0}]").format(str(max))
print("[+] Tasking aquatone to take [{0}] screenshots per host for a total of [{1}] screenshots\n[+]\n[+]").format(str(max),str(max_paths_len))
print("[+] Tasking aquatone to take [{0}] screenshots per host for a total of [{1}] screenshots\n[+]\n[+]" % str(max),str(max_paths_len))
lib.screenshot.aquatone_all_paths(workspace)

def get_max_screenshots(workspace,config_file):
Expand Down

0 comments on commit 639eddb

Please sign in to comment.