Created
January 27, 2025 11:28
Revisions
-
incogbyte created this gist
Jan 27, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,58 @@ import urllib.parse """ By @incogbyte Python script that generates diff encodings techniques. Those techniques can be used to bypass HTTP WAF. """ def generate_encodings(input_string): encodings = {} # 1. Standard Percent-Encoding percent_encoded = urllib.parse.quote(input_string) encodings["Percent-Encoding"] = percent_encoded # 2. Double Percent-Encoding double_percent_encoded = urllib.parse.quote(percent_encoded) encodings["Double Percent-Encoding"] = double_percent_encoded # 3. Second Nibble Hex Encoding second_nibble_encoded = ''.join( f"%{char[-1]}" if len(char) == 2 else char for char in percent_encoded.split('%') if char ) encodings["Second Nibble Hex Encoding"] = second_nibble_encoded # 4. UTF-16 Encoding utf16_encoded = ''.join(f"%{hex(ord(char))[2:].zfill(4).upper()}" for char in input_string) encodings["UTF-16 Encoding"] = utf16_encoded # 5. Unicode Escaped Encoding unicode_escaped = ''.join(f"%u{ord(char):04X}" for char in input_string) encodings["Unicode Escaped Encoding"] = unicode_escaped # 6. Mixed Encodings mixed_encoding = ''.join( f"%{hex(ord(char))[2:].upper() if i % 2 == 0 else char}" for i, char in enumerate(input_string) ) encodings["Mixed Encoding"] = mixed_encoding # 7. Over-encoded (Triple Percent-Encoding) triple_percent_encoded = urllib.parse.quote(double_percent_encoded) encodings["Triple Percent-Encoding"] = triple_percent_encoded # 8. Space Encodings (Specific Case) space_replaced = input_string.replace(" ", "%20").replace(" ", "+") encodings["Space Encodings"] = space_replaced return encodings if __name__ == "__main__": print("[*] Enter the string to encode:") user_input = input().strip() print("\nGenerated Encodings:\n") encodings = generate_encodings(user_input) for encoding_type, encoded_value in encodings.items(): print(f"{encoding_type}:\n{encoded_value}\n")