Skip to content

This Repository is a collection of different ethical hacking tools and malware's for penetration testing and research purpose written in python, ruby, rust, c++, go and c.

Create sqlite_connection.py

Abdul Wahab Junaid7de5f528d831
diff --git a/Python Tools/sqlite/sqlite_connection.py b/Python Tools/sqlite/sqlite_connection.py
new file mode 100644
index 0000000..b24a761
--- /dev/null
+++ b/Python Tools/sqlite/sqlite_connection.py
@@ -0,0 +1,20 @@
+#!/usr/bin/python3
+
+import sqlite3
+from sqlite3 import DatabaseError
+
+def read_from_db(cursor):
+ cursor.execute('SELECT * FROM Customer')
+ data = cursor.fetchall()
+ print(data)
+ for row in data:
+ print(row)
+
+try:
+ connection = sqlite3.connect("database.sqlite")
+ cursor = connection.cursor()
+ read_from_db(cursor)
+except DatabaseError as exception:
+ print("DatabaseError:",exception)
+finally:
+ connection.close()