FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Python/sqlite_table_check.py at master · machineL1994/Python · GitHub
machineL1994
/
Python
Public
forked from
geekcomputers/Python
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
Python
/
sqlite_table_check.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
47 lines (36 loc) · 1.3 KB
Breadcrumbs
Python
/
sqlite_table_check.py
Copy path
File metadata and controls
47 lines (36 loc) · 1.3 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
# Script Name : sqlite_table_check.py
# Author : Craig Richards
# Created : 07 June 2013
# Last Modified :
# Version : 1.0
# Modifications :
# Description : Checks the main SQLITE database to ensure all the tables should exist
import
sqlite3
import
sys
import
os
dropbox
=
os
.
getenv
(
"dropbox"
)
config
=
os
.
getenv
(
"my_config"
)
dbfile
=
(
"Databases\jarvis.db"
)
listfile
=
(
"sqlite_master_table.lst"
)
master_db
=
os
.
path
.
join
(
dropbox
,
dbfile
)
config_file
=
os
.
path
.
join
(
config
,
listfile
)
tablelist
=
open
(
config_file
,
'r'
);
conn
=
sqlite3
.
connect
(
master_db
)
cursor
=
conn
.
cursor
()
cursor
.
execute
(
'SELECT SQLITE_VERSION()'
)
data
=
cursor
.
fetchone
()
if
str
(
data
)
==
"(u'3.6.21',)"
:
print
(
"
\n
Currently "
+
master_db
+
" is on SQLite version: %s"
%
data
+
" - OK -
\n
"
)
else
:
print
(
"
\n
DB On different version than master version - !!!!!
\n
"
)
conn
.
close
()
print
(
"
\n
Checkling "
+
master_db
+
" against "
+
config_file
+
"
\n
"
)
for
table
in
tablelist
.
readlines
():
conn
=
sqlite3
.
connect
(
master_db
)
cursor
=
conn
.
cursor
()
cursor
.
execute
(
"select count(*) from sqlite_master where name = ?"
,(
table
.
strip
(), ))
res
=
cursor
.
fetchone
()
if
(
res
[
0
]):
print
(
'[+] Table : '
+
table
.
strip
()
+
' exists [+]'
)
else
:
print
(
'[-] Table : '
+
table
.
strip
()
+
' does not exist [-]'
)
Back
|
FazBrowse Home
|
New Git URL