This repository has been archived by the owner on Dec 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
addons.py
88 lines (73 loc) · 2.33 KB
/
addons.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import string
try:import posix as os
except:import os
import sys
from random import random,choice
from termcolor import cprint,colored
from time import sleep
import time
import base64
import hashlib
from Crypto import Random
from Crypto.Cipher import AES
import pyperclip
import msvcrt
import shutil
import zipfile
import json
import help
password_placeholder='*'
max_index=51
if os.name=='posix':pass
else:from notify import notify
def typing(text: str,color="yellow",typing_speed=50):
for character in text:
sys.stdout.write(colored(character,color))
sys.stdout.flush()
sleep(random() * 10.0 / typing_speed )
def clear():
if os.name=='posix':_=os.system('clear')
else:_=os.system('cls')
def generate_random_password(maxr=40):
symbols=['!','@','#','$','%','&','_','+','?','/','*',"'",'"']
source = string.ascii_uppercase + string.ascii_lowercase + string.digits+choice(symbols)
return ''.join(choice(f"{source},{choice(symbols)}{choice(symbols)}") for x in range(1,maxr))
def initialize(path):
with open(path,"r") as rnf:
exec(rnf.read())
clear()
def password_input(prompt=''):
p_s = ''
proxy_string = [' '] * max_index
while True:
sys.stdout.write('\x0D' + prompt + ''.join(proxy_string))
c = msvcrt.getch()
if c == b'\r':break
elif c == b'\x08':
p_s = p_s[:-1]
proxy_string[len(p_s)] = " "
else:
proxy_string[len(p_s)] = password_placeholder
p_s += c.decode()
sys.stdout.write('\n')
return p_s
def compress(files,archive,password):
with zipfile.ZipFile(archive, "w") as zf:
for file in files:
zf.write(file)
zf.setpassword(password)
with zipfile.ZipFile(archive, "r") as zf:
crc_test = zf.testzip()
if crc_test is not None:
print(f"Bad CRC or file headers: {crc_test}")
info = zf.infolist()
file = info[0]
with zf.open(file) as f:
f.read().decode()
#zf.extract(file, "/tmp", pwd=password)
if __name__=="__main__":
clear()
print('Password: ',password_input("Enter password: "))
print('Generated Random password (70-bit):',generate_random_password(70))
print('Generated Random password (Default):',generate_random_password())
notify("Tite","This is a notification")