Navigation X
ALERT
Click here to register with a few steps and explore all our cool stuff we have to offer!

cracked.io | Best Forum Around | Free Premium Accounts




 3936

What's the best way to obfuscate python code?

by Quessts - 21 September, 2020 - 07:06 PM
This post is by a banned member (Quessts) - Unhide
Quessts  
Supreme
1.228
Posts
317
Threads
4 Years of service
#9
(21 September, 2020 - 09:19 PM)ebp Wrote: Show More
(21 September, 2020 - 08:55 PM)Quessts Wrote: Show More
(21 September, 2020 - 08:51 PM)ebp Wrote: Show More
:monkas: if your files that big then your code must be awful, how many imports does it have?  from python import *  kek

Nope its a really big file. It has over 50 modules for checkers. It also has selenium web driver so that's a lot I guess

so its just a ton of shit crammed into one file? id take a look at the imports im sure you could reduce your total imports to 8 max if you post your import list i can help with that

yeah its these imports
Code:
 
from selenium import webdriver
import sys
import chromedriver_binary
from os import system, name
import os
from selenium import webdriver
import os.path
import warnings
import pyfiglet
from time import sleep
from colorama import Fore, init
init()
from sys import stdout
init(convert=True)
This post is by a banned member (ebp) - Unhide
This post is by a banned member (Quessts) - Unhide
Quessts  
Supreme
1.228
Posts
317
Threads
4 Years of service
#11
(21 September, 2020 - 10:40 PM)ebp Wrote: Show More
(21 September, 2020 - 10:05 PM)Quessts Wrote: Show More
(21 September, 2020 - 09:19 PM)ebp Wrote: Show More
so its just a ton of shit crammed into one file? id take a look at the imports im sure you could reduce your total imports to 8 max if you post your import list i can help with that

yeah its these imports
Code:
 
from selenium import webdriver
import sys
import chromedriver_binary
from os import system, name
import os
from selenium import webdriver
import os.path
import warnings
import pyfiglet
from time import sleep
from colorama import Fore, init
init()
from sys import stdout
init(convert=True)

Dont do
Code:
from module import blahblahblah
this just creates namespaces and will increase your file size for example why write:
Code:
from os import system, name
import os
just write import os 
also remove colorama if you need to do color in python  use the anscii color codes 
Code:
import os.path
import warnings
also un-needed as mentioned before. No need to have the warnings library and why import os.path if you are already importing os
Code:
from selenium import webdriver
import sys
import chromedriver_binary
from os import system, name
import os
from selenium import webdriver
why do you import webdriver twice. Also ive never needed to sue chromedriver_binary for python so I cant comment on wether its needed or not however if its what the name suggests you should have the chromedriver binaries added to path preferably or have them in a local folder.

Also whats the usage of sys? If you send me the full code in pastebin I am sure I can help optimize the code more.

For some reason it sometimes glitches and doesn't work I have the same format for every module I'll send you the code in a pm

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
or
Sign in
Already have an account? Sign in here.


Forum Jump:


Users browsing this thread: 1 Guest(s)