forked from dia2diab/SQL_easy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.py
More file actions
54 lines (40 loc) · 1.23 KB
/
settings.py
File metadata and controls
54 lines (40 loc) · 1.23 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
#! /usr/bin/env python
#This script is a part of SQL_easy
#written by DiaaDiab
import sys
import readline
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 setting.py to allow'
print '[*]programme to connect to MySQL>Line number (15, 16, 17)'
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()