-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathsql3reader.py
52 lines (40 loc) · 1.78 KB
/
sql3reader.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
import os, sys, gzip, shutil, sqlite3
try:
with gzip.open('vip_sys_db.sql.gz', 'rb') as f_in:
with open('vip_sys_db.sql', 'wb') as f_out:
shutil.copyfileobj(f_in, f_out)
except:
print("vip_sys_db.sql.gz not found. Will try to open the unpacked one.")
con = sqlite3.connect("vip_sys_db.sql")
cur = con.cursor()
res = cur.execute("SELECT obj_id, obj_data FROM vipDB WHERE obj_id=156")
obj_id, obj_data = res.fetchone()
print("Train: %s" % obj_data.upper())
res = cur.execute("SELECT obj_id, obj_data FROM vipDB WHERE obj_id=100")
obj_id, obj_data = res.fetchone()
print("SW ver: %s" % obj_data.upper())
res = cur.execute("SELECT obj_id, obj_data FROM vipDB WHERE obj_id=138")
obj_id, obj_data = res.fetchone()
print("MU: %s" % obj_data.upper())
res = cur.execute("SELECT obj_id, obj_data FROM vipDB WHERE obj_id=115")
obj_id, obj_data = res.fetchone()
print("PN: %s" % obj_data.upper())
res = cur.execute("SELECT obj_id, obj_data FROM vipDB WHERE obj_id=116")
obj_id, obj_data = res.fetchone()
print("HW: %s" % obj_data.upper())
res = cur.execute("SELECT obj_id, obj_data FROM vipDB WHERE obj_id=121")
obj_id, obj_data = res.fetchone()
print("Fazit: %s" % obj_data.upper())
con.text_factory = bytes
cur = con.cursor()
res = cur.execute("SELECT obj_id, obj_data FROM vipDB WHERE obj_id=139")
obj_id, obj_data = res.fetchone()
print("Coding: %s" % obj_data.hex().upper())
res = cur.execute("SELECT obj_id, obj_data FROM vipDB WHERE obj_id=33")
obj_id, obj_data = res.fetchone()
print("Dataset 280 (default languages): %s" % obj_data.hex().upper()[0x45*2:0x5B*2])
res = cur.execute("SELECT obj_id, obj_data FROM vipDB WHERE obj_id=37")
obj_id, obj_data = res.fetchone()
print("Dataset 2D00 (HMI languages): %s" % obj_data.hex().upper()[8:786])
input("\nPress Enter to exit...")
sys.exit(1)