-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMetaMail_Database_Setup.py
More file actions
87 lines (86 loc) · 4.24 KB
/
MetaMail_Database_Setup.py
File metadata and controls
87 lines (86 loc) · 4.24 KB
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
import time
import os
import random
import subprocess
import platform
osident=platform.system()
if "Windows" in osident:
clear=lambda:os.system("cls")
elif "Linux" in osident:
clear=lambda:os.system("clear")
elif "Darwin" in osident:
clear=lambda:os.system("clear")
else:
print("Unknown O.S. Using Default 'Windows Configuration'")
def logo():
clear()
colour=random.randint(31,37)
print('''\033[1;%s;40m
███╗ ███╗███████╗████████╗ █████╗ ███╗ ███╗ █████╗ ██╗██╗ ██████╗ ██████╗ ██╗ ██╗
████╗ ████║██╔════╝╚══██╔══╝██╔══██╗████╗ ████║██╔══██╗██║██║ ╚════██╗ ╚════██╗██║ ██║
██╔████╔██║█████╗ ██║ ███████║██╔████╔██║███████║██║██║ █████╔╝ █████╔╝███████║
██║╚██╔╝██║██╔══╝ ██║ ██╔══██║██║╚██╔╝██║██╔══██║██║██║ ╚═══██╗ ██╔═══╝ ╚════██║
██║ ╚═╝ ██║███████╗ ██║ ██║ ██║██║ ╚═╝ ██║██║ ██║██║███████╗ ██████╔╝██╗███████╗██╗ ██║
╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝╚══════╝ ╚═════╝ ╚═╝╚══════╝╚═╝ ╚═╝
[Script By: Kanad Nemade | Github: Arduino3128]
\n'''%colour)
print(" ")
print(" ")
print("Welcome to MetaMail 3.2.4, Best Off-Grid, Light-Weight and Secure E-mail Service with SHA-256 Encryptions")
print("")
print("")
try:
import mysql.connector
except:
logo()
print("MySQL Connector not found! Starting 'mysql-connector-python' Module installing Procedure!")
if osident=="Windows":
piploc=input("Enter the directory path of Python: ")
subprocess.call("cd %s/Scripts && pip install mysql-connector-python "%piploc, shell=True)
subprocess.call("MetaMail_Database_setup.py", shell=True)
elif osident=="Linux" or osident=="Darwin":
subprocess.call("pip install mysql-connector-python", shell=True)
subprocess.call("python3 MetaMail_Database_setup.py", shell=True)
else:
print("Unknown OS, Try Installing 'mysql-connector-python' manually!")
exit()
time.sleep(5)
logo()
print(" ")
print("Welcome to MetaMail Database Setup!")
print("")
time.sleep(2)
userinput=input("Enter Username(Contact Admin For Username) ")
passwdinput=input("Enter Password(Contact Admin For Password) ")
portinput=input("Enter Port No. of the Server(Contact Admin For Port No.) ")
hostinput=input("Enter host IP ")
def connerr():
logo()
print("Server Unreachable! Maybe the Server is down! Try Again Later!")
time.sleep(4)
exit()
try:
dbc = mysql.connector.connect(
host=hostinput,
user=userinput,
passwd=passwdinput,
port=portinput,
auth_plugin='caching_sha2_password')
except:
connerr()
c = dbc.cursor()
logo()
dbinput=input("Enter Database Name/ID: ")
print("Please Wait Setup is Running.....")
c.execute("CREATE DATABASE %s;"%dbinput")
dbc.commit()
c.execute("USE %s;"%dbinput)
c.execute("CREATE TABLE user(ID VARCHAR(255) PRIMARY KEY, Password LONGTEXT, ForgotQues LONGBLOB, ForgotPass LONGTEXT);")
dbc.commit()
c.execute('insert into user values("user","None","Not Applicable","None")')
dbc.commit()
print("")
print("Setup Finished Sucessfully!")
print("Exiting......")
print("")
time.sleep(5)