Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed: DownloadUsage.py invalid syntax, requirements.txt issues #55

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions DownloadUsage/DownloadUsage.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import requests
import json
from colorama import Fore, Back, Style
import colorama

username = "admin" #EDIT THIS
password = "password" #EDIT THIS
Expand All @@ -20,10 +19,10 @@
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)(.)(.*)(\/)(.*)(\.)')
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)
Expand All @@ -36,7 +35,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()
4 changes: 3 additions & 1 deletion DownloadUsage/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@

To install all requirements, use pip install -r requirements.
To install all requirements, use `pip install -r requirements`.

Usage: `python DownloadUsage.py access.log`
3 changes: 0 additions & 3 deletions DownloadUsage/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
sys
re
requests
json
colorama