Skip to content

Commit

Permalink
Added logging and cleaned code
Browse files Browse the repository at this point in the history
  • Loading branch information
Oxi committed Oct 9, 2022
1 parent 12a735a commit 93d87b5
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 47 deletions.
Binary file added __pycache__/msg.cpython-310.pyc
Binary file not shown.
117 changes: 70 additions & 47 deletions nglspam.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,45 @@
import json
import random
import time
import json, random, time, httpx, sys, os
from concurrent.futures import ThreadPoolExecutor
import threading
from msg import randomQuestions
try:
import colorama
import httpx
except:
print('Please install colorama by doing pip3 install colorama or pip3 install httpx')
exit()
errored = 0
sent = 0
from colorama import Fore, Style
from time import strftime, gmtime


sent, errored = 0,0
class Console:
@staticmethod
def get_time() -> str:
return time.strftime("%H:%M:%S", time.gmtime())

@staticmethod
def logger(*content: tuple, status: bool) -> None:
lock = threading.Lock()
time = Console.get_time()

green = '['+Fore.GREEN + Style.BRIGHT + '+' + Style.RESET_ALL + '] '
red = '['+Fore.RED + Style.BRIGHT + '-' + Style.RESET_ALL + '] '
yellow = '['+Fore.YELLOW + Style.BRIGHT + '!' + Style.RESET_ALL + '] '
with lock:
if status == 'g':
sys.stdout.write(
f'{Fore.YELLOW}[{time}]{Style.RESET_ALL}{green}{" ".join(content)}\n')
elif status == 'r':
sys.stdout.write(
f'{Fore.YELLOW}[{time}]{Style.RESET_ALL}{red}{" ".join(content)}\n')
elif status == 'y':
sys.stdout.write(
f'{Fore.YELLOW}[{time}]{Style.RESET_ALL}{yellow}{" ".join(content)}\n')

@staticmethod
def clear() -> None:
os.system('cls' if os.name == 'nt' else 'clear')


def main(username, message, deviceid, proxy, proxystatus):
global errored
global sent
green = '['+colorama.Fore.GREEN + colorama.Style.BRIGHT + '+' + colorama.Style.RESET_ALL + '] '
red = '['+colorama.Fore.RED + colorama.Style.BRIGHT + '-' + colorama.Style.RESET_ALL + '] '
yellow = '['+colorama.Fore.YELLOW + colorama.Style.BRIGHT + '!' + colorama.Style.RESET_ALL + '] '

headers = {'Content-Type': 'application/x-www-form-urlencoded', 'Accept-Language':'en-US,en;q=0.5', 'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8', 'User-Agent':'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0'}

with httpx.Client(headers=headers) as client:
Expand All @@ -32,55 +54,56 @@ def main(username, message, deviceid, proxy, proxystatus):
postresp = client.post(f"https://ngl.link/{username}", data={'question': message + 'TROLLEDLOL ' + message, 'deviceId':deviceid})
if postresp.status_code == 302:
sent += 1
print(green + f"Sent {message} to victim, Sent {sent} messages, Errored {errored} messages")
Console.logger(f"Sent {message} to victim, Sent {sent} messages, Errored {errored} messages", status='g')

elif postresp.status_code == 404:
print(red + f"User {username} does not exist")
Console.logger(f"User {username} does not exist", status='r')
exit()
elif postresp.status_code == 429:
print(red + f"User {username} is rate limited")
Console.logger(f"User {username} is rate limited", status='r')


except Exception as e:
errored+=1
print(yellow + f'Error: {e}')
Console.logger(f'Error: {e}', status='y')
main(username, messages(), deviceid(), proxy())


def messages():
return random.choice(randomQuestions)

def proxy():
return 'http://' + random.choice(list(open('proxy.txt')))

def deviceid():
return ''.join(random.choice('0123456789abcdefghijklmnopqrstuvwxyz-') for i in range(36))

question = '[' + colorama.Fore.YELLOW + '?' + colorama.Back.YELLOW + colorama.Style.BRIGHT + colorama.Style.RESET_ALL + '] '
info = question = '[' + colorama.Fore.YELLOW + '!' + colorama.Back.YELLOW + colorama.Style.BRIGHT + colorama.Style.RESET_ALL + '] '
print(colorama.Fore.LIGHTRED_EX + '''
▒█▄░▒█ ▒█▀▀█ ▒█░░░   ▒█▀▀▀█ ▒█▀▀█ ░█▀▀█ ▒█▀▄▀█
▒█▒█▒█ ▒█░▄▄ ▒█░░░   ░▀▀▀▄▄ ▒█▄▄█ ▒█▄▄█ ▒█▒█▒█
▒█░░▀█ ▒█▄▄█ ▒█▄▄█   ▒█▄▄▄█ ▒█░░░ ▒█░▒█ ▒█░░▒█
''' + colorama.Fore.GREEN + 'Made by https://github.com/oxitheman' + '\nStar the repository on github if you like it!' + colorama.Style.RESET_ALL)

print(colorama.Fore.GREEN + colorama.Style.RESET_ALL)
print(info + 'If you would like to send random questions or use proxies edit config.json to true.')
username = str(input( question +"Enter username: "))
threadcount = int(input(question+"Enter thread count: "))
with open('config.json') as config:
data = json.load(config)
proxystatus = data['proxy']
messagestatus = data['random_messages']
delay = data['delay']
if messagestatus == True:
with ThreadPoolExecutor(max_workers=threadcount) as executor:
for x in range(threadcount):
executor.submit(main, username, messages(), deviceid(), proxy(), proxystatus)
else:
message = str(input(question+"Enter message: "))
with ThreadPoolExecutor(max_workers=threadcount) as executor:
for x in range(threadcount):
executor.submit(main, username, message, deviceid(), proxy(), proxystatus)
time.sleep(delay)

def handler():
print(Fore.LIGHTRED_EX + '''
▒█▄░▒█ ▒█▀▀█ ▒█░░░   ▒█▀▀▀█ ▒█▀▀█ ░█▀▀█ ▒█▀▄▀█
▒█▒█▒█ ▒█░▄▄ ▒█░░░   ░▀▀▀▄▄ ▒█▄▄█ ▒█▄▄█ ▒█▒█▒█
▒█░░▀█ ▒█▄▄█ ▒█▄▄█   ▒█▄▄▄█ ▒█░░░ ▒█░▒█ ▒█░░▒█
''' + Fore.GREEN + 'Made by https://github.com/oxitheman' + '\nStar the repository on github if you like it!' + ' If you would like to send random questions or use proxies edit config.json to true.' + Style.RESET_ALL)

username = str(input("Enter username (Along with numbers in their NGL link): "))
threadcount = int(input("Enter thread count: "))
with open('config.json') as config:
data = json.load(config)
proxystatus = data['proxy']
messagestatus = data['random_messages']
delay = data['delay']
if messagestatus == True:
with ThreadPoolExecutor(max_workers=threadcount) as executor:
for x in range(threadcount):
executor.submit(main, username, messages(), deviceid(), proxy(), proxystatus)
else:
message = str(input("Enter message: "))
with ThreadPoolExecutor(max_workers=threadcount) as executor:
for x in range(threadcount):
executor.submit(main, username, message, deviceid(), proxy(), proxystatus)
time.sleep(delay)

Console.logger(f'Sent {sent} messages to {username}.', status='g')

print(info + f'Sent {sent} messages to {username}.')
if __name__ == '__main__':
handler()

0 comments on commit 93d87b5

Please sign in to comment.