In this tutorial you will learn how to use the SQLite database management system with Python. You will learn how to use SQLite, SQL queries, RDBMS and many more things !
Data is everywhere and software applications use that. Data is either in memory, files or databases.
Python has bindings for many database systems including Mysql, Oracle, Microsoft SQL Server and Maria DB.
One of these database management systems (DBMS) is called SQLite. SQLite was created in the year 2000 and is one of the many management systems in the database zoo.
SQL is a special-purpose programming language designed for managing data held in a database. The language has been around since 1986 and is worth learning. The is an old funny video about SQL
SQLite
SQLite, a relational database management system. SQLite is the most widely deployed SQL database engine in the world. The source code for SQLite is in the public domain.
It is a self-contained, serverless, zero-configuration, transactional SQL database engine. The SQLite project is sponsored by Bloomberg and Mozilla.
Install SQLite:
Use this command to install SQLite:
$ sudo apt-get install SQLite
Verify if it is correctly installed. Copy this program and save it as test1.py
#!/usr/bin/python # -*- coding: utf-8 -*-
import sqlite3 as lite importsys
con =None
try: con = lite.connect('test.db') cur = con.cursor() cur.execute('SELECT SQLITE_VERSION()') data = cur.fetchone() print"SQLite version: %s" % data except lite.Error, e: print"Error %s:" % e.args[0] sys.exit(1) finally: if con: con.close() Execute with:
$ python test1.py
It should output:
SQLite version: 3.8.2
What did the script above do? The script connected to a new database called test.db with this line:
con = lite.connect('test.db')
It then queries the database management system with the command
SELECT SQLITE_VERSION()
which in turn returned its version number. That line is known as an SQL query.
SQL Create and Insert
The script below will store data into a new database called user.db
#!/usr/bin/python# -*- coding: utf-8 -*-import sqlite3 as lite
importsys
con = lite.connect('user.db')with con:
cur = con.cursor()
cur.execute("CREATE TABLE Users(Id INT, Name TEXT)")
cur.execute("INSERT INTO Users VALUES(1,'Michelle')")
cur.execute("INSERT INTO Users VALUES(2,'Sonya')")
cur.execute("INSERT INTO Users VALUES(3,'Greg')")
SQLite is a database management system that uses tables. These tables can have relations with other tables: it’s called relational database management system or RDBMS. The table defines the structure of the data and can hold the data. A database can hold many different tables. The table gets created using the command:
cur.execute("CREATE TABLE Users(Id INT, Name TEXT)")
We add records into the table with these commands:
cur.execute("INSERT INTO Users VALUES(2,'Sonya')")
cur.execute("INSERT INTO Users VALUES(3,'Greg')")
The first value is the ID. The second value is the name. Once we run the script the data gets inserted into the database table Users:
Prerequisites Kali Linux Prior experience with wireless hacking You will also need to install a tool (bridge utils) which doesn't come pre-installed in Kali. No big deal- apt-get install bridge-utils Objectives The whole process can be broken down into the following steps- Finding out about the access point (AP) you want to imitate, and then actually imitating it (i.e. creating another access point with the same SSID and everything). We'll use airmon-ng for finding necessary info about the network, and airbase-ng to create it's twin . Forcing the client to disconnect from the real AP and connecting to yours. We'll use aireplay-ng to deauthenticate the client, and strong signal strength to make it connect to our network. Making sure the client doesn't notice that he connected to a fake AP. That basically means that we have to provide internet access to our client after he has connected to the fake wireless network. For that we will need to have i...
Cloning a card: Sim cards are manufactured on the basis of 3 algorithms COMP128v1,COMP128v2 and COMP128v3 now an important note currently only COMP128v1 version sim cards can be cloned ,since this is the only algorithm which has been cracked by users, bear in mind that 70% of all the sim cards we use are COMP128v1 . 1. Buy a SIM card Reader 2. Need a Blank SIM card or super SIM card 3. Download and install MagicSIM 4. Download and install USB SIM Card Reader Software 3.0.1.5 6. Go in phone tools, select SIM card, then select unlock SIM, it will prompt for a code. 7 Call network provider, they will ask for your phone number, your account info, name and security code, then they will ask why you want to unlock your SIM card, just tell them you need to unlock your SIM to get it to work with your overseas phone or something. 8. Once they give you the SIM unlock code, enter it, and it will say SIM unlocked. 9. Remove the SIM from your phone, place it in the card...
Comments
Post a Comment