diff --git a/sccmwtf.py b/sccmwtf.py index 49ea36a..10665ab 100755 --- a/sccmwtf.py +++ b/sccmwtf.py @@ -132,11 +132,16 @@ def sendCCMPostRequest(self, data, auth=False, username="", password=""): r = requests.request("CCM_POST", f"{self._serverURI}/ccm_system_windowsauth/request", headers=headers, data=data, auth=HttpNtlmAuth(username, password)) else: r = requests.request("CCM_POST", f"{self._serverURI}/ccm_system/request", headers=headers, data=data) - - multipart_data = decoder.MultipartDecoder.from_response(r) - for part in multipart_data.parts: - if part.headers[b'content-type'] == b'application/octet-stream': - return zlib.decompress(part.content).decode('utf-16') + + if r.status_code == 200: + multipart_data = decoder.MultipartDecoder.from_response(r) + for part in multipart_data.parts: + if part.headers[b'content-type'] == b'application/octet-stream': + return zlib.decompress(part.content).decode('utf-16') + elif r.status_code == 403: + print(f"[!] Unauthorized!") + else: + print(f"[!] Unexpected Error code from SCCM Server: {r.status_code}") def requestPolicy(self, url, clientID="", authHeaders=False, retcontent=False): headers = {