-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathekernel.py
63 lines (53 loc) · 1.94 KB
/
ekernel.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
# ProcyonCLS Extended Kernel
import time
import kernel
import getpass
import hashlib
import pyfiglet
import sqlite3
import requests
from bs4 import BeautifulSoup
from blessed import Terminal
term = Terminal()
def urlDownloader(url, destAndExtensionOfFile):
try:
response = requests.get(url, stream=True)
response.raise_for_status()
with open(destAndExtensionOfFile, 'wb') as f:
for chunk in response.iter_content(chunk_size=8192):
f.write(chunk)
except:
return f"Error downloading file from {url}, please check the URL or your internet and try again!"
def splashScreen(name, ver):
kernel.clrscr()
kernel.println(term.magenta(term.center(term.bold(pyfiglet.figlet_format(name)))))
kernel.println((ver))
time.sleep(3)
kernel.clrscr()
def prettyPrint(param):
kernel.println(pyfiglet.figlet_format(param))
def printHeader(header):
kernel.println((term.magenta(f"▓▒ {header} ▒░")))
def hash_password(password):
return hashlib.sha256(password.encode()).hexdigest()
def securePass(display):
return hash_password(getpass.getpass(display))
def admin(username, display="Enter Password : "):
password = getpass.getpass(term.center(display))
conn = sqlite3.connect('configuration.db')
cursor = conn.cursor()
cursor.execute(f'SELECT password FROM users WHERE username = "{username}"')
if cursor.fetchone()[0] == password:
return True
else:
return False
def textBrowser(url):
try:
if not url.startswith("http://") and not url.startswith("https://"):
url = "https://" + url
response = requests.get(url, verify=True)
soup = BeautifulSoup(response.content, 'html.parser')
text = soup.get_text()
return text
except:
return f"Error fetching the site from {url}. Please check the URL and your internet connection."