Obfuscating Python Code (2024)

BISINET

·

Follow

8 min read

·

Nov 29, 2023

--

Obfuscating Python Code (2)

Python is an interpreted language, meaning that Python requires an interpreter during execution to translate the code base into machine instructions. This leads to advantages like increased flexibility, smaller program size, and code becoming platform-independent as the interpreter manages the execution in the relevant platform.

One major point of contention is that this exposes the source code of a program created by Python. Yes, we have the option of creating an executable file with packages like cx-Freeze or PyInstaller. Even when the source code is not directly bundled there are tools to decompile .pyc (compiled bytecode) files like python-uncompyle6. And creating an executable is not applicable in every situation. How can we protect our code from getting exposed?

Obfuscating Python code is the simplest way to keep the codebase protected.

Look at the following code block. Here we are simply sending a request with a username and password as headers with a simple message as the body. The https://webhook.site is to capture these requests.

import requests

# Send a web request
def send_request(username, password, message, url):
headers = {"username": username, "password": password}

try:
response = requests.post(url, headers=headers, data=message)
if response.status_code == 200:
return response.content
else:
return f"Request failed with status code {response.status_code}: {response.reason}"
except Exception as error:
return f"An error occurred: {error}"

# Read the username and password
def read_credentials(filename):
try:
with open("credentials.txt", "r") as file:
data = file.readlines()
return data
except Exception as error:
return f"An error occurred: {error}"

# Main function
def main():
# Get username and password
credentials = read_credentials("credentials.txt")

# Parameters
username = credentials[0].strip()
password = credentials[1].strip()
message = '{"text": "Hello, world!"}'
url = "https://webhook.site/2fc46539-0f46-4d80-866c-0e54ca2713e5"

# Call the function
output = send_request(username, password, message, url)

# Print the output of the request
print(output)

if __name__ == "__main__":
# Call the main function
main()

Let’s look at how we can obfuscate this code.

Oxyry Python Obfuscator is a simple web-based tool that you can use to obfuscate the Python code. Simply copy and paste your code and it will generate the obfuscated code.

Obfuscating Python Code (3)

Obfuscated Code

import requests #line:1
def send_request (OOOO0O0O00OOOOOOO ,OOOO00000OO000000 ,O0O0O000O0OOOOO0O ,OOOOO0OO000OO0O00 ):#line:4
O00O000000OO00OO0 ={"username":OOOO0O0O00OOOOOOO ,"password":OOOO00000OO000000 }#line:5
try :#line:7
OO0OOOO0000O00OOO =requests .post (OOOOO0OO000OO0O00 ,headers =O00O000000OO00OO0 ,data =O0O0O000O0OOOOO0O )#line:8
if OO0OOOO0000O00OOO .status_code ==200 :#line:9
return OO0OOOO0000O00OOO .content #line:10
else :#line:11
return f"Request failed with status code {OO0OOOO0000O00OOO.status_code}: {OO0OOOO0000O00OOO.reason}"#line:12
except Exception as OOOO0O0OO00OO000O :#line:13
return f"An error occurred: {OOOO0O0OO00OO000O}"#line:14
def read_credentials (OOO0OO00OO0000OO0 ):#line:17
try :#line:18
with open ("credentials.txt","r")as O0OO0OOOOOO0OO0OO :#line:19
OOOO0O000000O00OO =O0OO0OOOOOO0OO0OO .readlines ()#line:20
return OOOO0O000000O00OO #line:21
except Exception as O00O00OO000000O0O :#line:22
return f"An error occurred: {O00O00OO000000O0O}"#line:23
def main ():#line:26
OO00O00OOOOO00OO0 =read_credentials ("credentials.txt")#line:28
O0OOOO00OOO0OO00O =OO00O00OOOOO00OO0 [0 ].strip ()#line:31
O0OO00OO00OO00OO0 =OO00O00OOOOO00OO0 [1 ].strip ()#line:32
OOO00OOOOO000OO0O ='{"text": "Hello, world!"}'#line:33
O0OOO0OOOOOOO0000 ="https://webhook.site/2fc46539-0f46-4d80-866c-0e54ca2713e5"#line:34
O0O0OOO00O0OOOO00 =send_request (O0OOOO00OOO0OO00O ,O0OO00OO00OO00OO0 ,OOO00OOOOO000OO0O ,O0OOO0OOOOOOO0000 )#line:37
print (O0O0OOO00O0OOOO00 )#line:40
if __name__ =="__main__":#line:42
main ()

