MCPcopy Create free account
hub / github.com/geekcomputers/Python / isSQLite3

Function isSQLite3

check_for_sqlite_files.py:16–31  ·  view source on GitHub ↗
(filename)

Source from the content-addressed store, hash-verified

14
15
16def isSQLite3(filename):
17 from os.path import isfile, getsize
18
19 if not isfile(filename):
20 return False
21 if getsize(filename) < 100: # SQLite database file header is 100 bytes
22 return False
23 else:
24 fd = open(filename, "rb")
25 header = fd.read(100)
26 fd.close()
27
28 if header[0:16] == "SQLite format 3\000":
29 return True
30 else:
31 return False
32
33
34log = open("sqlite_audit.txt", "w")

Callers 1

Calls 1

closeMethod · 0.45

Tested by

no test coverage detected