Skip to main content

TP-Generator - PyPI





🛠️ Installation

From PyPI:

pip install TP-Generator

From Source:

git clone https://github.com/TPCyberSec/TP-Generator.git --branch <Branch/Tag>
cd TP-Generator
python -m build
python -m pip install dist/tp_generator-<version>-py3-none-any.whl

📘 Basic Usage

Utils

from TP_Generator import Utils

Utils.timestamp(10)
# OUTPUT: 1733597189

Utils.uuid(1)
# OUTPUT: '9daeab4b-b4cb-11ef-b79b-00a554ba203d'

Utils.RandomNumber(0, 1000)
# OUTPUT: 931

Utils.RandomString(10)
# OUTPUT: 'Wz<:1<.YSC'

Utils.toUTF8_Overlong('TPCyberSec', numBytes=2)
# OUTPUT: b'\xc1\x94\xc1\x90\xc1\x83\xc1\xb9\xc1\xa2\xc1\xa5\xc1\xb2\xc1\x93\xc1\xa5\xc1\xa3'

Utils.toUTF16('TPCyberSec')
# OUTPUT: b'T\x00P\x00C\x00y\x00b\x00e\x00r\x00S\x00e\x00c\x00'

Utils.toUTF32('TPCyberSec')
# OUTPUT: b'T\x00\x00\x00P\x00\x00\x00C\x00\x00\x00y\x00\x00\x00b\x00\x00\x00e\x00\x00\x00r\x00\x00\x00S\x00\x00\x00e\x00\x00\x00c\x00\x00\x00'

Utils.Str2Hex('TPCyberSec')
# OUTPUT: '54504379626572536563'

Utils.Hex2Str('54504379626572536563')
# OUTPUT: 'TPCyberSec'

Utils.base64Encode('TPCyberSec'.encode())
# OUTPUT: b'VFBDeWJlclNlYw=='

Utils.base64Decode('VFBDeWJlclNlYw==')
# OUTPUT: b'TPCyberSec'

Utils.base64UrlEncode('TPCyberSec'.encode())
# OUTPUT: b'VFBDeWJlclNlYw'

Utils.base64UrlDecode('VFBDeWJlclNlYw'.encode())
# OUTPUT: b'TPCyberSec'

Utils.UrlEncode('TP Cyber Security')
# OUTPUT: 'TP%20Cyber%20Security'

Utils.UrlDecode('TP%20Cyber%20Security')
# OUTPUT: 'TP Cyber Security'

Utils.HTMLEncode('TPCyberSec')
# OUTPUT: '&#x54;&#x50;&#x43;&#x79;&#x62;&#x65;&#x72;&#x53;&#x65;&#x63;'

Utils.HTMLEncode('TPCyberSec', type="dec")
# OUTPUT: '&#84;&#80;&#67;&#121;&#98;&#101;&#114;&#83;&#101;&#99;'

xml_string = '''<?xml version="1.0" encoding="UTF-8"?>
<note>
  <to>Tove</to>
  <from>Jani</from>
  <heading>Reminder</heading>
  <body>Don't forget me this weekend!</body>
</note>'''

json_object = Utils.XML2JSON(xml_string)
print(json_object)
# OUTPUT: {'note': {'to': {'#text': 'Tove'}, 'from': {'#text': 'Jani'}, 'heading': {'#text': 'Reminder'}, 'body': {'#text': "Don't forget me this weekend!"}}}

xml_string = Utils.JSON2XML(json_object)
print(xml_string)
# OUTPUT: <?xml version="1.0" encoding="UTF-8"?><note><to>Tove</to><from>Jani</from><heading>Reminder</heading><body>Don&apos;t forget me this weekend!</body></note>

ProtoData = "AAAAAEwIz///////////ARI4SOG7hyB0aOG7kW5nIMSRYW5nIGPDsyBs4buXaSwgdnVpIGzDsm5nIHRo4butIGzhuqFpIHNhdSEwAVgGyAEB"
json_object = Utils.Protobuf2JSON(ProtoData, keyName_mapping={"1":{"name":"status"},"2":{"name":"message"}})
print(json_object.dumps())
# OUTPUT: {"status": -49, "message": "H\u1ec7 th\u1ed1ng \u0111ang c\u00f3 l\u1ed7i, vui l\u00f2ng th\u1eed l\u1ea1i sau!", "6": 1, "11": 6, "25": 1}

Generating testcases for the Sniper attack

from TP_Generator import AttackTypes

InjectionPoints = [
	"RequestBody||id",
	"RequestBody||name"
]

Payloads = [
	[
		"' AND '1'='1",
		"' AND '1'='0"
	]
]

