From ecd9c3b7b10ed0533c17a9b3c66efcd5de2a5b7e Mon Sep 17 00:00:00 2001 From: yakamok <38737288+yakamok@users.noreply.github.com> Date: Mon, 28 May 2018 22:40:13 +0200 Subject: [PATCH] Create download-keyserv.py --- download-keyserv.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 download-keyserv.py diff --git a/download-keyserv.py b/download-keyserv.py new file mode 100644 index 0000000..511c46a --- /dev/null +++ b/download-keyserv.py @@ -0,0 +1,28 @@ +import requests +from bs4 import BeautifulSoup +import urllib2 +import base64 +import sys + +try: + if "http://" not in sys.argv[1]: + print "not the expected url please check your input" + else: + url = sys.argv[1] + + file_name = url[url.index("@"):url.index("&")].replace('@','') + print file_name + r = requests.get(url) + data = r.text + + data_cleaned = {} + for x in data.split(): + if 'class="uid"' in x and "@" in x: + data_cleaned[int(x.replace('/','/').replace('class="uid">','').replace('','').split('@')[0])] = x.replace('/','/').replace('class="uid">','').replace('','').split('@')[1] + + with open(file_name,"wb") as handle: + for x in range(0,len(data_cleaned)): + handle.write(base64.b64decode(data_cleaned[x])) + print file_name + " has been downloaded." +except: + print "Something went wrong please try again, check your input or try switching your computer on and off"