From 00c1fcd99282cf09a961af416c1fdd3b7ddf095b Mon Sep 17 00:00:00 2001 From: James Flynn Date: Fri, 17 Dec 2021 16:38:15 +0000 Subject: [PATCH 1/5] Fixed: Print statement declarations --- DownloadUsage/DownloadUsage.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/DownloadUsage/DownloadUsage.py b/DownloadUsage/DownloadUsage.py index e27fa2e..cc5a9dc 100644 --- a/DownloadUsage/DownloadUsage.py +++ b/DownloadUsage/DownloadUsage.py @@ -20,7 +20,7 @@ notfound = 0 with open(readfile) as f: - print "Parsing Access Log..." + print("Parsing Access Log...") for line in f: try: p = re.compile(ur'(\d*)-(\d*-\d*\d*......)(........)(.*])(.*)(:)(.*)(for)(.)(.*)(\/)(.*)(\.)') @@ -36,7 +36,7 @@ except Exception: notfound +=1 #An error may occur if the file has been deleted. This script is not perfect. pass -print Fore.RED + "Could not find",(notfound),"artifacts(most likely deleted)" -print Fore.GREEN + "Total download usage:",(totalbytes/1000000),"MB" -print (Style.RESET_ALL) +print(Fore.RED + "Could not find",(notfound),"artifacts(most likely deleted)") +print(Fore.GREEN + "Total download usage:",(totalbytes/1000000),"MB") +print(Style.RESET_ALL) exit() \ No newline at end of file From 0eb9a69010f6721d017de1256c45ef31d755fb8a Mon Sep 17 00:00:00 2001 From: James Flynn Date: Fri, 17 Dec 2021 16:41:56 +0000 Subject: [PATCH 2/5] Fixed: Replaced ur string type with r, type not supported in py3 --- DownloadUsage/DownloadUsage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DownloadUsage/DownloadUsage.py b/DownloadUsage/DownloadUsage.py index cc5a9dc..4cdfa12 100644 --- a/DownloadUsage/DownloadUsage.py +++ b/DownloadUsage/DownloadUsage.py @@ -23,7 +23,7 @@ print("Parsing Access Log...") for line in f: try: - p = re.compile(ur'(\d*)-(\d*-\d*\d*......)(........)(.*])(.*)(:)(.*)(for)(.)(.*)(\/)(.*)(\.)') + p = re.compile(r'(\d*)-(\d*-\d*\d*......)(........)(.*])(.*)(:)(.*)(for)(.)(.*)(\/)(.*)(\.)') match = re.match(p,line) if "ACCEPTED DOWNLOAD" in match.group(4): checkfile = match.group(5) + "/" + match.group(7) From 66364c415613524273fbde9e8ee5efccef1583c7 Mon Sep 17 00:00:00 2001 From: James Flynn Date: Fri, 17 Dec 2021 16:42:27 +0000 Subject: [PATCH 3/5] Removed: Duplicate import --- DownloadUsage/DownloadUsage.py | 1 - 1 file changed, 1 deletion(-) diff --git a/DownloadUsage/DownloadUsage.py b/DownloadUsage/DownloadUsage.py index 4cdfa12..cfd832a 100644 --- a/DownloadUsage/DownloadUsage.py +++ b/DownloadUsage/DownloadUsage.py @@ -3,7 +3,6 @@ import requests import json from colorama import Fore, Back, Style -import colorama username = "admin" #EDIT THIS password = "password" #EDIT THIS From 0260a27336f33fe54acee5e4f22160a77be12cbf Mon Sep 17 00:00:00 2001 From: James Flynn Date: Fri, 17 Dec 2021 16:47:10 +0000 Subject: [PATCH 4/5] Removed: Python libs not found in pip --- DownloadUsage/requirements.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/DownloadUsage/requirements.txt b/DownloadUsage/requirements.txt index 00b8ae9..580af6b 100644 --- a/DownloadUsage/requirements.txt +++ b/DownloadUsage/requirements.txt @@ -1,5 +1,2 @@ -sys -re requests -json colorama From 0d0b955a1b139f4e4ac829935ed813e6f489c5f9 Mon Sep 17 00:00:00 2001 From: James Flynn Date: Tue, 21 Dec 2021 19:50:32 +0000 Subject: [PATCH 5/5] Added: Usage to README --- DownloadUsage/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/DownloadUsage/README.md b/DownloadUsage/README.md index 6fb8988..f846436 100644 --- a/DownloadUsage/README.md +++ b/DownloadUsage/README.md @@ -1,2 +1,4 @@ -To install all requirements, use pip install -r requirements. \ No newline at end of file +To install all requirements, use `pip install -r requirements`. + +Usage: `python DownloadUsage.py access.log`