-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsettings.py
More file actions
69 lines (55 loc) · 1.88 KB
/
settings.py
File metadata and controls
69 lines (55 loc) · 1.88 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
#! /usr/bin/env python
# This script is a part of SQL_easy
# written by DiaaDiab
import sys
import readline
from subprocess import Popen
from platform import platform as OS
try:
import MySQLdb
except:
print '[*] Install Module <MySQL> for python.'
sys.exit()
HostName = None # remove None and set your host of MySQL server
UserName = None # remove None and set user of MySQL server
PassWord = None # remove None and set password of MySQL server
def InitConnection():
'''set things to connect to MySQL'''
global HostName
global UserName
global PassWord
if None in (HostName, UserName, PassWord):
print '[*] you must verify variables in settings.py to allow'
print '[*] programme to connect to MySQL>Line number (15, 16, 17)'
# fire up a text editor
choice = raw_input("\n[+] Should I fire up a text ediror for you (y/n)? ")
if choice == 'y':
if 'linux' in OS().lower():
Popen('vi settings.py', shell=True).wait()
elif 'windows' in OS().lower():
Popen('notepad settings.py', shell=True).wait()
else:
msg = "[+] Could not detect the running OS "
msg += 'please, edit settings.py manually'
exit(msg)
else:
print "[+] Thanks for using SQL Easy"
sys.exit()
try:
MyConnection = MySQLdb.connect(
host=HostName,
user=UserName,
passwd=PassWord
)
Cursor = MyConnection.cursor()
print '[+] Connection done.'
print '[+] MySQL in your help !!'
except:
print '[*] you have an error in your connection'
print '[*] make sure to verify parameters and try again'
sys.exit()
return (MyConnection, Cursor)
def main():
pass
if __name__ == '__main__':
main()