for testcases in AttackTypes.Sniper(InjectionPoints, Payloads):
	print(testcases)

# OUTPUT:
# {'RequestBody||id': "' AND '1'='1"}
# {'RequestBody||id': "' AND '1'='0"}
# {'RequestBody||name': "' AND '1'='1"}
# {'RequestBody||name': "' AND '1'='0"}

Generating testcases for the Batteringram attack

from TP_Generator import AttackTypes

InjectionPoints = [
	"RequestBody||id",
	"RequestBody||name"
]

Payloads = [
	[
		"' AND '1'='1",
		"' AND '1'='0"
	]
]

for testcases in AttackTypes.Batteringram(InjectionPoints, Payloads):
	print(testcases)

# OUTPUT:
# {'RequestBody||id': "' AND '1'='1", 'RequestBody||name': "' AND '1'='1"}
# {'RequestBody||id': "' AND '1'='0", 'RequestBody||name': "' AND '1'='0"}

Generating testcases for the Pitchfork attack

from TP_Generator import AttackTypes

InjectionPoints = [
	"RequestBody||id",
	"RequestBody||name"
]

Payloads = [
	[
		"' AND '1'='1",
		"' AND '1'='0"
	],
	[
		"' OR '1'='1",
		"' OR '1'='0"
	]
]

for testcases in AttackTypes.Pitchfork(InjectionPoints, Payloads):
	print(testcases)

# OUTPUT:
# {'RequestBody||id': "' AND '1'='1", 'RequestBody||name': "' OR '1'='1"}
# {'RequestBody||id': "' AND '1'='0", 'RequestBody||name': "' OR '1'='0"}

Generating testcases for the Clusterbomb attack

from TP_Generator import AttackTypes

InjectionPoints = [
	"RequestBody||id",
	"RequestBody||name"
]

Payloads = [
	[
		"' AND '1'='1",
		"' AND '1'='0",
		"' && '1'='1"
	],
	[
		"' OR '1'='1",
		"' OR '1'='0",
	]
]

for testcases in AttackTypes.Clusterbomb(InjectionPoints, Payloads):
	print(testcases)

# OUTPUT:
# {'RequestBody||id': "' AND '1'='1", 'RequestBody||name': "' OR '1'='1"}
# {'RequestBody||id': "' AND '1'='1", 'RequestBody||name': "' OR '1'='0"}
# {'RequestBody||id': "' AND '1'='0", 'RequestBody||name': "' OR '1'='1"}
# {'RequestBody||id': "' AND '1'='0", 'RequestBody||name': "' OR '1'='0"}
# {'RequestBody||id': "' && '1'='1", 'RequestBody||name': "' OR '1'='1"}
# {'RequestBody||id': "' && '1'='1", 'RequestBody||name': "' OR '1'='0"}

Generating the TOTP, HOTP code

from TP_Generator import MFA_Generator

print(MFA_Generator.TOTP("JBSWY3DPEHPK3PXP"))
# OUTPUT: 862642

print(MFA_Generator.HOTP("JBSWY3DPEHPK3PXP", 1))
# OUTPUT: 996554

Generating the WordPress Nonce for unauthenticated users with wp-rest action

from TP_Generator import Nonce_Generator

action = "wp-rest"
NONCE_KEY = "Y9(H0]_u8BA:^or^<^4>AM@EkgnAm`{Mpsq*H!Z-?8 OHe6ITmPY6kQSai)y3w{}"
NONCE_SALT = "xV&%-Ji<,`Clp+|bqt9<c%JrGpq!EiMy///`z0+<D1F<E%H14mha9Csm<TH;~TfH"

print(Nonce_Generator.WordPress_Nonce(nonce_action=action, WORDPRESS_NONCE_KEY=NONCE_KEY, WORDPRESS_NONCE_SALT=NONCE_SALT))
# OUTPUT: ac06630f78

(Un)parsing QR Code: VietQR (TAG 38), MoMo (TAG 38), VNPAYQR (TAG 26), KHQR_Individual (TAG 29), KHQR_Corporate (TAG 30), ThaiQR_CREDIT_TRANSFER (TAG 29), ThaiQR_BILL_PAYMENT (TAG 30)

from TP_Generator import QR_Generator

QR_String = "00020101021230340009nbcb@devb01090000001230204DEVB520459995303840540115802KH5912Coffee Klang6010Phnom Penh62300314Coffe Klang0010708A60086679917001316418876882756304CE7C"

