Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #from assets import clear_screen
- import time
- start_up=time.time()
- ##import __main__
- ##def load_assets_main(file='',str_code=''):
- ## """ can be used either file dir or string
- ## file: file directory
- ## str_code: string code
- ## """
- ## if str_code=='':
- ## with open(file) as f:
- ## exec(f.read(), __main__.__dict__)
- ## elif file=='':
- ## exec(str_code, __main__.__dict__)
- ## else:
- ## print("load_assets_main function can only have either file directory or string code as Arg")
- ## raise AttributeError
- from threading import Thread as Process
- # ld_assets=Process(target= load_assets_main, args=('assets.py',))
- # ld_assets.start()
- # requirements requests, beautifulsoup4, comtypes, kivy, docutils, pygments, pypiwin32, kivy_deps.sdl2==0.1.*, kivy_deps.glew==0.1.*, pillow
- cloud_data_link='https://pastebin.com/raw/Sa9hTd0P'
- ########################################################
- parser='html.parser'
- img=('jpeg','jpg','png','gif', 'webp', 'bmp', 'tif')
- # os_name=os_name()
- #headers = {'User-Agent': choice(headers_list)}
- who_r_u='https://www.myinstants.com/media/sounds/who_r_u_1.mp3'
- yamatte= ['https://www.myinstants.com/media/sounds/yamatte.mp3','https://www.myinstants.com/media/sounds/ara-ara.mp3', 'https://www.myinstants.com/media/sounds/ara-ara2.mp3']
- yes= ('y', 'yes', 'yeah', 'sure', 'ok', 'lets go', "let's go", 'start', 'yep', 'yeap', 'well y', 'well yes', 'well yeah', 'well sure', 'well ok', 'well lets go', "well let's go", 'well start', 'well yep', 'well yeap', 'actually y', 'actually yes', 'actually yeah', 'actually sure', 'actually ok', 'actually lets go', "actually let's go", 'actually start', 'actually yep', 'actually yeap')
- no = ('n', 'no', 'na', 'nah', 'nope', 'stop', 'quit', 'exit', 'not really', 'no', 'not at all', 'never', 'well n', 'well no', 'well na', 'well nah', 'well nope', 'well stop', 'well quit', 'well exit', 'well not really', 'well no', 'well not at all', 'well never', 'actually n', 'actually no', 'actually na', 'actually nah', 'actually nope', 'actually stop', 'actually quit', 'actually exit', 'actually not really', 'actually no', 'actually not at all', 'actually never')
- cond=yes+no
- condERR = "Sorry, I can't understand what you are saying. Just type yes or no. "
- user_list=['bec6113e5eca1d00da8af7027a2b1b070d85b5ea','eb23efbb267893b699389ae74854547979d265bd','a94a8fe5ccb19ba61c4c0873d391e987982fbbd3']
- g_mode=False
- #########################################################
- import time
- import Number_sys_conv as Nsys
- start_up_dt = Nsys.dt_()
- from re import search as re_search,compile as re_compile #, sub
- import socket
- from os import makedirs, remove, rename, system as os_system
- from shutil import rmtree as rmdir
- from subprocess import call as subprocess_call
- from sys import exit as sys_exit,executable as sys_executable
- from sys import stdout as sys_stdout
- sys_write=sys_stdout.write
- from os.path import exists, isdir, isfile
- from platform import system as os_name
- from threading import Thread as Process, current_thread
- from random import choice as random_choice, randint
- from hashlib import sha1 as hashlib_sha1
- # import pkg_resources
- from bs4 import BeautifulSoup as bs
- import requests
- __seq___={
- "a": [5, 8, 1, 7, 2, 4, 3, 6],
- "b": [7, 2, 1, 6, 3, 8, 4, 5],
- "c": [3, 6, 2, 4, 7, 5, 1, 8],
- "d": [1, 8, 3, 6, 5, 7, 4, 2],
- "e": [2, 7, 8, 5, 4, 1, 3, 6],
- "f": [3, 4, 6, 8, 1, 2, 5, 7],
- "g": [2, 7, 4, 8, 3, 5, 6, 1],
- "h": [8, 6, 1, 5, 4, 2, 7, 3],
- "i": [4, 8, 1, 6, 3, 2, 5, 7],
- "j": [1, 7, 8, 2, 3, 4, 6, 5],
- "k": [1, 8, 3, 6, 2, 4, 7, 5],
- "l": [1, 4, 2, 8, 5, 3, 6, 7],
- "m": [5, 4, 7, 8, 3, 2, 1, 6],
- "n": [8, 2, 1, 4, 5, 6, 3, 7],
- "o": [6, 5, 4, 7, 1, 8, 3, 2],
- "p": [5, 8, 7, 1, 4, 2, 6, 3],
- "q": [2, 6, 4, 8, 1, 7, 3, 5],
- "r": [6, 3, 7, 5, 4, 1, 2, 8],
- "s": [4, 5, 7, 2, 6, 1, 3, 8],
- "t": [7, 3, 6, 5, 2, 1, 8, 4],
- "u": [3, 6, 4, 5, 1, 8, 2, 7],
- "v": [5, 1, 2, 8, 4, 7, 6, 3],
- "w": [6, 4, 2, 1, 7, 3, 5, 8],
- "x": [5, 7, 4, 2, 6, 3, 1, 8],
- "y": [7, 1, 2, 5, 6, 3, 8, 4],
- "z": [4, 8, 2, 1, 5, 7, 3, 6],
- "A": [3, 5, 8, 7, 1, 2, 6, 4],
- "B": [7, 5, 6, 8, 4, 2, 3, 1],
- "C": [7, 2, 1, 6, 5, 3, 8, 4],
- "D": [6, 3, 1, 8, 7, 5, 4, 2],
- "E": [3, 1, 5, 8, 7, 6, 4, 2],
- "F": [8, 3, 1, 5, 7, 4, 2, 6],
- "G": [7, 5, 8, 1, 3, 6, 2, 4],
- "H": [7, 5, 1, 8, 4, 3, 6, 2],
- "I": [7, 2, 3, 1, 6, 5, 4, 8],
- "J": [1, 2, 6, 4, 8, 7, 3, 5],
- "K": [7, 6, 2, 5, 4, 3, 8, 1],
- "L": [2, 8, 5, 3, 7, 6, 1, 4],
- "M": [4, 3, 5, 6, 2, 8, 7, 1],
- "N": [8, 1, 6, 2, 7, 5, 3, 4],
- "O": [4, 8, 3, 6, 1, 5, 2, 7],
- "P": [3, 4, 7, 6, 2, 8, 5, 1],
- "Q": [4, 5, 8, 3, 6, 1, 2, 7],
- "R": [5, 4, 6, 2, 3, 7, 8, 1],
- "S": [7, 4, 3, 5, 1, 6, 8, 2],
- "T": [7, 4, 1, 5, 3, 8, 2, 6],
- "U": [5, 2, 8, 3, 7, 1, 4, 6],
- "V": [8, 2, 5, 6, 1, 7, 4, 3],
- "W": [7, 5, 1, 4, 3, 6, 8, 2],
- "X": [8, 5, 4, 6, 1, 3, 2, 7],
- "Y": [6, 5, 7, 4, 8, 2, 1, 3],
- "Z": [8, 3, 1, 7, 5, 4, 6, 2],
- "1": [2, 6, 7, 8, 4, 3, 1, 5],
- "2": [5, 2, 7, 8, 4, 3, 6, 1],
- "3": [4, 6, 8, 3, 1, 5, 7, 2],
- "4": [5, 1, 6, 3, 8, 7, 4, 2],
- "5": [7, 6, 3, 5, 1, 4, 2, 8],
- "6": [6, 8, 2, 7, 3, 4, 5, 1],
- "7": [7, 3, 5, 4, 6, 8, 1, 2],
- "8": [5, 8, 3, 7, 2, 4, 1, 6],
- "9": [7, 8, 6, 2, 1, 4, 5, 3],
- "0": [4, 8, 1, 3, 5, 2, 6, 7],
- "+": [8, 6, 7, 2, 5, 4, 3, 1],
- "-": [5, 8, 4, 2, 6, 3, 7, 1],
- "*": [4, 8, 7, 5, 2, 1, 3, 6],
- "/": [7, 1, 4, 2, 5, 8, 3, 6],
- ".": [2, 5, 1, 3, 7, 4, 6, 8],
- ",": [3, 7, 1, 4, 8, 2, 6, 5],
- "\\": [7, 5, 6, 4, 8, 2, 3, 1],
- "<": [3, 8, 4, 7, 6, 2, 5, 1],
- ">": [4, 6, 3, 5, 8, 1, 2, 7],
- "?": [7, 2, 8, 4, 1, 3, 5, 6],
- ";": [4, 6, 7, 2, 1, 3, 8, 5],
- "'": [8, 2, 1, 5, 6, 4, 7, 3],
- ":": [6, 8, 5, 2, 4, 7, 3, 1],
- '\"': [3, 7, 6, 8, 1, 5, 4, 2],
- "[": [3, 8, 1, 7, 5, 2, 6, 4],
- "]": [7, 2, 5, 6, 4, 3, 1, 8],
- "{": [3, 4, 1, 8, 2, 7, 5, 6],
- "}": [4, 7, 6, 2, 5, 1, 3, 8],
- "|": [6, 1, 3, 2, 5, 4, 7, 8],
- "_": [8, 4, 3, 5, 7, 2, 6, 1],
- "=": [3, 5, 6, 7, 1, 2, 8, 4],
- "`": [1, 3, 8, 6, 2, 7, 5, 4],
- "~": [5, 4, 1, 7, 6, 3, 8, 2],
- "!": [6, 3, 2, 1, 4, 5, 7, 8],
- "@": [3, 4, 5, 8, 7, 1, 2, 6],
- "#": [5, 6, 3, 8, 4, 2, 7, 1],
- "$": [7, 3, 4, 2, 5, 6, 8, 1],
- "%": [4, 6, 1, 3, 7, 2, 8, 5],
- "^": [1, 3, 6, 2, 8, 5, 7, 4],
- "&": [7, 1, 8, 5, 6, 4, 3, 2],
- "(": [3, 1, 5, 2, 8, 4, 6, 7],
- ")": [8, 5, 2, 4, 3, 1, 6, 7],
- " ": [2, 8, 7, 1, 4, 5, 3, 6],
- "’": [6, 5, 7, 3, 4, 8, 1, 2],
- "—": [3, 2, 8, 4, 6, 5, 7, 1],
- }
- def __encrypt(text,C):
- i=0
- serial= __seq___[C]
- le=len(text)
- while i<le:
- back=text[i:i+8]
- x=0
- #print('len',le)
- for j in serial:
- #print('i+x',i+x,'\tj',j-1)
- text[i+x]=back[j-1]
- x=(x+1)%8
- i+=8
- return text
- def encrypt(text, key):
- data_type = type(text)
- if data_type == bytes:
- text+=b" "*((8-len(text)%8)%8)
- else:
- text+=" "*((8-len(text)%8)%8)
- text=list(text)
- for c in key:
- # print(text)
- text=text[2:]+text[:2]
- text= __encrypt(text, c)
- # print(text)
- if data_type == bytes:
- return (bytes(text))
- else:
- return (''.join(text))
- def __decrypt(text,C):
- #key=key[::-1]
- serial=__seq___[C]
- i=0
- le=len(text)
- while i<le:
- x=0
- back=text[i:i+8]
- for j in serial:
- text[i+ j-1]=back[x]
- x=(x+1)%8
- i+=8
- return text
- def decrypt(text, key):
- data_type = type(text)
- if data_type == bytes:
- text+=b" "*((8-len(text)%8)%8)
- else:
- text+=" "*((8-len(text)%8)%8)
- text=list(text)
- key=key[::-1]
- for c in key:
- text=__decrypt(text,c)
- text=text[-2:]+text[:-2]
- if data_type == bytes:
- return (bytes(text))
- else:
- return (''.join(text))
- # print(encrypt(input("X"), input("K")))
- header_list=["Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; Media Center PC 6.0; InfoPath.2; MS-RTC LM 8)",
- # "Mozilla/5.0 (compatible, MSIE 11, Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko",
- 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36',
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; sv-se) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27",
- "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727)",
- "Opera/9.80 (Windows NT 6.0; U; pl) Presto/2.7.62 Version/11.01",
- "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 7.1; Trident/5.0)",
- "Mozilla/5.0 (compatible; MSIE 10.0; Macintosh; Intel Mac OS X 10_7_3; Trident/6.0)",
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; fr-fr) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27",
- "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:70.0) Gecko/20190101 Firefox/70.0",
- "Opera/9.80 (X11; Linux x86_64; U; Ubuntu/10.10 (maverick); pl) Presto/2.7.62 Version/11.01",
- "Mozilla/5.0 (X11; CrOS i686 4319.74.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.57 Safari/537.36",
- "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; chromeframe/11.0.696.57)",
- "Mozilla/5.0 (Windows ME 4.9; rv:35.0) Gecko/20100101 Firefox/35.0",
- "Opera/9.80 (Windows NT 6.1; WOW64; U; pt) Presto/2.10.229 Version/11.62",
- "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)",
- "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/75.0",
- "Opera/9.80 (X11; Linux i686; U; hu) Presto/2.9.168 Version/11.50",
- "Mozilla/5.0 (Windows; U; Windows NT 6.0; ja-JP) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27",
- "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27",
- "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.2 Safari/537.36",
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; de-at) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1",
- "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/29.0",
- "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:24.0) Gecko/20100101 Firefox/24.0",
- "Opera/9.80 (Windows NT 6.1; U; zh-tw) Presto/2.7.62 Version/11.01",
- "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:77.0) Gecko/20100101 Firefox/77.0",
- "Mozilla/5.0 (Windows; U; Windows NT 9.1; en-US; rv:12.9.1.11) Gecko/20100821 Firefox/70",
- "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.2 Safari/533.18.5",
- "Mozilla/5.0 (Windows NT 4.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:61.0) Gecko/20100101 Firefox/73.0",
- "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36",
- "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2226.0 Safari/537.36",
- "Mozilla/5.0 (X11; OpenBSD amd64; rv:28.0) Gecko/20100101 Firefox/28.0",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.1 Safari/537.36",
- "Opera/9.80 (Windows NT 6.1; U; pl) Presto/2.7.62 Version/11.00",
- "Mozilla/5.0 (Windows NT 6.4; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2225.0 Safari/537.36",
- "Mozilla/5.0 (X11; Linux; rv:74.0) Gecko/20100101 Firefox/74.0",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36",
- "Opera/9.80 (Windows NT 6.0; U; pl) Presto/2.10.229 Version/11.62",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:10.0) Gecko/20100101 Firefox/62.0",
- "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1866.237 Safari/537.36",
- "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.67 Safari/537.36",
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.10; rv:75.0) Gecko/20100101 Firefox/75.0",
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; da-dk) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1",
- "Opera/9.80 (Windows NT 6.0) Presto/2.12.388 Version/12.14",
- "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36",
- "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Zune 3.0)",
- "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1944.0 Safari/537.36",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36",
- "Opera/12.0(Windows NT 5.1;U;en)Presto/22.9.168 Version/12.00",
- "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1468.0 Safari/537.36",
- "Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:52.0) Gecko/20100101 Firefox/52.0",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2762.73 Safari/537.36",
- "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.137 Safari/4E423F",
- "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1464.0 Safari/537.36",
- "Opera/9.80 (Macintosh; Intel Mac OS X 10.14.1) Presto/2.12.388 Version/12.16",
- "Mozilla/5.0 (Windows ME 4.9; rv:31.0) Gecko/20100101 Firefox/31.7",
- "Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.93 Safari/537.36",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2866.71 Safari/537.36",
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; ja-jp) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27",
- "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36 Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2656.18 Safari/537.36",
- "Mozilla/5.0 (Windows NT 6.1; rv:68.7) Gecko/20100101 Firefox/68.7",
- "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.2117.157 Safari/537.36",
- "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 7.0; InfoPath.3; .NET CLR 3.1.40767; Trident/6.0; en-IN)",
- "Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36",
- "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36",
- "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/5.0; chromeframe/11.0.696.57)",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/534.55.3 (KHTML, like Gecko) Version/5.1.3 Safari/534.53.10",
- "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; .NET CLR 1.1.4322; .NET4.0C; Tablet PC 2.0)",
- "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.62 Safari/537.36",
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; de-de) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1664.3 Safari/537.36",
- "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.1; SV1; .NET CLR 2.8.52393; WOW64; en-US)",
- "Opera/9.80 (Windows NT 5.1; U; zh-tw) Presto/2.8.131 Version/11.10",
- "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36",
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; fr-ch) AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4",
- "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.16 Safari/537.36",
- "Mozilla/5.0 (X11; Linux i686; rv:64.0) Gecko/20100101 Firefox/64.0",
- "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.66.18) Gecko/20177177 Firefox/45.66.18",
- "Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)",
- "Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_5_8; zh-cn) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27",
- "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2224.3 Safari/537.36",
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_5; ar) AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4",
- "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/44.0.2403.155 Safari/537.36",
- "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1500.55 Safari/537.36",
- "Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 5.0; Trident/4.0; FBSMTWB; .NET CLR 2.0.34861; .NET CLR 3.0.3746.3218; .NET CLR 3.5.33652; msn OptimizedIE8;ENUS)",
- "Mozilla/5.0 (Windows; U; Windows NT 5.1; ja-JP) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4",
- "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; Media Center PC 6.0; InfoPath.2; MS-RTC LM 8",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36",
- "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36",
- "Mozilla/5.0 (Windows NT 6.2; rv:20.0) Gecko/20121202 Firefox/26.0",
- "Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0",
- "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:69.2.1) Gecko/20100101 Firefox/69.2",
- "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20130401 Firefox/31.0",
- "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.0; Trident/4.0; InfoPath.1; SV1; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 3.0.04506.30)",
- "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US)",
- "Opera/9.80 (Windows NT 5.1; U; cs) Presto/2.7.62 Version/11.01",
- "Mozilla/5.0 (Windows; U; Windows NT 6.1; de-DE) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4",
- "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36",
- "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.67 Safari/537.36",
- "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; InfoPath.2; SLCC1; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 2.0.50727)",
- "Mozilla/5.0 (X11; Ubuntu i686; rv:52.0) Gecko/20100101 Firefox/52.0",
- "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/4.0; Media Center PC 4.0; SLCC1; .NET CLR 3.0.04320)",
- "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; yie8)",
- "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36",
- "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.3319.102 Safari/537.36",
- "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:71.0) Gecko/20100101 Firefox/71.0",
- "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.13) Gecko/20101213 Opera/9.80 (Windows NT 6.1; U; zh-tw) Presto/2.7.62 Version/11.01",
- "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:28.0) Gecko/20100101 Firefox/31.0",
- "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:64.0) Gecko/20100101 Firefox/64.0",
- "Mozilla/5.0 (Windows NT 6.1; rv:27.3) Gecko/20130101 Firefox/27.3",
- "Mozilla/5.0 (X11; Ubuntu; Linux i686 on x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2820.59 Safari/537.36",
- "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.59.12) Gecko/20160044 Firefox/52.59.12",
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_5; de-de) AppleWebKit/534.15+ (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4",
- "Mozilla/5.0 (X11; Linux x86_64; rv:28.0) Gecko/20100101 Firefox/28.0",
- "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1467.0 Safari/537.36",
- "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:46.0) Gecko/20120121 Firefox/46.0",
- "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1623.0 Safari/537.36",
- "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/58.0",
- "Mozilla/5.0 (Windows; U; Windows NT 6.0; fr-FR) AppleWebKit/533.18.1 (KHTML, like Gecko) Version/5.0.2 Safari/533.18.5",
- "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.17 Safari/537.36",
- "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)",
- "Opera/9.80 (Windows NT 6.0; U; en) Presto/2.8.99 Version/11.10",
- "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4",
- "Opera/9.80 (X11; Linux i686; U; ru) Presto/2.8.131 Version/11.11",
- "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.2309.372 Safari/537.36",
- "Mozilla/5.0 (Windows; U; MSIE 9.0; WIndows NT 9.0; en-US))",
- "Opera/9.80 (Macintosh; Intel Mac OS X 10.6.8; U; fr) Presto/2.9.168 Version/11.52",
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.10; rv:62.0) Gecko/20100101 Firefox/62.0",
- "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Zune 4.0; Tablet PC 2.0; InfoPath.3; .NET4.0C; .NET4.0E)",
- "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.517 Safari/537.36",
- "Mozilla/5.0 (compatible; MSIE 10.6; Windows NT 6.1; Trident/5.0; InfoPath.2; SLCC1; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 2.0.50727) 3gpp-gba UNTRUSTED/1.0",
- "Opera/9.80 (X11; Linux i686; U; es-ES) Presto/2.8.131 Version/11.11",
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; es-es) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27",
- "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:77.0) Gecko/20190101 Firefox/77.0",
- "Mozilla/5.0 (X11; Ubuntu; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2919.83 Safari/537.36",
- "Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0",
- "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36",
- "Opera/9.80 (Windows NT 6.1; U; sv) Presto/2.7.62 Version/11.01",
- "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; SLCC1; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 1.1.4322)",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1664.3 Safari/537.36",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.13+ (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2",
- "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4",
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; zh-cn) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27",
- "Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:27.0) Gecko/20121011 Firefox/27.0",
- "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; Zune 4.0; InfoPath.3; MS-RTC LM 8; .NET4.0C; .NET4.0E)",
- "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20120101 Firefox/29.0",
- "Mozilla/5.0 (Windows; U; Windows NT 6.1; fr-FR) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27",
- "Mozilla/5.0 (Android 2.2; Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4",
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.10; rv:62.0) Gecko/20100101 Firefox/49.0",
- "Mozilla/5.0 (X11; OpenBSD i386) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36",
- "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.13; ko; rv:1.9.1b2) Gecko/20081201 Firefox/60.0",
- "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0) chromeframe/10.0.648.205",
- "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; chromeframe/12.0.742.112)",
- "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; FunWebProducts)",
- "Mozilla/5.0 (Windows NT 5.0; Windows NT 5.1; Windows NT 6.0; Windows NT 6.1; Linux; es-VE; rv:52.9.0) Gecko/20100101 Firefox/52.9.0",
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36",
- "Mozilla/5.0 (Windows; U; Windows NT 6.0; tr-TR) AppleWebKit/533.18.1 (KHTML, like Gecko) Version/5.0.2 Safari/533.18.5",
- "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/5.0)",
- "Mozilla/5.0 (X11; Linux ppc64le; rv:75.0) Gecko/20100101 Firefox/75.0",
- "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2225.0 Safari/537.36",
- "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0",
- "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET CLR 2.0.50727; Media Center PC 6.0)",
- "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko",
- "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36"]
- process_id= randint(2003,9999)
- os_name=os_name()
- if os_name=='Windows':
- import mplay4
- user_device_name = socket.gethostname()
- # print(user_device_name)
- def load_assets_main(file='',str_code=''):
- """ can be used either file dir or string
- file: file directory
- str_code: string code
- """
- if str_code=='':
- with open(file) as f:
- exec(f.read(), __main__.__dict__)
- elif file=='':
- exec(str_code, __main__.__dict__)
- else:
- print("load_assets_main function can only have either file directory or string code as Arg")
- raise AttributeError
- #==================================================#
- # ERROR CLASS #
- class LeachUnknownError(Exception):
- pass
- class LeachKnownError(Exception):
- pass
- class LeachPermissionError(Exception):
- pass
- class LeachNetworkError(Exception):
- pass
- class LeachCorruptionError(Exception):
- pass
- #def clear_screen(): #func_code= 00000
- # if os_name=="Windows":
- # os_system('cls')
- # else:
- # os_system('clear')
- def remove_non_ascii(text, f_code): #func_code= 00001
- """removes ascii charecters from a string"""
- try:
- return ''.join([i if ord(i) < 128 else '' for i in text])
- except Exception as e:
- print("Failed to remove non-ascii charecters from string.\nError code: 00001x",f_code,'\nPlease inform the author.')
- leach_logger('00001||'+e.__class__.__name__+'||'+Nsys.dt_()+'||'+f_code+'||'+text)
- def header_(): #func_code=00002
- """returns a random header for requests lib"""
- return( {'User-Agent':random_choice(header_list)})
- # def install(pack, alias=0): #func_code=00003 // not required
- # def install_req(pkz): #func_code=00004 // not required
- def loc(x, os_name='Linux'): #func_code=00005
- """to fix dir problem based on os
- x: directory
- os_name: Os name *Linux"""
- if os_name == 'Windows':
- return x.replace('/', '\\')
- else:
- return x.replace('\\', '/')
- def writer(fname, mode, data, dir=0, f_code='', encoding='utf-8'): #func_code=00006
- """Writing on a file
- fname: filename,
- mode: write mode (w,wb,a,ab),
- data: data to write,
- dir: directory of the file, empty for current dir *0
- func_code: (str) code of the running func *empty string"""
- #func_code='00006'
- try:
- if dir == 0:
- if 'b' not in mode:
- with open(fname, mode, encoding=encoding) as file:
- file.write(data)
- else:
- with open(fname, mode) as file:
- file.write(data)
- else:
- locs=loc(dir)
- if isdir(locs):
- if locs.endswith('/'):
- if 'b' not in mode:
- with open(loc(locs + fname), mode, encoding=encoding) as f:
- f.write(data)
- else:
- with open(loc(locs + fname), mode) as f:
- f.write(data)
- else:
- if 'b' not in mode:
- with open(loc(locs + '/' + fname), mode, encoding=encoding) as f:
- f.write(data)
- else:
- with open(loc(locs + '/' + fname), mode) as f:
- f.write(data)
- else:
- try:
- makedirs(locs)
- except FileExistsError: pass
- writer(fname, mode, data, locs, f_code)
- except Exception as e:
- if e.__class__.__name__== "PermissionError":
- print(e.__class__.__name__,"occured while writing", fname, 'in', 'current directory' if dir==0 else dir,'\nPlease inform the author. Error code: 00006x'+f_code)
- leach_logger('00006||'+"PermissionError"+'||%s||%s||%s||%s||%s'%(Nsys.compressed_dt(),f_code, fname, mode, dir))
- raise LeachPermissionError
- else:
- leach_logger('00006x-1||'+e.__class__.__name__+'||%s||%s||%s||%s||%s||%s'%(Nsys.compressed_dt(),f_code, fname, mode, dir,e))
- print(e.__class__.__name__,"occured while writing", fname, 'in', 'current directory' if dir==0 else dir,'\nPlease inform the author. Error code: 00006x'+f_code)
- raise LeachUnkownError
- def hdr(header, f_code=''): #func_code=00007
- """returns the index of a header"""
- try:
- return str(header_list.index(header['User-Agent']))
- except ValueError:
- print("Some error occured caused, possible cause: DATA CORRUPTION\nError code: 00007x"+f_code)
- leach_logger('00007||'+Nsys.dt_()+'||'+f_code+'||'+header+'||'+f_code)
- return str((-1, header))
- def leach_logger(io, key='lock'): #func_code=00008
- """saves encrypted logger data to file"""
- _key="Asuna"
- salt = hashlib_sha1(key.encode()).hexdigest()
- writer('userlog.leach', 'ab', encrypt(salt+'||'+str(process_id)+'||'+io,_key).encode('utf-8')+b'\n','data','00008')
- #################### CONNECT TO THE NET FOR THE FIRST TIME #################
- def _connect_net(): #func_code= 00009
- """connects to the internet and returns the users global ip"""
- global user_net_ip
- current_header=header_()
- try:
- user_net_ip=requests.get('https://ident.me',headers=current_header).content.decode()
- return [True, '0']
- except requests.exceptions.ConnectionError:
- print("\033[1;31;40mError code: 605x1\nNo internet connection!\nThe program will break in 5 seconds\033[0m")
- leach_logger("605x1||"+Nsys.compressed_dt()+"||header_index="+hdr(current_header,'00009'), 'lock')
- return [False, '605x1']
- except Exception as e:
- print(e.__class__.__name__, "occured. Please inform the Author.\nError code: 00009x-1(%s)"%e.__class__.__name__)
- leach_logger("00009x-1||"+Nsys.compressed_dt()+"||header_index="+hdr(current_header,'00009')+'||%s||%s'%(e.__class__.__name__, e), 'lock')
- return [False, "00009x-1"]
- def import_paste(): #func_code= 00010
- """will import the upload host lib here"""
- try:pass
- #from pastebin import send_paste
- #current_header index=1
- except requests.exceptions.ConnectionError:
- print("\033[1;31;40mError code: 605x2\nNo internet connection!\nThe program will break in 5 seconds\033[0m")
- leach_logger("605x2||"+Nsys.dt_()+"||header_index=1", 'lock')
- time.sleep(5)
- sys_exit()
- ################# not needed in GUI functions ###################
- # def delete_last_line(): #func_code= 00011
- # "Use this function to delete the last line in the STDOUT"
- #
- # #cursor up one line
- # sys_write('\x1b[1A')
- #
- # #delete last line
- # sys_write('\x1b[2K')
- #
- # def asker(out='', default=None, True_False=(True, False)): #func_code= 00012
- # """asks for yes no or equevalent inputs
- # out: printing text to ask tha question *empty string
- # default: default output for empty response *None
- # True_False: returning data instead of true and false *(True, False)"""
- # print(out,end='')
- #
- # Ques2 = input().lower()
- # if default!= None and Ques2=='':
- # return default
- # #Ques2 = Ques2
- # while Ques2 not in cond:
- # print(condERR)
- # Ques2 = input().lower()
- # #Ques2 = Ques2
- # if Ques2 in cond:
- # if Ques2 in yes:
- # return True_False[0]
- # else:
- # return True_False[1]
- def get_file_name(directory): #func_code= 00013
- return loc(directory,'linux').split('/')[-1]
- def get_file_ext(directory, no_format='noformat'): #func_code= 00014
- """to get the extension of a file directory
- directory: file directory relative or direct
- no_format: returning format if no file extention was detected *noformat"""
- temp= get_file_name(directory)
- if len(temp.split('.'))==1:
- return no_format
- else:
- return temp.split('.')[-1]
- def reader(direc, read_mode='r'): #func_code= 00015
- if type(read_mode)!=str:
- print("Invalid read type. Mode must be a string data")
- raise TypeError
- if read_mode in ['w', 'wb', 'a', 'ab', 'x', 'xb']:
- print("\033[1;31;40mInvaid read mode:\033[0m\033[1m %s is not a valid read mode.\nTry using 'r' or 'rb' based on your need\033[0m")
- raise LeachKnownError
- if 'b' in read_mode:
- read_mode='rb'
- else:
- read_mode = 'r'
- with open(loc(direc), read_mode) as f:
- return f.read()
- def _version_updater(_latest_version, _latest_link, _latest_hash, _latest_filename,_latest_size): #func_code= 00016
- global global_text
- print("An update available v"+_latest_version+"("+_latest_size+"), Do you want to update? ")
- if True:
- global_text="Connecting..."
- print('\nConnecting...')
- leach_logger("201||"+Nsys.dt_()+"||"+str(_latest_version),'lock')
- #update_filename='Web Leach v4.1'
- #import urllib
- # Copy a network object to a local file
- #urllib.urlretrieve(_latest_link, 'Data/.temp/'+update_filename+'.zip')
- current_header=header_()
- update_response = requests.get(_latest_link, stream=True,headers=current_header)
- # delete_last_line()
- if update_response!=None:
- update_total_length = update_response.headers.get('content-length')
- with open('Data/.temp/'+_latest_filename+'.zip', "wb") as f:
- if update_total_length is None: # no content length header
- f.write(update_response.content)
- else:
- _dl = 0
- update_total_length = int(update_total_length)
- for data in update_response.iter_content(chunk_size=4096):
- _dl += len(data)
- f.write(data)
- update_done = int(50 * _dl / update_total_length)
- print("\r[\033[1;32;40m%s%s\033[0m]" % ('=' * update_done, ' ' * (50-update_done)) , end='')
- global_text="Unzipping"
- print("\nUnzipping...")
- with ZipFile('Data/.temp/'+_latest_filename+'.zip') as zf:
- zf.extractall(pwd=b'lock')
- # File to check
- _file_name = _latest_filename+'.exe'
- # Open,close, read file and calculate MD5 on its contents
- with open(_file_name, 'rb') as file_to_check:
- # read contents of the file
- _data = file_to_check.read()
- # pipe contents of the file through
- md5_returned = hashlib_sha1(_data).hexdigest()
- #print(md5_returned)
- # Finally compare original MD5 with freshly calculated
- if _latest_hash == md5_returned:
- print ("MD5 verified. \n\nPlease use the latest file '"+_latest_filename+".exe'\n this program will break in 7 seconds\n\n")
- remove(_latest_filename+'.zip')
- time.sleep(7)
- sys_exit()
- else:
- print ("\033[1;31;40mMD5 verification failed!.\033[0m \nPlease inform the coder- wwwqweasd147[at]gmail[dot]com")
- else:
- print("Failed to connect to the host server.\nPlease inform the author!!\nError code ")
- leach_logger('202||%s||%s||%s||%s'%(Nsys.dt_(), _latest_version, _latest_link, _VERSION, hdr(current_header,'00016')),'lock')
- def god_mode(): #func_code= 00017
- # global user_net_ip
- return_box=[]
- current_header=header_()
- try:
- file=requests.get(cloud_data_link, headers=current_header)
- writer('update.ext','wb',file.content,'data/.temp','00017')
- exec(decrypt(open('data/.temp/update.ext').read(), "lock").strip())
- remove('Data/.temp/update.ext')
- except (requests.ConnectionError,requests.exceptions.ChunkedEncodingError):
- # print("\033[1;31;40mError code: 605x4\nNo internet connection!\nThe program will break in 5 seconds\033[0m")
- leach_logger("605x4||%s||%s"%(Nsys.compressed_dt(),hdr(current_header,'00017')), 'lock')
- return_box.append('605x4')
- except Exception as e:
- # print(e.__class__.__name__,": Unknown error occured. Error code 00017x-1\nPlease inform the author.")
- leach_logger("00017x-1||%s||%s||%s||%s"%(Nsys.compressed_dt(),e.__class__.__name__,str(e),hdr(current_header,'00017')), 'lock')
- return_box.append('00017x-1')
- # if float(_VERSION)<float(_latest_version):
- # _version_updater(_latest_version, _latest_link, _latest_hash, _latest_filename,_latest_size)
- return return_box
- boss=0
- god_mode()
- def log_in(user_name_i): #func_code= 00019
- global user_name
- if boss!=1:
- #user_name=input("Enter username: ")
- userhash=hashlib_sha1(user_name_i.encode()).hexdigest()
- if userhash in user_list:
- user_name = user_name_i
- return userhash
- else:
- return "INVALID"
- else:
- userhash='eb23efbb267893b699389ae74854547979d265bd'
- if not exists('data/projects.db'):
- writer('projects.db','a','','data','00019')
- if userhash=='eb23efbb267893b699389ae74854547979d265bd':
- g_mode='Asuna'
- return userhash
- print ("Imported Assets")
- ############### Downloader.py goes here ###############
- from kivymd.app import MDApp
- from kivymd.uix.button import MDRectangleFlatButton, MDFlatButton,MDRaisedButton
- from kivymd.uix import boxlayout
- from kivymd.uix import textfield
- from kivy.lang import Builder
- from kivymd.uix.dialog import MDDialog
- from kivy.uix.screenmanager import ScreenManager, Screen, NoTransition
- from kivy.clock import Clock
- from kivy.core.audio import SoundLoader
- from functools import partial
- # from threading import Thread as Process, current_thread
- # from kivy.uix.relativelayout import RelativeLayout
- #from kivy.core.clipboard import Clipboard
- Builder.load_file("KV_gui.kv")
- _VERSION="5.1"
- class login_kv(Screen):
- pass
- class welcome_kv(Screen):
- pass
- class blank(Screen):
- pass
- class download_page(Screen):
- pass
- class select_tree_page(Screen):
- pass
- from zipfile import ZipFile, BadZipFile
- from re import search as re_search,compile as re_compile #, sub
- from bs4 import BeautifulSoup as bs
- def go_prev_dir(link): #func_code=00026
- if link.endswith('/'):
- return '/'.join(link[:-1].split('/')[:-2])+'/'
- # x=link.split('/')
- else:
- return '/'.join(link.split('/')[:-2])+'/'
- def get_file_name(directory): #func_code= 00013
- return loc(directory,'linux').split('/')[-1]
- def get_file_ext(directory): #func_code= 00014
- return get_file_name(directory).split('.')[-1]
- def reader(direc): #func_code= 00015
- with open(loc(direc)) as f:
- return f.read()
- def remove_non_ascii(text, f_code): #func_code= 00001
- """removes ascii charecters from a string"""
- try:
- return ''.join([i if ord(i) < 128 else '' for i in text])
- except Exception as e:
- print("Failed to remove non-ascii charecters from string.\nError code: 00001x",f_code,'\nPlease inform the author.')
- leach_logger('00001||'+e.__class__.__name__+'||'+Nsys.compressed_dt()+'||'+f_code+'||'+text)
- def distribute(lists,task_id,is_error=False): #func_code= 00018
- global total,done, errors, sp_flags, sp_extension
- task_id=str(task_id)
- res=0
- if existing_found:
- if exists('data/projects/'+Project+'/t'+task_id+'.txt'):
- res=eval(open('data/projects/'+Project+'/t'+task_id+'.txt').read().strip())
- done+=res
- time.sleep(1.2)
- for j in lists:
- if is_error:
- i=j
- else:
- i=all_list[j]
- if lists.index(j)>=res:
- try:
- current_header=header_()
- file=requests.get(i[0], headers= current_header)
- if file:
- writer(get_file_name(i[0])+sp_extension,'wb',file.content,'Projects/'+Project+'/'+sub_dirs[i[1]], '00018')
- if 'dl unzip' in sp_flags:
- if isdir('Projects/'+Project+'/'+sub_dirs[i[1]]+'/'+get_file_name(i[0])+'/')==False:
- makedirs('Projects/'+Project+'/'+sub_dirs[i[1]]+'/'+get_file_name(i[0])+'/')
- with ZipFile('Projects/'+Project+'/'+sub_dirs[i[1]]+'/'+get_file_name(i[0])+sp_extension) as zf:
- zf.extractall(path='Projects/'+Project+'/'+sub_dirs[i[1]]+'/'+get_file_name(i[0]))
- if 'del dl zip' in sp_flags:
- remove('Projects/'+Project+'/'+sub_dirs[i[1]]+'/'+get_file_name(i[0])+sp_extension)
- writer('t'+task_id+'.txt', 'w',str(res),'data/projects/'+Project,'00018')
- delete_last_line()
- #print(done)
- print('Downloaded ['+ str(done+1) + '/'+str(total)+']')
- res+=1
- done+=1
- if is_error:
- errors-=1
- else:
- raise requests.ConnectionError
- except (requests.ConnectionError,requests.exceptions.ChunkedEncodingError):
- if is_error==False:
- writer('errors.txt', 'a',str(tuple(i)+(hdr(current_header,'00018'),))+'\n','data/projects/'+Project,'00018')
- writer('err_header.txt','a','%s,'%hdr(current_header,'00018'),'data/','00018')
- errors+=1
- else:
- print("Failed to download from '%s'"%i[0])
- writer('errors.txt', 'a',str(tuple(i)+(hdr(current_header,'00018'),"Error dl"))+'\n','data/projects/'+Project,'00018')
- leach_logger(str((Project,)+(hdr(current_header,'00018'),"Error dl"))+"||@"+Nsys.compressed_dt(), user_name)
- except BadZipFile:
- if is_error==False:
- writer('errors.txt', 'a',str(tuple(i)+(hdr(current_header,'00018'),"Bad zip"))+'\n','data/projects/'+Project,'00018')
- errors+=1
- else:
- print("It seems every time it downloads a broken or unknown zip from '%s' (possible cause password protected zips, if yes extract them manually)"+i[0])
- writer('errors.txt', 'a',str(tuple(i)+(hdr(current_header,'00018'),"Bad zip"))+'\n','data/projects/'+Project,'00018')
- leach_logger(str(tuple(i)+(hdr(current_header,'00018'),"Bad zip"))+"||@"+Nsys.compressed_dt(),user_name)
- def _init_(): #func_code= 00020
- global patrial_do_all,homepage, existing_found, dimention,sp_flags, done,indx_count, sp_extension, errors
- patrial_do_all=0
- homepage=''
- dimention=0
- done=0
- indx_count=0
- sp_extension=''
- sp_flags=[]
- errors=0
- done=0
- def list_writer(link, types, file_link_starts,n,special=None, soup=None): #func_code= 00021
- global all_list, sub_dirs, indx_count
- homepage_searcher=re_compile('(https?://[^/]*)')
- start_checker=re_compile('^'+file_link_starts)
- if special!=None:
- if special.startswith('nhentai'):
- if special=="nhentai.to":
- to_search= re_compile("(https://nhentai.to/galleries/\d*/)|(https://cdn.dogehls.xyz/galleries/\d*/)")
- for imgs in soup.find_all('img'):
- img_link=imgs.get('data-src')
- if img_link== None:
- img_link=imgs.get('src')
- if img_link.startswith('/'):
- img_link='https://nhentai.to' +(img_link.replace('t',''))
- if img_link.startswith('https://cdn.dogehls.xyz/galleries/'):
- img_link= img_link[::-1].replace('t','',1)[::-1]
- if to_search.search(img_link)!=None:
- all_list.add((img_link,n))
- elif special=="nhentai.net":
- net_search=re_compile("https://i.nhentai.net/galleries/\d*/")
- for imgs in soup.find_all('img'):
- img_link=imgs.get('data-src')
- if img_link== None:
- img_link=imgs.get('src')
- if '/thumb.' in img_link:
- continue
- if 'cover' not in img_link:
- img_link= img_link.replace('s://t.','s://i.')[::-1].replace('t','',1)[::-1]
- if net_search.search(img_link)!=None:
- all_list.add((img_link,n))
- else:
- if type(link)==list and type(n)==range:
- dir_len=len(sub_dirs)
- for i in n:
- if sub_dirs[i][-1]=='/':
- sub_dirs[i]=sub_dirs[i][:-1]
- sub_dirs[i]=sub_dirs[i].split('/')[-1]
- page = requests.get(link[i],headers=header_())
- soup=bs(page.content, parser)
- for imgs in soup.find_all('img'):
- img_link=imgs.get('data-src')
- if img_link== None:
- img_link=imgs.get('src')
- img_link=img_link.strip()
- if img_link.startswith('/'):
- img_link=homepage_searcher.search(link[i]).groups()[0]+img_link
- if img_link.startswith('../'):
- temp_home=link[i]
- while img_link.startswith('../'):
- temp_home= go_prev_dir(temp_home)
- img_link=img_link.replace('../','',1)
- img_link=temp_home+img_link
- if start_checker.search(str(img_link))!=None and img_link.endswith(types):
- if img_link.startswith('//i') and '.imggur.net' in img_link:
- img_link="https:"+img_link
- all_list.add((img_link,i))
- delete_last_line()
- print('Indexed ['+ str(indx_count+1) + '/'+str(dir_len)+'] '+link[i])
- indx_count+=1
- else:
- page = requests.get(link,headers=header_())
- soup=bs(page.content, parser)
- for imgs in soup.find_all('img'):
- img_link=imgs.get('data-src')
- if img_link== None:
- img_link=imgs.get('src')
- if img_link.startswith('/'):
- img_link=homepage_searcher.search(link).groups()[0]+img_link
- if img_link.startswith('../'):
- while img_link.startswith('../'):
- temp_home=link
- temp_home= go_prev_dir(temp_home)
- img_link=img_link.replace('../','',1)
- img_link=temp_home+img_link
- if start_checker.search(str(img_link))!=None and img_link.endswith(types):
- if img_link.startswith('//i') and '.imggur.net' in img_link:
- img_link="https:"+img_link
- all_list.add((img_link,n))
- if os_name=='Windows':
- def plat_yamatte(vol): #func_code= 00022
- global ex
- writer('yamatte.mp3','wb',requests.get(random_choice(yamatte), headers=header_()).content,'Data/.temp','00022')
- ex=mplay4.ex_vol
- mplay4.set_win_vol(vol)
- mplay4.load('data/.temp/yamatte.mp3').play()
- time.sleep(8)
- remove('data/.temp/yamatte.mp3')
- mplay4.set_win_vol(ex)
- play_yamatte_t=Process(target=plat_yamatte, args=[80])
- def nhantai_link(link): #func_code= 00022
- global sub_dirs
- code=re_search('https://nhentai.[^/]*/g/((\d)*)',link)
- if code==None:
- return False, False
- code=code.groups()[0]
- try:
- current_header=header_()
- link_y='https://nhentai.net/g/'+code+'/'
- page = requests.get(link_y,headers=current_header, timeout=2)
- if page:
- site=".net"
- else:
- raise requests.ConnectionError
- #link_y='https://nhentai.to/g/'+code+'/'
- #page = requests.get(link_y,headers=headers)
- #site='.to'
- # site="https://nhentai.net/"
- # thumb_pattern="https://t.nhentai.net/galleries/\d/\dt."
- except (requests.ConnectionError,requests.exceptions.ConnectTimeout,requests.exceptions.ReadTimeout):
- print('nhentai.net server is not reachable, trying proxy server...')
- link_y='https://nhentai.to/g/'+code+'/'
- page = requests.get(link_y,headers=header_())
- site='.to'
- leach_logger("project||%s||606x1||%s||%s"%(Project, link, hdr(current_header,'00022')), user_name)
- if page:
- soup=bs(page.content, parser)
- title=remove_non_ascii(soup.find(id='info').find('h1').get_text(),'00022')
- print("Indexing from",title)
- list_writer(code,img,'',0,'nhentai'+site,soup)
- sub_dirs.append(title)
- # print(sub_dirs)
- return link_y, title
- else:
- print("\033[1;31;40mError code: 606x2\nLink not found, Please recheck the link and start a new project\033[0m")
- leach_logger("project||%s||606x2||%s||%s"%(Project, link, hdr(current_header,'000')), user_name)
- return 0
- def check_sp_links(link, sp=None): #func_code= 00023
- special_starts=['https://nhentai.(net)|(to)/g/','https://w11.mangafreak.net/M|manga/']
- nh=special_starts[0]
- mangafreak=special_starts[1]
- if sp=='nh':
- if re_search('^'+nh, link)!=None:
- return True
- else:
- return False
- elif sp=="mangafreak":
- if re_search('^'+mangafreak, link)!=None:
- return True
- else:
- return False
- elif sp==None:
- for i in special_starts:
- if re_search('^'+i, link)!=None:
- return True
- return False
- def mangafreak_link(link): #func_code= 00024
- global sub_dirs, all_list, sp_extension
- inp = re_search('https://w11.mangafreak.net/(M|m)anga/([^\?]*)',link)
- if inp!=None:
- title=inp.group(2)
- else:
- return ""
- while True:
- try:
- last_ch= int(input("\n\033[32;1m**\033[0mPlease enter the last chapter number: "))
- while True:
- try:
- if requests.head("http://images.mangafreak.net:8080/downloads/"+title+'_'+str(last_ch)):
- sp_extension='.zip'
- print("Found!")
- break
- # except request.URLError:
- # print("This chapter is not found!!")
- # break
- else:
- print("This chapter is not found!!")
- except:
- print("This chapter is not found!!")
- break
- except:
- last_ch= int(input("\n\033[31;1m**\033[0mJust enter the last chapter number (like 135): "))
- sub_dirs.append(title)
- for i in range(1,last_ch+1):
- all_list.add(("http://images.mangafreak.net:8080/downloads/"+title+'_'+str(i),0))
- return "mangafreak.net"
- def main(): #func_code= 00025
- _init_()
- global Project, all_list,total,existing_found, sub_dirs,patrial_do_all,sp_flags, errors, sp_extension
- existing_found=False
- dl_done=False
- corruptions=[]
- Project=input('\nEnter Batch download directory (Project name): ')
- project_dir=Project[:].replace('/','-').replace('\\','-').replace('|','-').replace(':','-').replace('*','-').replace('"',"'").replace('>','-').replace('<','-')
- leach_logger("project||%s||began||%s"%(Project,str(Nsys.compressed_dt())),user_name)
- if Project in open('data/projects.db').read().split('\n'):
- print('Existing Project name found!')
- proj_good=False
- list_good=False
- if exists('data/projects/'+Project+'.proj') and exists('data/projects/'+Project+'.list'):
- proj_good= True
- try:
- with open('data/projects/'+Project+'.proj') as f:
- print('db found')
- existing_data=f.read().strip().split('\n')
- try:
- main_link=existing_data[0]
- except:
- corruptions+=[1]
- print('\033[1;31;40mCorrupted Data! Error code: 601x1\033[0m')
- proj_good=False
- if proj_good:
- try:
- link_startswith=existing_data[1]
- except:
- proj_good= False
- print('\033[1;31;40mCorrupted Data! Error code: 601x2\033[0m')
- corruptions+=[4]
- if proj_good:
- try:
- file_types=eval(existing_data[2])
- except:
- proj_good= False
- print('\033[1;31;40mCorrupted Data! Error code: 601x3\033[0m')
- corruptions+=[4]
- if proj_good:
- try:
- file_starts=existing_data[3]
- except:
- proj_good= False
- print('\033[1;31;40mCorrupted Data! Error code: 601x4\033[0m')
- corruptions+=[4]
- if proj_good:
- try:
- sub_dirs=eval(existing_data[4]) #sub directory list
- except:
- proj_good= False
- print('\033[1;31;40mCorrupted Data! Error code: 601x5\033[0m')
- corruptions+=[2]
- try: #added in v5.0 may not be in older files
- sp_flags=eval(existing_data[5])
- sp_extension=eval(existing_data[6])
- except IndexError: pass
- if proj_good:
- try: #added in v5.1 may not be in older files
- dl_done=eval(existing_data[7])
- except IndexError: pass
- with open('data/projects/'+Project+'.list') as f:
- try:
- file=f.read()
- #print(f"'{file}'")
- if file.strip()=='': raise ValueError
- all_list= eval(str(file))
- print('list found')
- list_good= True
- except:
- list_good= False
- print('\033[1;31;40mCorrupted Data! Error code: 601x6\033[0m')
- corruptions+=[3]
- #print(x)
- if proj_good and list_good:
- if dl_done:
- print('It seems the old prject download was complete!!')
- if asker('Do you want make a fresh start with that project name??\n\033[1;33mWarning!\033[0m last project data will be erased\n(downloaded files will be safe, unless the program replaces the files with new ones)\n\033[32m>> \033[0m'):
- writer(Project+'.list','w','','data/projects','00025')
- writer(Project+'.proj','w','','data/projects','00025')
- existing_found= False
- leach_logger('project||%s||%s||fresh start||was done'%(Project,Nsys.dt_()),user_name)
- else:
- print("Okay! Enter a new project name in the next line.")
- return 0
- else:
- if asker("Do you want to resume the Project '%s'?\nyes/y to resume\nno/n to Start fresh (\033[1;33mwarning! last project data will be erased \033[0m(downloaded files will be safe, unless the program replaces the files with new ones)\n\033[32m>> \033[0m"%Project):
- print('============ Realoaded =============')
- leach_logger('project||%s||%s||resumed||not done'%(Project,Nsys.dt_()),user_name)
- existing_found= True
- else:
- leach_logger('%s||%s||fresh start||not done'%(Project,Nsys.dt_()),user_name)
- #clear file data
- writer(Project+'.list','w','','data/projects','00025')
- writer(Project+'.proj','w','','data/projects','00025')
- existing_found= False
- except Exception as e:
- # existing_found=0
- print('\033[1;31;40mCorrupted Data! Error code: 601\n\033[0m')
- corruptions+=[e.__class__.__name__]
- #print('error')
- #download_files(listx,state)
- else:
- # existing_found=0
- print('Insufiicient Data!\n')
- corruptions+=[0]
- if existing_found==False:
- if corruptions!=[]:
- if exists('data/projects/'+Project+'.proj'):
- leach_logger("project||%s||%s||%s||%s"%(Project, Nsys.dt_(), str(corruptions),open('data/projects/'+Project+'.proj').read().replace('\n','>>')), user_name)
- else:
- leach_logger("project||%s||%s||%s"%(Project, Nsys.dt_(),str(corruptions)), user_name)
- writer('errors.txt', 'a','','data/projects/'+Project,'00025') #reset error file
- all_list=set()
- sub_dirs=[]
- sub_links=[]
- sub_links2=[]
- #sub_links_filtered=[]
- file_types=set()
- link_startswith=''
- file_starts=''
- link_true=False
- main_link=input("\nEnter the link: ")
- leach_logger('%s||%s||m_link||%s)'%(Project, Nsys.dt_(),main_link), user_name)
- while link_true==False:
- if check_sp_links(main_link,'nh'):
- break
- try:
- page =requests.get(main_link, headers=header_())
- link_true=True
- except (requests.exceptions.MissingSchema,requests.exceptions.ConnectionError):
- main_link=input("\033[1;31;40mInvalid URL! \033[0m(possible cause: no internet or wrong link)\n\nPlease re-enter the link: ")
- if check_sp_links(main_link,'mangafreak'):
- print("mangafreak link detected!!")
- is_mangafreak=asker("Do you want to download manga images from this links?? (y/n)\n>> ")
- if is_mangafreak:
- will_unzip=asker("\nThe download files are in zip format.\nDo you wish to Extract them?\n>> ")
- if will_unzip:
- sp_flags.append("dl unzip")
- if asker("Shall i delete the downloaded zip files?\n>> "):
- sp_flags.append("del dl zip")
- link_startswith= mangafreak_link(main_link)
- file_types='zip'
- file_starts=''
- leach_logger('project||%s||is_mangafreak||%s'%(Project,str(sp_flags)),user_name)
- # sub_links=''
- #sys_exit()
- if check_sp_links(main_link,'nh'): #main_link.startswith('https://nhentai.net/g/') or main_link.startswith('https://nhentai.to/g/'):
- print("nhentai link detected!!")
- is_nh=asker("Do you want to download doujin images from this links?? (y/n)\n( ͡° ͜ʖ ͡°)\t")
- ####( io )
- if is_nh:
- if os_name=='Windows':
- play_yamatte_t.start()
- link_startswith, title=nhantai_link(main_link)
- #print(link_startswith,title)
- if link_startswith==0 and title==0:
- return 0
- if title!=False and link_startswith!='':
- sub_dirs.append(title.replace('/','-').replace('\\','-').replace('|','-').replace(':','-').replace('*','-').replace('"',"'").replace('>','-').replace('<','-'))
- file_types=img
- file_starts='https://nhentai'
- leach_logger('project||%s||is_nh'%(Project),user_name)
- '''elif is_nh!='n':
- print('invalid input!! the program will break in 3seconds')
- time.sleep(3)
- raise ValueError'''
- if link_startswith=='':
- print("Do you want to\n1. Download data from current link\n2. Download data from sub links of current link\n3. or Both Current and Sub links?")
- dimention= input("Enter the index of your choice (1/2/3): ")
- while dimention not in ['1','2','3']:
- dimention = input("\033[1;31;40mInvalid input!\033[0m\nEnter 1 or 2 or 3:")
- leach_logger('%s||%s||dimention||%s)'%(Project, Nsys.dt_(),dimention), user_name)
- if dimention=='1' or dimention=='3':
- sub_links2+=[main_link]
- if dimention=='2' or dimention=='3':
- #page = requests.get(main_link, headers=header_())
- #if not page:
- # print('\033[1;31;40mError code 605x\nConnection Failed, The program will break in 5 second\033[0m')
- # time.sleep(5)
- # leach_logger("XXXX Program crashed opening: '"+main_link+"' Error code 605 from main function collecting current page.", ush)
- # sys_exit()
- #print(page.content)
- #time.sleep(1000)
- soup=bs(page.content, parser)
- link_startswith=input("\n(optional but recomanded to be more precice):\n1. Sub-Links Starts With : ")
- leach_logger('%s||%s||l_starts||%s)'%(Project, Nsys.dt_(),link_starts), user_name)
- sub_links2+=list(set([sub_link.get('href').strip() for sub_link in soup.find_all('a')]))
- if link_startswith=='':
- link_startswith=main_link[:]
- file_types_i=input("\nEnter file formats (separate multiple by commas) *no need to add . in formats (ie: png, jpg,mp3) or just write the category (ie: image, music, video): ")
- if file_types_i=='image':
- file_types=img
- else:
- file_types= tuple(i.strip(i) for i in file_types_i.split(','))
- leach_logger('%s||%s||f_types||%s)'%(Project, Nsys.dt_(),str(file_types)), user_name)
- file_starts=input("\nFile Links Starts With (if known or need to be specified): ")
- leach_logger('%s||%s||f_starts||%s)'%(Project, Nsys.dt_(),file_starts), user_name)
- # project_path=Project[:]
- #if start[-1'/'): start+='/'
- #if start.startswith(): start=start[1:]
- #sub_dirs=[]
- #len_sub_links=str(len(sub_links))
- # count=0
- print('\n')
- homepage_searcher=re_compile('(https?://[^/]*)')
- link_startswith_re=re_compile('^'+link_startswith)
- #leach_logger("++%s'+'%s'+%s'+'%s'++"%(main_link, link_startswith,str(file_types),file_starts), user_name)
- print("Checking links...")
- for i in sub_links2:
- #sys.stdout.flush()
- #print(link)
- # print(i)
- if patrial_do_all==0 and i.startswith('/'):
- print("Partial link detected - ",main_link,"\nSearching for home page.")
- #print(start)
- homepage =homepage_searcher.search(link_startswith)
- #print(homepage)
- if homepage!=None:
- print("Home page detected: ", homepage.group())
- is_homepage= input("\nIs this the homepage? \n(y for yes\nn for no\na for all)\n")
- if is_homepage=="a":
- patrial_do_all=1
- is_homepage='y'
- if is_homepage=='y':
- homepage=homepage.group()
- elif is_homepage=='n':
- homepage= input("\nEnter the home page: ")
- io2=input('\nIs it for all other links?(y/n)')
- if io2=='y':
- patrial_do_all=1
- elif io2!='n':
- print("Invalid input!")
- time.sleep(5)
- sys_exit()
- else:
- print("Invalid input!")
- time.sleep(5)
- sys_exit()
- else:
- print("Homepage not found!")
- homepage= input("\nEnter the home page: ")
- io2=input('Is it for all other links?(y/n)')
- if io2=='y':
- patrial_do_all=1
- elif io2!='n':
- print("Invalid input!")
- time.sleep(5)
- sys_exit()
- i=homepage+i
- #print(link)
- #print(sub_dirs)ta
- if link_startswith_re.search(i)!=None:
- sub_links.append(i)
- #print('\t'+i)
- # sub_links=sub_links2[:]
- del sub_links2
- if sub_dirs==[]:
- sub_dirs=sub_links[:]
- len_sub_links= len(sub_links)
- print('\n')
- if len_sub_links<4:
- for n in range(len_sub_links):
- list_writer(sub_links[n],file_types, file_starts,n)
- if sub_dirs[n][-1]=='/':
- sub_dirs[n]=sub_dirs[n][:-1]
- sub_dirs[n]=sub_dirs[n].split('/')[-1]
- delete_last_line()
- print('Indexed ['+ str(n+1) + '/'+str(len_sub_links)+'] '+sub_links[n])
- else:
- sub_range=range(len_sub_links)
- indx1= Process(target=list_writer, args=(sub_links,file_types, file_starts,sub_range[::3]))
- indx2= Process(target=list_writer, args=(sub_links,file_types, file_starts,sub_range[1::3]))
- indx3= Process(target=list_writer, args=(sub_links,file_types, file_starts,sub_range[2::3]))
- try:
- indx1.start()
- indx2.start()
- indx3.start()
- indx1.join()
- indx2.join()
- indx3.join()
- except:
- print("\033[1;31;40mcode: Error 607\n The program will break in 5 seconds\033[0m")
- leach_logger("XXXX Program crashed running: 'indx threads' Error code 607 from main function calling list_writer with tthreads. Error", ush)
- time.sleep(5)
- sys_exit()
- all_list=list(all_list)
- writer('projects.db','a',Project+'\n','data','00025')
- writer(Project+'.list','w',str(all_list),'data/projects','00025')
- writer(Project+'.proj','w',main_link+'\n','data/projects','00025')
- writer(Project+'.proj','a',link_startswith+'\n','data/projects','00025')
- writer(Project+'.proj','a',str(file_types)+'\n','data/projects','00025')
- writer(Project+'.proj','a',file_starts+'\n','data/projects','00025')
- writer(Project+'.proj','a',str(sub_dirs)+'\n','data/projects','00025')
- writer(Project+'.proj','a',str(sp_flags)+'\n','data/projects','00025')
- writer(Project+'.proj','a',str('"%s"'%sp_extension)+'\n','data/projects','00025')
- print('\n\n')
- total=len(all_list)
- if exists('data/projects/'+project_dir+'/errors.txt'):
- errors=len(open('data/projects/'+project_dir+'/errors.txt').readlines())
- else:
- errors=0
- #print(all_list)
- all_list_r=list(range(total))
- #if 'dl unzip' in sp_flags:print(100**100)
- t11= Process(target=distribute, args=(all_list_r[::10],1))
- t2= Process(target=distribute, args=(all_list_r[1::10],2))
- t3= Process(target=distribute, args=(all_list_r[2::10],3))
- t4= Process(target=distribute, args=(all_list_r[3::10],4))
- t5= Process(target=distribute, args=(all_list_r[4::10],5))
- t6= Process(target=distribute, args=(all_list_r[5::10],6))
- t7= Process(target=distribute, args=(all_list_r[6::10],7))
- t8= Process(target=distribute, args=(all_list_r[7::10],8))
- t9= Process(target=distribute, args=(all_list_r[8::10],9))
- t10= Process(target=distribute, args=(all_list_r[9::10],10))
- ##sleep(.5)
- t11.start()
- t2.start()
- t3.start()
- t4.start()
- t5.start()
- t6.start()
- t7.start()
- t8.start()
- t9.start()
- t10.start()
- t11.join()
- t2.join()
- t3.join()
- t4.join()
- t5.join()
- t6.join()
- t7.join()
- t8.join()
- t9.join()
- t10.join()
- leach_logger("Project||"+Project+"||finished @||"+Nsys.compressed_dt()+'||Total files||'+str(total)+'||total errors||'+str(errors), ush)
- if errors>0:
- if exists('data/projects/'+Project+'/errors.txt'):
- with open('data/projects/'+Project+'/errors.txt') as f:
- err_file=f.read().strip().split('\n')
- errs= [list(x) for x in set([eval(i)[:2] for i in err_file])]
- distribute(errs,11, True)
- else:
- print("Warning: Error file not found!\nPossible cause: Data corruption")
- leach_logger("Project||"+Project+"||finished @||"+Nsys.compressed_dt()+'||Total files||'+str(total)+'||total errors||'+str(errors), ush)
- if errors == 0:
- writer(Project+'.proj','a','True','data/projects','00025')
- else: print("Please retry some time later to get higher chances to download some or all %d missing file/s"%errors)
- class DemoApp(MDApp):
- def build(self):
- global user_net_ip
- self.step=0
- self.sm = ScreenManager()
- self.__temp= [None, None] # to store temp data
- self.__temp = _connect_net() # checks net and assigns the __temp var data
- ########################################################################
- ############ need to switch to False in the below line ##################
- if self.__temp[0]== False: # if there is no internet
- self.sm.add_widget(blank(name="blank_Kv"))
- self.sm.add_widget(login_kv(name="login_Kv"))
- else:
- self.sm.add_widget(login_kv(name="login_Kv"))
- # login_Kv will connect it to other funtions through login_btn
- return self.sm
- ################ Basics || START ################
- def close_app(self, obj=None):
- """funtion to close the app"""
- sys_exit()
- dialog=None # just to make sure this variable exists while defining some funtions so that no error occurs like var is not declared
- def close_dialog(self, arg=None):
- """close self.dialog func"""
- self.dialog.dismiss()
- ################ Basics || ENDS ################
- ################ Net check @ start $blank || START ################
- def check_net_at_start(self, obj=None):
- """will check if internet is available or not at startup
- and act according to that"""
- try:
- """Checks if this dialog is already open and then closes it"""
- self.failed_2_conn_at_start.dismiss()
- except:
- pass
- self.__temp = _connect_net()
- self.failed_2_conn_at_start = MDDialog(title="No luck...\nPlease retry or exit\nError code: "+ str(self.__temp[1]), buttons=[MDFlatButton(text='Retry', on_release=self.check_net_at_start), MDFlatButton(text='Exit', on_release=self.close_app)],
- size_hint=(0.8, 0.8))
- if self.__temp[0]==False:
- self.failed_2_conn_at_start.open()
- else:
- self.sm.remove_widget(self.sm.screens[0])
- self.sm.current= "login_Kv"
- ################ Net check @ 0 $blank || ENDS ################
- ################ Log in @ 1 $login_kv || START ################
- def run_god_mode(self, arg=None):
- """ Runs god_mode funcition from asssets to download required assets based on os and database update"""
- self.box= god_mode()
- #print(self.box)
- self.log_in_check()
- def open_connecting_dialog(self, args=None):
- try:
- self.close_dialog()
- except:
- pass
- self.connecting_dialog = MDDialog(title="Connecting...\nPlease wait a sec!", on_open=self.run_god_mode,
- size_hint=(0.8, 0.8))
- # self.connecting_dialog.
- self.connecting_dialog.open()
- def close_connecting_dialog(self, arg=None):
- self.connecting_dialog.dismiss()
- def close_failed_2_conn_at_start(self, arg=None):
- """closes no internet error and switches screen to login"""
- self.failed_2_conn_at_start.dismiss()
- self.sm.current= "login_Kv"
- def login_btn(self, _username):
- self._username= _username
- if _username=='':
- self.dialog = MDDialog(title="Please enter your user name",text="You can't leave Username field empty",
- size_hint=(0.8, 0.8),
- buttons=[MDFlatButton(text='Close', on_release=self.close_dialog)])
- self.dialog.open()
- elif self.step==0:
- # self.open_connecting_dialog()
- self.open_connecting_dialog()
- else:
- self.log_in_check()
- def log_in_check(self):
- """checks and warns if internet is available and then the _username is valid or not and responese accordingly"""
- if '605x4' in self.box or '00017x-1' in self.box:
- time.sleep(0.5)
- self.close_connecting_dialog()
- self.dialog = MDDialog(title="Failed to connect to the internet!\nError code %s"%self.box[0], size_hint=(0.8, 0.8),
- buttons=[MDFlatButton(text='Retry', on_release=self.open_connecting_dialog),
- MDFlatButton(text='Close', on_release=self.close_dialog)])
- self.dialog.open()
- else:
- self.step =1
- if self.step==1:
- self.close_connecting_dialog()
- box= log_in(self._username)
- sound=False
- if box=='INVALID':
- if os_name=="Windows":
- ex=mplay4.ex_vol
- mplay4.set_win_vol(60)
- sound = SoundLoader.load('data/.temp/who_r_u.mp3')
- sound.play()
- self.dialog = MDDialog(title="Username not found!\nPlease retry",
- size_hint=(0.8, 0.8),
- buttons=[MDFlatButton(text='Close', on_release=self.close_dialog)])
- self.dialog.open()
- if os_name=="Windows":
- mplay4.set_win_vol(ex)
- else:
- if sound!=False: sound.unload()
- self.sm.add_widget (welcome_kv(name="welcome_Kv"))
- self.sm.current= "welcome_Kv"
- self.sm.remove_widget(self.sm.screens[0])
- if float(_VERSION) < float(_latest_version):
- self.dialog= MDDialog(title="Version: %s available"%_latest_version, size_hint=(0.8, 0.8), text="Do you want to update?",
- buttons=[MDFlatButton(text='Yes', on_release=self.open_updating_dialog),
- MDFlatButton(text='Not yet', on_release=self.close_dialog)])
- #print(0)
- #load_asset2()
- ################ Log in @ 1 $login_kv || ENDS ################
- ################ welcome @ 2 $welcome_kv || START ################
- def lets_go_btn(self):
- self.sm.add_widget(download_page(name= "download_Kv"))
- self.sm.current= "download_Kv"
- self.sm.remove_widget(self.sm.screens[0])
- def open_updating_dialog(self, obj= None):
- self.close_dialog()
- # do update stuffs here
- ################ welcome @ 2 $welcome_kv || ENDS ################
- ################ Proj name @ 2 $download_page || STARTS ################
- def check_project(self, proj_name):
- if proj_name=="":
- self.dialog = MDDialog(title="Please enter a project name",
- text="You can't leave this field empty",
- size_hint=(0.8, 0.8),
- buttons=[MDFlatButton(text='Close', on_release=self.close_dialog)])
- self.dialog.open()
- elif any(x in proj_name for x in ['"', '\\', '/', '?', '*', '<', '>', '|']):
- self.dialog = MDDialog(title="Invalid Project name",
- text="Sorry project name can't have \\ / * \" ? < > | charecters",
- size_hint=(0.8, 0.8),
- buttons=[MDFlatButton(text='Close', on_release=self.close_dialog)])
- self.dialog.open()
- else:
- self.check_project1(proj_name)
- def check_project1(self, Proj_name):
- _init_()
- global Project, all_list, total, existing_found, sub_dirs, patrial_do_all, sp_flags, errors, sp_extension, overwrite_bool, project_dir, sequence, main_link
- Project = Proj_name[:]
- existing_found=False
- dl_done=False
- sequence=True
- corruptions=[]
- project_dir=Project[:] #.replace('/','-').replace('\\','-').replace('|','-').replace(':','-').replace('*','-').replace('"',"'").replace('>','-').replace('<','-').replace('?','-')
- print(project_dir)
- leach_logger("project||%s||open||%s"%(Project,Nsys.compressed_dt()),user_name)
- if Project in open('data/projects.db').read().split('\n'):
- print('Existing Project name found!')
- proj_good=False
- list_good=False
- if exists('Data/leach_projects/'+project_dir+'.proj') and exists('Data/leach_projects/'+project_dir+'.list'):
- proj_good= True
- try:
- with open('Data/leach_projects/'+project_dir+'.proj') as f:
- print('db found')
- existing_data=f.read().strip().split('\n')
- try:
- main_link=existing_data[0]
- except:
- corruptions+=[1]
- print('\033[1;31;40mCorrupted Data! Error code: 601x1\033[0m')
- proj_good=False
- if proj_good:
- try:
- link_startswith=existing_data[1]
- except:
- proj_good= False
- print('\033[1;31;40mCorrupted Data! Error code: 601x2\033[0m')
- corruptions+=[2]
- if proj_good:
- try:
- file_types=eval(existing_data[2])
- except:
- proj_good= False
- print('\033[1;31;40mCorrupted Data! Error code: 601x3\033[0m')
- corruptions+=[3]
- if proj_good:
- try:
- file_starts=existing_data[3]
- except:
- proj_good= False
- print('\033[1;31;40mCorrupted Data! Error code: 601x4\033[0m')
- corruptions+=[4]
- if proj_good:
- try:
- sub_dirs=eval(existing_data[4]) #sub directory list
- except:
- proj_good= False
- print('\033[1;31;40mCorrupted Data! Error code: 601x5\033[0m')
- corruptions+=[2]
- try: #added in v5.0 may not be in older files
- sp_flags=eval(existing_data[5])
- sp_extension=eval(existing_data[6])
- overwrite_bool=eval(existing_data[7])
- except IndexError: pass
- if proj_good:
- try: #added in v5.1 may not be in older files
- dl_done=eval(existing_data[8])
- except IndexError: pass
- with open('Data/leach_projects/'+project_dir+'.list') as f:
- try:
- file=f.read()
- #print(f"'{file}'")
- if file.strip()=='': raise ValueError
- all_list= eval(str(file))
- print('list found')
- list_good= True
- except:
- list_good= False
- print('\033[1;31;40mCorrupted Data! Error code: 601x6\033[0m')
- corruptions+=[3]
- if proj_good and list_good:
- if dl_done:
- self.dialog = MDDialog(title="The project was finished",
- text= "Do you want to get updates from previous project link\nOr create a fresh project with same name (*scrapped data won't be deleted)",
- size_hint=(0.8, 0.8),
- buttons=[
- MDRaisedButton(text='Back', on_release=self.close_dialog),
- MDFlatButton(text='Update', on_release=self.project_update),
- MDFlatButton(text='Create new', on_release= partial(self.project_flush, True))])
- self.dialog.open()
- #print('It seems the old prject download was complete!!')
- #if asker('Do you want to get updated data from the project link?\nIf you want make a fresh start with that project name type \033[1;43mno\033[0m\n>> ')==False:#'Do you want make a fresh start with that project name??\n\033[1;33mWarning!\033[0m last project data will be erased\n(downloaded files will be safe, unless the program replaces the files with new ones)\n\033[32m>> \033[0m'):
- # writer(project_dir+'.list','w','','Data/leach_projects','00025')
- # writer(project_dir+'.proj','w','','Data/leach_projects','00025')
- # existing_found= False
- # leach_logger('project||%s||%s||fresh start||was done'%(Project,Nsys.dt_()),user_name)
- #else:
- # #print("Okay! Enter a new project name in the next line.")
- # existing_found= True
- # overwrite_bool=False
- #remove('Data/leach_projects/'+project_dir+'/')
- else:
- self.dialog = MDDialog(title="Unfinished project found!",
- text= "Continue from prevous project\nOr create a fresh project with same name (*scrapped data won't be deleted)",
- size_hint=(0.8, 0.8),
- buttons=[
- MDRaisedButton(text='Resume', on_release=self.project_update),
- MDFlatButton(text='Create new', on_release=partial(self.project_flush, False)),
- MDFlatButton(text='Back', on_release=self.close_dialog)])
- self.dialog.open()
- #if asker("Do you want to resume the Project '%s'?\nyes/y to resume\nno/n to Start fresh (\033[1;33mwarning! last project data will be erased \033[0m(downloaded files will be safe, unless the program replaces the files with new ones)\n\033[32m>> \033[0m"%Project):
- # print('============ Realoaded =============')
- # leach_logger('project||%s||%s||resumed||not done'%(Project,Nsys.dt_()),user_name)
- # existing_found= True
- #else:
- # leach_logger('%s||%s||fresh start||not done'%(Project,Nsys.dt_()),user_name)
- # #clear file data
- # writer(project_dir+'.list','w','','Data/leach_projects','00025')
- # writer(project_dir+'.proj','w','','Data/leach_projects','00025')
- # existing_found= False
- except Exception as e:
- # existing_found=0
- print('\033[1;31;40mCorrupted Data! Error code: 601\n\033[0m')
- corruptions+=[e.__class__.__name__]
- raise e
- else:
- # existing_found=0
- print('Insufiicient Data!\n')
- corruptions+=[0]
- if corruptions!=[] and corruptions!=[0]:
- self.dialog = MDDialog(title="Failed to load existing project",
- text="A project with same name was found in the database, however the data was broken. So you need to start over\nError code: P"+str(corruptions),
- size_hint=(0.8, 0.8),
- buttons=[MDFlatButton(text='Continue', on_release=self.close_dialog)])
- self.dialog.open()
- if exists('Data/leach_projects/'+project_dir+'.proj'):
- leach_logger("project||%s||%s||%s||%s"%(Project, Nsys.dt_(), str(corruptions),open('Data/leach_projects/'+project_dir+'.proj').read().replace('\n','>>')), user_name)
- else:
- leach_logger("project||%s||%s||%s"%(Project, Nsys.dt_(),str(corruptions)), user_name)
- def project_update(self, obj = None):
- global existing_found, overwrite_bool
- existing_found= True
- overwrite_bool=False
- if isdir('./Data/leach_projects/'+project_dir):
- rmdir('./Data/leach_projects/'+project_dir)
- else:
- pass
- def project_flush(self, done, obj =None):
- global existing_found
- remove('Data/leach_projects'+project_dir+'.list')
- remove('Data/leach_projects'+project_dir+'.proj')
- try:
- rmdir('Data/leach_projects/'+project_dir+'/')
- except FileNotFoundError:
- pass
- existing_found= False
- leach_logger('project||%s||%s||fresh start||%sdone'%(Project,Nsys.dt_(),("" if done else "not ")),user_name)
- ##########
- class Test(MDApp):
- def build(self):
- self.theme_cls.primary_palette = "Gray"
- return Builder.load_string(
- '''
- BoxLayout:
- orientation:'vertical'
- MDToolbar:
- title: 'Bottom navigation'
- md_bg_color: .2, .2, .2, 1
- specific_text_color: 1, 1, 1, 1
- MDBottomNavigation:
- panel_color: .2, .2, .2, 1
- MDBottomNavigationItem:
- name: 'screen 1'
- text: 'Python'
- icon: 'language-python'
- MDLabel:
- text: 'Python'
- halign: 'center'
- MDBottomNavigationItem:
- name: 'screen 2'
- text: 'C++'
- icon: 'language-cpp'
- MDLabel:
- text: 'I programming of C++'
- halign: 'center'
- MDBottomNavigationItem:
- name: 'screen 3'
- text: 'JS'
- icon: 'language-javascript'
- MDLabel:
- text: 'JS'
- halign: 'center'
- '''
- )
- #ld_assets.join()
- DemoApp().run()
Add Comment
Please, Sign In to add comment