Skip to main content

No project description provided

Project description

TP-Generator


Installation

From PyPI:

pip install TP-Generator

From Source:

git clone https://github.com/truocphan/TP-Generator.git --branch <Branch/Tag>
cd TP-Generator
python setup.py build
python setup.py install

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.toUTF16('TPCyberSec')
# OUTPUT: 'VABQAEMAeQBiAGUAcgBTAGUAYwA='

Utils.toUTF32('TPCyberSec')
# OUTPUT: 'VAAAAFAAAABDAAAAeQAAAGIAAABlAAAAcgAAAFMAAABlAAAAYwAAAA=='

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

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

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

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

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

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

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

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

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

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

CHANGELOG

TP-Generator v2025.1.1

  • New: Utils: toUTF16, toUTF32
  • New: QR_Generator: VNPAYQR

TP-Generator v2024.12.12

  • New: Utils module
  • New: QR_Generator: Parse/Unparse QR code types: VietQR, MoMo, KHQR_Individual, KHQR_Corporate

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

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

TP_Generator-2025.1.1-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

TP_Generator-2025.1.1-py2-none-any.whl (11.5 kB view details)

Uploaded Python 2

File details

Details for the file TP_Generator-2025.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for TP_Generator-2025.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 acf16432fcfa633f165210b6b7d1a8ff447902e3cb8c7cea6075e2f9318534c5
MD5 a5ccdb1e7bb2d7542b6a3c70eeab2681
BLAKE2b-256 83b1ec5f0b82756b4fea88308880ad31ffad77f2fd109ae76d2fbb7ef688f3d8

See more details on using hashes here.

File details

Details for the file TP_Generator-2025.1.1-py2-none-any.whl.

File metadata

File hashes

Hashes for TP_Generator-2025.1.1-py2-none-any.whl
Algorithm Hash digest
SHA256 6d8eb57d90248403d02f3c324d3d0ef389ad26d6b7079304ed574d579017cbda
MD5 07075cf8287296219beedb9be5110033
BLAKE2b-256 3db92b18978816de2c564113c021caa89973909019b464f07ce4c9374f30fdd1

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