QRObj = QR_Generator.initQR("KHQR_Corporate").parse(QR_String)
print(QRObj.dumps())
# OUTPUT: {"PayloadFormatIndicator": "01", "PointOfInitiationMethod": "12", "MerchantAccountInformation": {"BakongAccountID": "nbcb@devb", "MerchantID": "000000123", "AcquiringBank": "DEVB"}, "MerchantCategoryCode": "5999", "TransactionCurrency": "840", "TransactionAmount": "1", "CountryCode": "KH", "MerchantName": "Coffee Klang", "MerchantCity": "Phnom Penh", "AdditionalDataFieldTemplate": {"StoreLabel": "Coffe Klang001", "TerminalLabel": "A6008667"}, "CRC": "CE7C", "Timestamp": {"timestamp": "1641887688275"}}

QRObj.update("TransactionAmount", "1000")
print(QR_Generator.initQR("KHQR_Corporate").unparse(QRObj))
# OUTPUT: 00020101021230340009nbcb@devb01090000001230204DEVB520459995303840540410005802KH5912Coffee Klang6010Phnom Penh62300314Coffe Klang0010708A600866799170013164188768827563043ECD

👥 Contributors


📝 CHANGELOG

TP-Generator v2026.11.18

  • New: Utils: Protobuf2JSON
  • Fixed: an unexpected keyword argument 'ordered_dict' when initializing the QR object in QR_Generator module

TP-Generator v2026.5.18

  • New: Utils: HTMLEncode, toUTF8_Overlong
  • Updated: Preserve the order of keys when parsing from XML to JSON by setting the ordered_dict parameter to True

TP-Generator v2026.4.30

  • New: Utils: XML2JSON, JSON2XML

TP-Generator v2026.3.29

  • Updated: toUTF16, toUTF32, base64Encode, base64Decode, base64UrlEncode, base64UrlDecode functions in Utils module

TP-Generator v2025.10.7

  • New: QR_Generator: ThaiQR_CREDIT_TRANSFER (TAG 29), ThaiQR_BILL_PAYMENT (TAG 30)

TP-Generator v2025.9.10

  • Fixed: base64Encode, base64Decode, base64UrlEncode, base64UrlDecode

TP-Generator v2025.1.1

  • New: Utils: toUTF16, toUTF32
  • New: QR_Generator: VNPAYQR (TAG 26)

TP-Generator v2024.12.12

  • New: Utils module
  • New: QR_Generator: Parse/Unparse QR code types: VietQR (TAG 38), MoMo (TAG 38), KHQR_Individual (TAG 29), KHQR_Corporate (TAG 30)

TP-Generator v2024.8.10

  • Updated: AttackTypes: Sniper, Batteringram, Pitchfork, Pitchfork
  • New: Nonce_Generator: Generate the WordPress Nonce

TP-Generator v2024.6.13

  • Updated: MFA_Generator: Fixed error generating TOTP, HOTP from jython

TP-Generator v2024.4.5

  • New: Bruteforcer_List: UUID1

TP-Generator v2024.3.3

  • New: MFA_Generator: TOTP (Time-based One-Time Password) and HOTP (HMAC-based One-Time Password)

TP-Generator v2024.3.1

  • New: Generate test cases for attack types: Sniper, Battering Ram, Pitchfork, Cluster Bomb

Metadata

Release files for tp-generator 2026.11.18

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tp-generator 2026.11.18
File Size Uploaded Provenance Actions
tp_generator-2026.11.18.tar.gz 52.9 kB Without provenance Details for tp_generator-2026.11.18.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tp-generator 2026.11.18
File Interpreter ABI Platform Actions
tp_generator-2026.11.18-py3-none-any.whl Python 3 none any Details for tp_generator-2026.11.18-py3-none-any.whl

Total release size: 103.8 kB

Release files / tp_generator-2026.11.18.tar.gz

Download URL tp_generator-2026.11.18.tar.gz
Size 52.9 kB
Tags Source
SHA-256 checksum
How to use checksums
002ccd6fa0e3b80ac1b803b0e2504cf426278ac98ad74eb56376c1f57b662696
BLAKE2b-256 checksum
How to use checksums
9714d92ed294b167d02399601b963bffc6b60bc2f8d46535788fff1bda5532f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.10

Release files / tp_generator-2026.11.18-py3-none-any.whl

Download URL tp_generator-2026.11.18-py3-none-any.whl
Size 50.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0423500a85b59a0da3f05e6f58d4881c65a6e736c2d89e34ed978310ed98c90b
BLAKE2b-256 checksum
How to use checksums
b966b23102c4d10f6d890a155a1e8884aabda51b4f6f8ca9fb57315deaba2fb0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.10

Security for tp-generator 2026.11.18

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page