Python module for web hacking and security testing
Project description
arang
Python module for web hacking and security testing.
Installation
pip install arang
# or
python -m pip install arang
With SEED crypto support (optional)
pip install arang[seed]
Update
pip install -U arang
# or
python -m pip install -U arang
Requirements
- Python 3.8 ~ 3.13
- requests
- pycryptodome
- pyperclip
Features
parsePacket (class)
Parse raw HTTP packets from Fiddler or Burp Suite and send requests.
from arang import *
rawPacket = '''GET http://example.com/ HTTP/1.1
Host: example.com
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
'''
pp = parsePacket(rawPacket)
print('Method:', pp.method)
print('URL:', pp.url)
print('Headers:', pp.headers)
print('Data:', pp.data)
# Configure options
pp.setProxy('127.0.0.1:8080')
pp.redirect = False
pp.silent = True
pp.timeout = 30
# Send request
r = pp.get(pp.url, headers=pp.headers)
print(r.content)
Sequential Intruder (like Burp Suite)
Use $@#<number>#@$ pattern to iterate through values:
from arang import *
rawPacket = '''GET http://example.com/?id=$@#100#@$ HTTP/1.1
Host: example.com
'''
pp = parsePacket(rawPacket)
# Count up from 100 to 272 (hex 0x110)
results = pp.sequentialIntruder(
rawPacket,
to=0x110,
option='upper', # 'upper' or 'lower'
hexed=True, # Use hex numbers
verbose=False,
showContent=False,
resultSaveWithFile='result.txt'
)
# Count down from 100 to 90, find specific string
results = pp.sequentialIntruder(
rawPacket,
to=90,
option='lower',
find='target_string',
verbose=True
)
Clipboard (pp function)
Copy text to clipboard. Supports both str and bytes:
from arang import pp
# Copy string
pp("Hello, World!")
# Copy bytes (auto-converted to string)
pp(b"Hello bytes")
# With custom encoding for Korean text
pp(b"\xed\x95\x9c\xea\xb8\x80", encoding='utf-8')
Encoding / Decoding
URL, Base64, and Hex encoding with short aliases:
from arang import *
# URL encoding
urlencode('hello world') # 'hello%20world'
urldecode('hello%20world') # 'hello world'
ue('한글', enc='utf-8') # URL encode Korean
ud('%ED%95%9C%EA%B8%80') # URL decode
# Base64
b64encode('hello') # 'aGVsbG8='
b64decode('aGVsbG8=') # 'hello'
be(b'bytes') # Short alias
bd('aGVsbG8=') # Short alias
# Hex
hexencode('AB') # '4142'
hexdecode('4142') # 'AB'
he(b'data') # Short alias
hd('64617461') # Short alias
Hashing
MD5, SHA1, SHA256, SHA512 with optional hex output:
from arang import *
# Returns bytes by default
md5('hello') # b'\x5d\x41...'
sha1('hello')
sha256('hello')
sha512('hello')
# Get hex string
md5('hello', hex_digest=True) # '5d41402abc4b2a76b9719d911017c592'
sha256(b'bytes', hex_digest=True)
Cryptography (AES)
Easy AES encryption/decryption with helpful error messages:
from arang.crypto import aes
key = b'0123456789abcdef' # 16/24/32 bytes
iv = b'abcdef0123456789' # 16 bytes
# Encrypt (supports str and bytes)
encrypted = aes.enc(key, iv, b'Hello, World!')
encrypted = aes.enc(key, iv, 'String also works')
# Decrypt
decrypted = aes.dec(key, iv, encrypted)
print(decrypted) # b'Hello, World!'
# Different modes: CBC (default), ECB, CFB, OFB, CTR
encrypted = aes.enc(key, iv, data, mode='CTR')
encrypted = aes.enc(key, None, data, mode='ECB') # ECB doesn't need IV
# Without padding
encrypted = aes.enc(key, iv, padded_data, padding=False)
Error messages include usage hints:
[x] key must be 16, 24, or 32 bytes, got 10 bytes
Usage: aes.enc(key, iv, data, mode='CBC', padding=True)
aes.dec(key, iv, data, mode='CBC', padding=True)
Parameters:
- key: 16/24/32 bytes (AES-128/192/256)
- iv: 16 bytes (required for CBC, CFB, OFB, CTR modes)
- data: bytes
- mode: 'CBC', 'ECB', 'CFB', 'OFB', 'CTR' (default: 'CBC')
Cryptography (SEED)
SEED encryption (Korean standard TTAS.KO-12.0004/R1):
from arang.crypto import seed
key = b'0123456789abcdef' # 16 bytes only
iv = b'abcdef0123456789' # 16 bytes
# Encrypt
encrypted = seed.enc(key, iv, b'Hello, World!')
# Decrypt
decrypted = seed.dec(key, iv, encrypted)
print(decrypted) # b'Hello, World!'
# Without padding
encrypted = seed.enc(key, iv, padded_data, padding=False)
Note: Install
kisa-seedfor better performance:pip install kisa-seed
Quick Reference
| Function | Short | Description |
|---|---|---|
urlencode(s) |
ue(s) |
URL encode |
urldecode(s) |
ud(s) |
URL decode |
b64encode(s) |
be(s) |
Base64 encode |
b64decode(s) |
bd(s) |
Base64 decode |
hexencode(s) |
he(s) |
Hex encode |
hexdecode(s) |
hd(s) |
Hex decode |
md5(s) |
- | MD5 hash |
sha1(s) |
- | SHA1 hash |
sha256(s) |
- | SHA256 hash |
sha512(s) |
- | SHA512 hash |
pp(s) |
- | Copy to clipboard |
aes.enc(k, iv, d) |
- | AES encrypt |
aes.dec(k, iv, d) |
- | AES decrypt |
seed.enc(k, iv, d) |
- | SEED encrypt |
seed.dec(k, iv, d) |
- | SEED decrypt |
To-Do List
- Support ThreadPoolExecutor in intruder for faster exploitation
- OOB helper with simple webserver (idea from Zach Wade)
- Request smuggling helper
- Automated blind SQL injection
What's New?
v2.0.0 (2025-01-16)
- Complete code refactoring into modular structure
- Python 3.8 ~ 3.13 support
- Added
pp()clipboard function with bytes/str support - Added
aescrypto module with multiple modes and helpful errors - Added
seedcrypto module (Korean standard) with pure Python fallback - Added
sha512hash function - Added
hex_digestoption to hash functions - Improved type hints and docstrings
- Cleaned up dependencies
v1.0 (2021-10-15)
- Fix string encoding issue with url, base64, hex encode/decode functions
- Add short version of encode/decode functions
- Support user defined encoding with urlencode/urldecode functions
License
Copyright (C) Jaewook You (arang) (jaewook376 at naver dot com)
License: GNU General Public License, version 2
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file arang-2.0.0.tar.gz.
File metadata
- Download URL: arang-2.0.0.tar.gz
- Upload date:
- Size: 21.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf74a830853ed3e48141dc43b2f05e4aaa021e67bc778e7dda865417b1fc7ad1
|
|
| MD5 |
dac48771cae1cfbf8bd6ec0575d50491
|
|
| BLAKE2b-256 |
b1e9e497d0836bdc8924aa2aa74c873fd0478e2d95e181d27e3e9a4f49d01eed
|
File details
Details for the file arang-2.0.0-py3-none-any.whl.
File metadata
- Download URL: arang-2.0.0-py3-none-any.whl
- Upload date:
- Size: 21.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3b7b6e3a2f18b01f4ad1fe3e4e60797b792cc285912bc06f1083c277bd4c9ca
|
|
| MD5 |
feeb4f24d8c3c1ee95dac04b028bebae
|
|
| BLAKE2b-256 |
0ea3ebb287b52e293e7d01d02d5a1b833828f045e5983333faf065190942afe5
|