Post

Python Obfuscate Emojis

Obfuscate Your Python Source Code with Emojis or Emoticons 😬 🤯 😂.

🐍 Obfuscate Your Python Source Code with Emojy 😬 🤯 😬 🤫 🤣 😂

Emojis and emoticons will be used in this script to obfuscate your Python source code. However, please note that I cannot guarantee the security of your source code once this process is complete.

Source CODE

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

from pprint import pformat
from termcolor import colored
import os

EMOTICONS = [":)", ":D", ":P", ":S", ":(", "=)", "=/", ":/", ":{", ";)"]
EMOJIS = [
    "\U0001f600",
    "\U0001f603",
    "\U0001f604",
    "\U0001f601",
    "\U0001f605",
    "\U0001f923",
    "\U0001f602",
    "\U0001f609",
    "\U0001f60A",
    "\U0001f61b",
]
MAX_STR_LEN = 70

def banner():
    print("╭━━━╮╱╱╱╱╱╱╱╱╱╱╱╱╱╭━━━┳╮Python 3.13")
    print("┃╭━━╯╱╱╱╱╱╱╱╱╱╱╱╱╱┃╭━━┫┃Obfuscator ")
    print(colored("┃╰━━┳╮╭┳━┳━━┳━━┳━╮┃╰━━┫┃╭╮╱╭┳━╮╭━╮XD", 'green'))
    print(colored("┃╭━━┫┃┃┃╭┫╭╮┃╭╮┃╭╮┫╭━━┫┃┃┃╱┃┃╭╮┫╭╮╮🤫", 'green'))
    print(colored("┃┃╱╱┃╰╯┃┃┃╰╯┃╰╯┃┃┃┃┃╱╱┃╰┫╰━╯┃┃┃┃┃┃┃🤯", 'green'))
    print(colored("╰╯╱╱╰━━┻╯╰━╮┣━━┻╯╰┻╯╱╱╰━┻━╮╭┻╯╰┻╯╰╯:D", 'green'))
    print("╱╱╱╱╱╱╱╱╱╱╱┃┃╱╱╱╱╱╱╱╱╱╱╱╭━╯┃Emoticons")
    print("╱╱╱╱╱╱╱╱╱╱╱╰╯╱╱╱╱╱╱╱╱╱╱╱╰━━╯Emojis")

def chunk_string(in_s, n):
    return "\n".join(
        "{}\\".format(in_s[i : i + n]) for i in range(0, len(in_s), n)
    ).rstrip("\\")

def encode_string(in_s, alphabet):
    d1 = dict(enumerate(alphabet))
    d2 = {v: k for k, v in d1.items()}
    return (
        'exec("".join(map(chr,[int("".join(str({}[i]) for i in x.split())) for x in\n'
        '"{}"\n.split("  ")])))\n'.format(
            pformat(d2),
            chunk_string(
                "  ".join(" ".join(d1[int(i)] for i in str(ord(c))) for c in in_s),
                MAX_STR_LEN,
            ),
        )
    )

def main():
    banner()
    while True:
        print(colored("\nMenu:", 'yellow'))
        print("1. Obfuscate Emoticons :D ")
        print("2. Obfuscate Emojis 🤣")
        print(colored("3. About This Tools", 'green'))
        print(colored("4. Exit", 'red'))
        choice = input("Select an option: ")

        if choice == '1':
            in_file = input(colored("Enter input file name: ", 'blue'))
            out_file = input(colored("Enter output file name: ", 'blue'))
            with open(in_file) as in_f, open(out_file, "w") as out_f:
                out_f.write(encode_string(in_f.read(), EMOTICONS))
            print(colored("Obfuscation done with Emoticons.", 'green'))
        
        elif choice == '2':
            in_file = input(colored("Enter input file name: ", 'blue'))
            out_file = input(colored("Enter output file name: ", 'blue'))
            with open(in_file) as in_f, open(out_file, "w") as out_f:
                out_f.write(encode_string(in_f.read(), EMOJIS))
            print(colored("Obfuscation done with Emojis.", 'green'))
        
        elif choice == '3':
            print(colored("Desc: This program obfuscates Python scripts using emoticons or emojis.", 'yellow'))
        
        elif choice == '4':
            print(colored("Exiting...", 'red'))
            break
        
        else:
            print(colored("Invalid option. Please try again.", 'red'))

        cont = input(colored("Do you want to continue? (y/n): ", 'yellow')).lower()
        if cont == 'y':
            os.system('clear' if os.name == 'posix' else 'cls')
            banner()
        else:
            print(colored("Exiting...", 'red'))
            break

if __name__ == "__main__":
    main()

For more Detail on my github repo Python Obfuscate Emoji

[◉°] ScreenShot (gif)

pythonobfuscate

This post is licensed under CC BY 4.0 by the author.