SQL Injection Diary 3

0x00 XD
So the day before yesterday we've learned how to create a database and create a table. Today we will learn how to load data into our tables.

0x01 Loading data into tables(LOAD DATA)
In this situation we will use two commands. LOAD DATA and INSERT.
LOAD DATA command can load data which from your local files. You can write a new row into a txt file.Then load it into tables, like this:
pet.txt:
Whistler Gwen bird \N 1997-12-09 \N
A point should be confirmed:the whitespace is a single tab character. And if you dont know values of some attribute, use \N represent null.
then use command:
LOAD DATA LOCAL INFILE '/path/pet.txt' INTO TABLE pet;

And since we use Windows, we should use '\r\n' as the line terminator. So use this:
LINES TERMINATED BY '\r\n';
SO after that, we have successfully loaded some data into table.

and next is INSERT.

0x02 Loading data into tables(INSERT)
use this:
INSERT INTO pet
VALUES ('Puffball','Diane','hamster','f','1999-03-30',NULL);
after that we insert some data into the table.
INSERT INTO tablename
VALUES ('','','','',···);
if you need to insert strings into tables, pls use '' or "" to include the strings.

0x03 Retrieving Information From Tables
After we load data into table.We can retrieve data from our tables.
And this is why SQL Injections exist————It's very important.

First thing is select all data from a table like this:
SELECT * FROM tablename;
then it will show all information of this table.

Then how to renew some special data in tables?
1.Use DELETE to delete the data and reload the data through txt files.
2.Use UPDATE to update data like this:
UPDATE pet SET birth = '1989-08-31' WHERE name = 'Bowser';
'where' is relative to the 'key': as name in this table, or as ID in another table. Key is the only property of a row.

I feel very tired.sh1t.

posted @ 2020-11-19 22:59  ChristopherWu  阅读(61)  评论(0编辑  收藏  举报