Nitro-Generator icon indicating copy to clipboard operation
Nitro-Generator copied to clipboard

Logic?

Open chr3st5an opened this issue 3 years ago • 3 comments

There are so many issues in this code, I am shocked!

First of all, the LICENSE file states out that the given project is licensed under the GNU General Public License v3.0 while the readme.md says it is licensed under the MIT license?

Now, the code itself is full of issues:

  1. PEP8: The code clearly breaks the style convention specified by PEP8

    • inline imports of multiple packages
    • unused import multiprocessing
    • missing 2 empty lines between functions and classes
    • wrong type annotations
      • inconvenient use of type annotations
    • raw except clause
    • and so on
  2. threading.Lock is completely misused

def printer(self, color, status, code):
    threading.Lock().acquire()
    print(f"{color} {status} > {Fore.RESET}discord.gift/{code}")

This code is not thread safe as the Lock is created within that method, which means that different threads will create different Lock instances, making this line of code completely useless. Better would be:

# global variable
lock = threading.Lock()


def safe_print() -> None:
    with lock:
        print("hi")
  1. What is that?
"".join(random.choice("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890") for _ in range(16))

rewrite as:

from string import ascii_letters, digits
import random


"".join(random.choices(ascii_letters + digits, k=16))
  1. Files are opened explicitly with the r parameter although it is the default parameter value

    • open("blah", "r") == open("blah")
  2. Why so much work?

 def proxies_count(self):
        proxies_list = 0
        with open('config/proxies.txt', 'r') as file:
            proxies = [line.strip() for line in file]
        
        for _ in proxies:
            proxies_list += 1
        
        return int(proxies_list)

# Is the same as

def proxy_count(self) -> int:
    with open("config/proxies.txt") as file:
        return len(file.readlines())
  1. Only one thread is running (always one!!!):
threading.Thread(target=DNG.run(), args=()).start()

look at target! You are calling run instead of passing the method itself to target. That means that you execute the method in the current thread instead of the new thread that you are trying to create there, essentially blocking the while loop and hence blocking the creation of new threads.

chr3st5an avatar Sep 15 '22 15:09 chr3st5an

You are an expert!

yrifl avatar Sep 17 '22 14:09 yrifl

this is fake ong

loggerbeamtest avatar Oct 12 '23 11:10 loggerbeamtest

bro 💀

danilwhale avatar Nov 04 '23 13:11 danilwhale