This will rename symbol names, variables, functions, classes, arguments, etc... Avoid 1:1 mapping of cleartext names to obfuscated names. Removes any comments and documentation strings.

As you can see this does not obfuscate string values and functions that access runtime namespace ( exec, dir, locals, globals ) may experience issues as they would be trying to access renamed objects. This does not make the entire code base unreadable but vastly reduces the readability of the code.

PYOBFUSCATE’s code obfuscation tool is another web-based tool that offers complete code obfuscation. This simply encrypts the entire code base using an AES 256-bit algorithm.

Obfuscating Python Code (4)

Obfuscated Code

import random , base64, codecs, zlib;

pyobfuscate=""
ob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=-FIP)Dw)L`|xk}XAIO0Z>0)T2uUXCLRCh@O~fhJ}5C_xY{_=231x^7!LSAW&^2D^0<m4yuMj>h;o!Ay;QsF8!2W8D{BV&t=<-xRl7sCRwgu~XPO@x1fL(fzo&enBNuQ4tRXbFLEB*-*lJa5khNpEhG!PzQa-2a}2_j3mcK?r8X~fF7AV7HJ{5UdT#J=k}5_Mcb%^nJ?#9-2I^;11a-xbCJr`yF7XxLsu$1Sp$Jzy^@^E1f-W|9*zhzl%&h0^i!f*6y{UdH_nS-lu*Kt(wylWb`FdhbpJ7VL2<f!Y-zn}1Zr@3z2GE3W$y&@Q6*TTem`x@jffUDL563dgUu#5e0Pqm5f57!e&c-jQwF;|9TFr6xUlYIs1j;xC;jMc?aJii#AYH!qnFA;Z+;qhH+Sa8$ceCtY*UYX?Fz1{<|a^VXJU&hFxWfnE5#1gH`B%0<ITP$G3us*mFS=|jW$lMK}CY4X*%6eH~H}H1@<oI|Hr#)$u}a7-QwyNsCi5qR`w(au?Ye)*|p%WyMP?goioGpy_<dLUmRy)NrEE-Y|+18vinYh*`<b&3dxaC9p4)~ANh6>Iv$4(=2_~FfH_hX?IXAFOSPrdqOOH?xHWzdp+fo^6?UinY!FkhGHm#^z&e()8I}ZA#9#al-%p6BZ#)h7*TiAx;}|(5;ZL#~$<gZKxxK*3{srzY3(zvOOZx#a60uvs^KNaE'''.replace('\n','')]))

_=lambda OO00000OOO0000OOO,c_int=100000:(_OOOO00OO0O00O00OO:=''.join(chr(int(int(OO00000OOO0000OOO.split()[OO00O0OO00O0O0OO0])/random.randint(1,c_int)))for OO00O0OO00O0O0OO0 in range(len(OO00000OOO0000OOO.split()))));eval("".join(chr(i) for i in [101,120,101,99]))("\x73\x65\x74\x61\x74\x74\x72\x28\x5f\x5f\x62\x75\x69\x6c\x74\x69\x6e\x73\x5f\x5f\x2c\x22\x5f\x5f\x5f\x5f\x5f\x5f\x22\x2c\x70\x72\x69\x6e\x74\x29\x3b\x73\x65\x74\x61\x74\x74\x72\x28\x5f\x5f\x62\x75\x69\x6c\x74\x69\x6e\x73\x5f\x5f\x2c\x22\x5f\x5f\x5f\x5f\x5f\x22\x2c\x65\x78\x65\x63\x29\x3b\x73\x65\x74\x61\x74\x74\x72\x28\x5f\x5f\x62\x75\x69\x6c\x74\x69\x6e\x73\x5f\x5f\x2c\x22\x5f\x5f\x5f\x5f\x22\x2c\x65\x76\x61\x6c\x29");__='600840 10052792 2475510 107811 3460338 725070 743968 2892000 2595808 1123520 4498098 4658724 9505818 3510345 255392 146490 5557929 9774387 9643374 676195 8169140 8968656 7951905 2729216 6994785 2809039 2272480 238206 8998248 10083880 1132512 1887269 9978295 4040976 199290 720029 6381240 390456 4855272 5536608 8270336 5334956 137240 1950112 813888 1000864 14176 4719645 7434130 4414928 6253299 9947928 1058600 1230358 2126544 2411955 8232000 3136064 3545955 10065990 11478610 1845676 5793228 1659528 8606412 2662784 9252354 3826789 8515228 10136529 9876386 4503170 4636636 3050030 2304864 8648920 3476588 1063810 6624464 4304298 1150491 8042410 11245620 2352544 7278969 5070780 3834960 143016 6244008 3168128 11537244 1865133 1213344 1977057 519120 3126900 1538392 2683994 3910416 125890 1943840 169376 2568608 2306112 1493210 846355 4957785 3989836 8217104 10113987 6212658 6166328 5037850 7088140 89080 2665299 9719915 11920920 8955970 163995 576706 283176 3952332 6138720 8659980 10319940 3459800 1280676 161860 51870 2435250 6931656 3196522 1527030 341905 7265895 9809455 5280688 6588183 1684008 10751112 3620735 3711935 2101440 809948 7445910 7656305 6875824 7874685 7469960 4394725 5493528 3843530 1205130 2690707 1967374 2228611 1179175 1150372 171600 701454 4804904 669900 5363840 4755408 11124985 3124634 2961893 2837437 10306240 6771644 3092793 3541328 182988 7504380 2047000 2964060 3378704 8487488 7190998 3697158 1008513 9005208 7376139 3927743 9552368 2742597 5133926 6206652 2311680 3009798 833028 10506608 3530296 4332300 1356850 2624527 2751793 2669733 2394070 3060196 9653172 845520 3047668 1129650 1732414 1747310 6141852 3553786 8646840 10742180 287180 1469024 8047488 11999933 3563346 859220 420224 1719072 288032 236160 8018628 6755070 3157506 9098557 82624 8832714 3347765 2617768 861504 1658215 5273592 2594072 661024 902160 6018871 5059712 9333546 5543478 10761204 2640896 8903453 1575480 7633185 2561625 10578968 1218540 2351744 2321307 6116045 1633408 7015763 5559960 703580 194336 3119584 275968 733760 8284032 10978086 2905647 3348153 823648 7268835 6811105 2865536 6322155 8007685 196784 7085907 1614012 2185672 1955680 2770597 3622466 1278320 2700033 3743630 6963888 713088 5437432 1507305 2370048 8338983 4488036 4277988 9789636 9784072 5294239 4570980 2052020 2932737 873420 692064 2712832 1440256 493184 2269836 5935947 2087019 3347070 9042473 2466925 1163640 715299 5119400 61600 6803360 3070472 3586505 7106652 2033070 3448770 1332254 3203700 10746064 3431176 5216964 6666840 4895988 1158993 1447466 1891930 7078112 6234472 5222771 3231394 5588080 4378418 11000396 10886880 8793728 1153926 5624706 10051328 4147000 877546 3422952 2137083 9117108 160089 559164 5589552 1199496 4719258 5596015 6874390 2490348 1775612 1560720 4793584 715768 4420870 1858864 1768731 6089081 782892 9675759 443322 3954581 1434120 5588080 7513732 9453620 9258872 2909040 2799450 94254 10129700 9949920 11461032 497182 218660 779670 2491648 2679584 494368 352064 4780650 2815914 294496 7500159 7957680 3969000 180320 2806720 695360 4723901 2923730 6454392 9958698 3237507 9151509 4419136 548540 636352 2456512 1158016 760864 1530048 1579104 2585568 430784 2442792 6334013 8462433 5897208 1869828 4518740 3117160 5861968 1116906 2769468 816450 2827072 1415232 1191040 2284736 8500463 5873256 4862550 8653986 474048 4160392 11480880 2319080 5977776 4726700 1302857 2626355 2011353 6087816 4281612 7839 8072324 1344846 941040 376416 1535392 25216 1638144 940672 908128 1618464 2692032 10648056 9403706 9440490 4338990 8526326 10022230 3095680 5052656 1556850 3580776 899200 322624 1953120 70272 295072 4593225 1466046 1091200 6202410 2524200 3669480 7108528 2021742 3980813 775188 2749880 879060 7325537 2466936 3110290 5079795 2893968 18560 2327936 929024 2551104 2492384 250208 2255232 2757472 1236384 1442994 8935815 6523840 4058288 758816 5608275 159264 4936678 7766440 635360 3872280 3241388 98154 46120 2160368 1370625 2638555 1671604 1677458 10174381 1842902 2885703 1477056 2982847 11056675 3048096 4126658 5386576 8473294 255852 9015797 5719266 523215 5380544 7602876 3131200 3952665 5033820 6584982 3005160 3080910 7898256 1513884 2341428 858130 2530240 1594784 2112896 2613536 9160801 10402320 9666407 2264229 3761800 3583302 3224816 6873656 7062880 2358440 1934464 2074850 443128 2641596 11325900 7407946 5716016 5132800 3202520 2705549 2412399 473240 41376 1962080 2383136 2582624 116230 8708018 5645880 6635178 8949913 7043904 9106580 3237618 801350 193792 558464 1907744 2121536 7285534 6910080 4454403 7914654 3865800 9856668 3906900 1701828 590760 464890';why,are,you,reading,this,thing,huh="\x5f\x5f\x5f\x5f","\x69\x6e\x28\x63\x68\x72\x28\x69\x29\x20\x66\x6f","\x28\x22\x22\x2e\x6a\x6f","\x72\x20\x69\x20\x69\x6e\x20\x5b\x31\x30\x31\x2c\x31\x32\x30\x2c","\x31\x30\x31\x2c\x39\x39","\x5f\x5f\x29\x29","\x5d\x29\x29\x28\x5f\x28";b='eJxzdK8wccz1A+IwYyBt6OheketYHmYKAFuyB3k=';____("".join (chr (int (OO00O0OO00O0O0OO00 /2 ))for OO00O0OO00O0O0OO00 in [202 ,240 ,202 ,198 ] if _____!=______))(f'\x5f\x5f\x5f\x5f\x28\x22\x22\x2e\x6a\x6f\x69\x6e\x28\x63\x68\x72\x28\x69\x29\x20\x66\x6f\x72\x20\x69\x20\x69\x6e\x20\x5b\x31\x30\x31\x2c\x31\x32\x30\x2c\x31\x30\x31\x2c\x39\x39\x5d\x29\x29({____(base64.b64decode(codecs.decode(zlib.decompress(base64.b64decode(b"eJw9kN1ygjAUhF8JIkzlMo6mEnIcHVIM3AGtoPIT2wSSPH2p7fTu252d2T3n3MkyK896dLvrSMIeaGxEGn0l/rpiLu3hlXm5yxDmO8tQZIDoeUQLr4oWePxk8VZfBpr9af8mXdzLTk8swRbP25bNzPvP8qwWJDRA8RX4vhLkfvuk0QRl3DOUekDC9xHZVnBcyUnXY7mtBrIOBDEKXNRl3KiBBor25l5MN7U5qSA/HsJiVpfsVIQ/Hj4dgoSYOndx+7tZLZ2m3qA4AFpUD6RDsbLXB2m0dPuPZa8GblvoGm/gthdI+8PxyYtnXqRLl9uiJi+xBbqtCmKm8/K3b7hsbmQ=")).decode(),"".join(chr(int(i/8)) for i in [912, 888, 928, 392, 408])).encode()))})')

This utilizes the PyCryptodome package to manage encryption and decryption and will introduce additional computational overhead to your application to handle this encryption and decryption. Another consideration when adapting this method is how to handle the encryption key.

PyArmor is a full-featured CLI-based Python obfuscation tool. What sets this apart from other options is that this supports both file-level obfuscation as well as package-level obfuscation.

This offers two irreversible obfuscation modes in

  • RFT Mode — This renames functions, methods, classes, variables, and arguments.
  • BCC Mode — Converts some Python functions to C functions and complies them to machine instructions.

PyArmor also offers additional capabilities such as the ability to set an expiry to the obfuscated scripts, bind the script to a specific machine using a hardware/software signature (HDD serial number, MAC address, IP address), and even a web UI to simplify the obfuscation process.

Obfuscating a Single Python File

To use PyArmor we need to install it as a pip package.

pip install pyarmor

Next, simply run the PyArmor gen command to generate the obfuscated code base.

pyarmor gen <filename>.py
Obfuscating Python Code (5)

Note — In the above image we are using poetry to manage our virtual environment and PyArmor is installed in this virtual environment. Hence using the poetry run command to start the pyarmor gen command.

This would generate a dist folder with the obfuscated code.

Obfuscating Python Code (6)

Obfuscated Code

# Pyarmor 8.4.4 (trial), 000000, non-profits, 2023-11-29T19:02:07.481333
from pyarmor_runtime_000000 import __pyarmor__
__pyarmor__(__name__, __file__, b'PY000000\x00\x03\n\x00o\r\r\n\x80\x00\x01\x00\x08\x00\x00\x00\x04\x00\x00\x00@\x00\x00\x00\xaf\x08\x00\x00\x12\t\x04\x00\x91I\x8a\xae\xf1\x1a\x11\'@k\xef&\xf7i\x82X\x00\x00\x00\x00\x00\x00\x00\x00\xd5&\x1d*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f7\xdb\x00q^\xff\xbd\x89\x93\xd0i\xf4z\x1f\xb3J\x9e\xa9\x980\xfcJ\xce\xad*r\xd1\x1a\x98\t\xc95!Ol\xe9\xef\xc1oM\xaa\xa3\xc4K\x17\xc5[\x98l\xef\x9c\xf9\xa2pl7C3\\Q\x89`\xe4\xaf\xde\x07E\x87$\xe0\xda?\x96"\xdeg\x1f\xd8T\xccG5\xd4\x93\xe2\xb7(\xcfB0is\xc1a\xaac\xd6\x93\xe6y\xd8g!\x89\\\x02\x1ey\xa05@\x82\xaaK\xbe\xf0.V4\x82d\x7f\xd9\xe0&f.,\xd0GA\xeb\xf0P\xf5c>\x12\x9c\xe3$\x8a5#\xce\xc2\x88\x8d\xf0?3\xe0j\x82\x8b\xcb\xf1q\xf0\x91\x9d-\x1e\xf2\xfde4\xb7\x89\x7f\xff\xf0\xaf\xe3T\xdf\xa4\x99\x08.\xc3V\x0b\xb7\xc1\\\xa7\xd4\xf6D\xbckm(\xb2\xe7\xfd\xf6\xf6\xdd`\x9a`\xbd\xa5\xc6\x0e`\xc0l\xc8I\xcf\x96f\xcdZ\xf3Y\xa8\x0b}W^qf\xf2\x00C9$\x13F\xd3A\xed\xa7`\xef\xd4\x10o\xa8\x04\x81\x05\'%<\xb3\x07\x8d\xbc\xfb\xdax@4\xe1\xd2\xe2\xe0\xb2\xee]\xed\xa6\xeb\x060\x9eY\x9a\x8d\xe1\xec\xb8\x13\xd5MA\xc3\xdf\xe5E\x92\x93\xf2\x06\xe5\xd3\xab{\xab\xdb\x13\x01\xf2u\xe3\xe5')

In addition to the obfuscated code, this will generate the extra Python package pyarmor_runtime_00000, which is required to run the obfuscated code. In this instance, as we have executed the pyarmor gen command in a Windows environment this will generate a .pyd file.

When distributing this code, we need to distribute the entire dist folder not just the obfuscated script as the script depends on the pyarmor_runtime_00000 package. However, the target machine does not need to have the PyArmor installed. The basic Python interpreter can run the obfuscated code directly.

For details on how to obfuscate packages and use advanced features check the PyArmor documentation. One thing to note is some features like irreversible obfuscation methods are not available in the free version of PyArmor and will require a licensed version.

That’s it, you can check the sample code for all the above examples in the BISINET GitHub repository. The nextstep is to start your Python obfuscation journey.

Obfuscating Python Code (2024)
Top Articles
Frequently Asked Questions (FAQs) | Mastercard
PayPal vs. Manual Invoice Payments for B2B eCommerce
Fat Hog Prices Today
The Definitive Great Buildings Guide - Forge Of Empires Tips
Voordelige mode in topkwaliteit shoppen
Bucks County Job Requisitions
Top Financial Advisors in the U.S.
Craigslist In Fredericksburg
Corpse Bride Soap2Day
Decaying Brackenhide Blanket
Fallout 4 Pipboy Upgrades
When Is the Best Time To Buy an RV?
Space Engineers Projector Orientation
Tripadvisor Near Me
123Moviescloud
Slope Unblocked Minecraft Game
Hssn Broadcasts
Summoners War Update Notes
Wgu Admissions Login
O'reilly's Auto Parts Closest To My Location
Mini Handy 2024: Die besten Mini Smartphones | Purdroid.de
ARK: Survival Evolved Valguero Map Guide: Resource Locations, Bosses, & Dinos
3S Bivy Cover 2D Gen
Jalapeno Grill Ponca City Menu
623-250-6295
Kaitlyn Katsaros Forum
Puss In Boots: The Last Wish Showtimes Near Cinépolis Vista
Reptile Expo Fayetteville Nc
Jeffers Funeral Home Obituaries Greeneville Tennessee
Engineering Beauties Chapter 1
Turbo Tenant Renter Login
Anesthesia Simstat Answers
Ups Drop Off Newton Ks
Account Now Login In
Poster & 1600 Autocollants créatifs | Activité facile et ludique | Poppik Stickers
Garrison Blacksmith's Bench
Craigslist Albany Ny Garage Sales
Rise Meadville Reviews
Nacho Libre Baptized Gif
Gold Nugget at the Golden Nugget
450 Miles Away From Me
9781644854013
Troy Gamefarm Prices
Me Tv Quizzes
Peace Sign Drawing Reference
Upcoming Live Online Auctions - Online Hunting Auctions
Guy Ritchie's The Covenant Showtimes Near Look Cinemas Redlands
Game Like Tales Of Androgyny
Parks And Rec Fantasy Football Names
Naughty Natt Farting
Itsleaa
Latest Posts
Article information

Author: Reed Wilderman

Last Updated:

Views: 5962

Rating: 4.1 / 5 (72 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Reed Wilderman

Birthday: 1992-06-14

Address: 998 Estell Village, Lake Oscarberg, SD 48713-6877

Phone: +21813267449721

Job: Technology Engineer

Hobby: Swimming, Do it yourself, Beekeeping, Lapidary, Cosplaying, Hiking, Graffiti

Introduction: My name is Reed Wilderman, I am a faithful, bright, lucky, adventurous, lively, rich, vast person who loves writing and wants to share my knowledge and understanding with you.