1
0

Added new style EncryptHeaderRequest. tclcheck.py completely working

again.
This commit is contained in:
2018-02-10 03:30:10 +01:00
parent f470221989
commit 77e947f77b
4 changed files with 57 additions and 12 deletions

View File

@ -3,6 +3,7 @@
from .checkrequest import CheckRequest
from .downloadrequest import DownloadRequest
from .checksumrequest import ChecksumRequest
from .encryptheaderrequest import EncryptHeaderRequest
from .runner import *
from .serverselector import *
from .dumpmgr import write_info_if_dumps_found

View File

@ -0,0 +1,34 @@
# -*- coding: utf-8 -*-
from collections import OrderedDict
from .. import credentials, devices
from .tclrequest import TclRequest
from .tclresult import EncryptHeaderResult
class EncryptHeaderRequest(TclRequest):
def __init__(self, file_uri):
super().__init__()
# NOTE: THIS HAS TO BE RUN ON AN ENCSLAVE
self.uri = "/encrypt_header.php"
self.rawmode = True
self.method = "POST"
self.file_uri = file_uri
def get_headers(self):
return {"User-Agent": "tcl"}
def get_params(self):
params = OrderedDict()
params.update(credentials.get_creds2())
params["address"] = bytes(self.file_uri, "utf-8")
return params
def is_done(self, http_status: int, contents: str) -> bool:
# Expect "HTTP 206 Partial Content" response
if http_status == 206:
self.result = EncryptHeaderResult(contents)
self.success = True
return True
self.error = "HTTP {}".format(http_status)
self.success = False
return True

View File

@ -62,3 +62,7 @@ class ChecksumResult(TclResult):
self.sha1_enc_footer = file.find("ENCRYPT_FOOTER").text
self.sha1_footer = file.find("FOOTER").text
self.sha1_body = file.find("BODY").text
class EncryptHeaderResult(TclResult):
def __init__(self, contents: str):
self.rawdata = contents