From f75a70bc8fddc8b0aa94957eaa2b28a4e6d2cdea Mon Sep 17 00:00:00 2001
From: Chris Pomeroy <chris.pomeroy@hotmail.com>
Date: Thu, 08 Mar 2018 15:47:00 +0000
Subject: [PATCH] Changed print from statement to function, changed getaaxkey to hand off generation of keys to faas
---
getaaxkey/getaaxkey.py | 28 ++++++++++++----------------
1 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/getaaxkey/getaaxkey.py b/getaaxkey/getaaxkey.py
index 4a5ea15..4a91508 100644
--- a/getaaxkey/getaaxkey.py
+++ b/getaaxkey/getaaxkey.py
@@ -2,6 +2,7 @@
import os
import subprocess
+import requests
def filechecksum(aaxfile):
ret = subprocess.Popen(["ffprobe", "-v", "info", "-hide_banner", os.path.abspath(aaxfile)], stderr=subprocess.PIPE)
@@ -17,7 +18,7 @@
file = open(".authcode", "a")
file.write(hashsum + os.linesep)
except (IOError, OSError) as e:
- print "Can't write to .authcode"
+ print("Can't write to .authcode")
return 1
finally:
file.close()
@@ -31,7 +32,7 @@
with open(".authcode") as f:
hashes = f.read().split()
except (IOError, OSError) as e:
- print "Can't read in .authcode"
+ print("Can't read in .authcode")
return 1
finally:
f.close()
@@ -39,17 +40,12 @@
def newauthcode(checksum):
- rcwd = os.path.dirname(os.path.realpath(__file__))
- command = "./rcrack *.rtc -h "
- command += checksum
- cmd = subprocess.Popen(command, cwd=rcwd, stdout=subprocess.PIPE, shell=True)
- grep = subprocess.Popen(["grep", "-a", "hex"], stdin=cmd.stdout, stdout=subprocess.PIPE)
- key, stderr = grep.communicate()
- key = key.split()
- for x in key:
- if "hex" in x:
- return x.split(':')[1]
-
+ r = requests.post("http://x86-docker01.darkurthe.net:8080/function/checkkey", checksum )
+ if r.status_code == 200:
+ response = str(r.text)
+ return response.strip()
+ else:
+ return 1
def checkagainstexisting(abytes,aaxfile):
ret = subprocess.Popen(["ffprobe", "-activation_bytes", abytes, "-hide_banner", os.path.abspath(aaxfile)], stderr=subprocess.PIPE)
@@ -77,11 +73,11 @@
if len(sys.argv) >= 2:
args = sys.argv[1]
else:
- print "I need an file name to lookup"
+ print("I need an file name to lookup")
sys.exit(1)
checksum = filechecksum(args)
out = newauthcode(checksum.strip())
if out is not None:
- print sys.argv[1], "Auth code is:", out
+ print(sys.argv[1], "Auth code is:", out)
else:
- print sys.argv[1], "no Authcode found"
+ print(sys.argv[1], "no Authcode found")
--
Gitblit v1.10.0