Skip to content

Commit 37d9271

Browse files
committed
test from kali -> pycharm ui
Signed-off-by: ABHIJIT SINHA <grey.shell@gmail.com>
1 parent 461812e commit 37d9271

10 files changed

Lines changed: 69 additions & 28 deletions

File tree

‎web/boilerplate/test_mysql.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def safe_select_all_query(self):
3434
return False, e
3535

3636
def unsafe_select_query(self, user):
37-
# creating the cursor
37+
# create the cursor
3838
cursor = self.db.conn.cursor()
3939
rows = None
4040
try:
Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# author: greyshell
2-
# usage: mysql -u root -p < resource.sql
3-
# alternale usage for automation: mysql -u root --password=mypass < resource.sql
2+
# description: truncate tables
3+
# usage: mysql -u root --password=<pass> < db_clean.sql
4+
# lab: sqli
45

5-
# sql injection: case02, clear the posts
6-
delete from vulnapp.tbl_post02 where user NOT LIKE 'asinha%';
6+
# case02: clear all posts, not created by 'asinha'
7+
DELETE FROM vulnapp.tbl_post02 WHERE user NOT LIKE 'asinha%';
78

8-
# sql injection: case03, clear the posts
9-
delete from vulnapp.tbl_post03 where user LIKE 'anonymous-%';
10-
update vulnapp.tbl_post03 set age = 25, comment = 'Hello', city = 'San Jose' where user = 'admin';
9+
# case03: clear all posts, created by default anonymous user
10+
DELETE FROM vulnapp.tbl_post03 WHERE user LIKE 'anonymous-%';
11+
12+
# case03: reset to the default settings
13+
UPDATE vulnapp.tbl_post03 SET age = 25, comment = 'Hello', city = 'San Jose' WHERE user = 'admin';
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
# author: greyshell
2-
# usage: mysql -u root -p < resource.sql
3-
# alternale usage for automation: mysql -u root --password=mypass < resource.sql
2+
# description: drop all tables and db
3+
# usage: mysql -u root --password=<pass> < db_drop.sql
4+
# lab: sqli
45

5-
# drop all tables
6-
# sql injection: case01
6+
7+
# case01:
78
DROP TABLE vulnapp.tbl_post01
89

9-
# sql injection: case02
10+
# case02:
1011
DROP TABLE vulnapp.tbl_post02
1112
DROP TABLE vulnapp.tbl_secret
1213

13-
# sql injection: case03
14+
# case03:
1415
DROP TABLE vulnapp.tbl_post03
1516

1617
DROP DATABASE vulnapp;

‎web/sqli/db_house-keeping/db_setup.sql‎

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# author: greyshell
2-
# usage: mysql -u root -p < resource.sql
3-
# alternale usage for automation: mysql -u root --password=mypass < resource.sql
2+
# description: create db, tables and inset data
3+
# usage: mysql -u root --password=<pass> < db_setup.sql
4+
# lab: sqli
45

5-
# create database
6-
CREATE DATABASE vulnapp;
76

8-
# sql injection: case01
9-
CREATE TABLE vulnapp.tbl_post01 (
7+
CREATE DATABASE IF NOT EXISTS vulnapp;
8+
9+
# case01:
10+
CREATE TABLE IF NOT EXISTS vulnapp.tbl_post01 (
1011
comment VARCHAR(30) NOT NULL,
1112
user VARCHAR(10) NOT NULL
1213
);
@@ -16,8 +17,8 @@ INSERT INTO vulnapp.tbl_post01 (comment, user) VALUES ('hi', 'usman');
1617
INSERT INTO vulnapp.tbl_post01 (comment, user) VALUES ('ola', 'amol');
1718

1819

19-
# sql injection: case02
20-
CREATE TABLE vulnapp.tbl_post02 (
20+
# case02:
21+
CREATE TABLE IF NOT EXISTS vulnapp.tbl_post02 (
2122
comment VARCHAR(30) NOT NULL,
2223
pin INT NOT NULL,
2324
age INT NOT NULL,
@@ -26,7 +27,7 @@ user VARCHAR(30) NOT NULL
2627

2728
INSERT INTO vulnapp.tbl_post02 (comment, pin, age, user) VALUES ('hola', 100, 25, 'dhaval');
2829

29-
CREATE TABLE vulnapp.tbl_secret (
30+
CREATE TABLE IF NOT EXISTS vulnapp.tbl_secret (
3031
user VARCHAR(30) NOT NULL,
3132
token INT NOT NULL,
3233
password VARCHAR(30) NOT NULL
@@ -35,8 +36,8 @@ password VARCHAR(30) NOT NULL
3536
INSERT INTO vulnapp.tbl_secret (user, token, password) VALUES ('asinha', 777, 'blue@123');
3637
INSERT INTO vulnapp.tbl_secret (user, token, password) VALUES ('admin', 101, 'grey@321');
3738

38-
# sql injection: case03
39-
CREATE TABLE vulnapp.tbl_post03 (
39+
# case03:
40+
CREATE TABLE IF NOT EXISTS vulnapp.tbl_post03 (
4041
comment VARCHAR(30) NOT NULL,
4142
city VARCHAR(30) NOT NULL,
4243
age INT NOT NULL,

‎web/sqli/template/case01.html‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ <h2>SQL Injection</h2>
1919
<i>author: greyshell</i><br><br>
2020
Objective: extract admin's password and token <br><br>
2121
<form method="POST">
22-
Enter a user to view his comments:
22+
Enter a user (e.g. usman, pedro, amol) to view his comments:
23+
<br><br>
2324
<label>
2425
<input type="text" name="user" size=100/>
2526
</label><br/><br/>

‎web/sqli/template/case02.html‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
<body>
1818
<h2>SQL Injection</h2>
1919
<i>author: greyshell</i><br><br>
20-
Objective: extract admin's token(INT) and password(VARCHAR) from a secret table<br><br>
20+
Objective: extract admin's token(INT) and password(VARCHAR) from the "secret" table<br><br>
2121
<form method="POST">
22-
Enter your comment:
22+
Enter your comment as an anonymous user:
2323
<label>
2424
<input type="text" name="comment" size=100/>
2525
</label><br/><br/>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# author: greyshell
2+
# description: truncate tables
3+
# usage: mysql -u root --password=<pass> < db_clean.sql
4+
# lab: xss
5+
6+
TRUNCATE TABLE vulnapp.tbl_users;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# author: greyshell
2+
# description: drop all tables an db
3+
# usage: mysql -u root --password=<pass> < db_drop.sql
4+
# lab: xss
5+
6+
DROP TABLE vulnapp.tbl_users;
7+
8+
DROP DATABASE vulnapp;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# author: greyshell
2+
# description: create db, tables and inset data
3+
# usage: mysql -u root --password=<pass> < db_setup.sql
4+
# lab: xss
5+
6+
7+
CREATE DATABASE IF NOT EXISTS vulnapp;
8+
9+
CREATE TABLE IF NOT EXISTS vulnapp.tbl_users (
10+
id INT(11) NOT NULL AUTO_INCREMENT,
11+
username VARCHAR(25) NOT NULL,
12+
password VARCHAR(25) NOT NULL,
13+
name VARCHAR(25) NOT NULL,
14+
age INT(11) NOT NULL,
15+
PRIMARY KEY (id)
16+
);
17+
18+
INSERT INTO vulnapp.tbl_users (username, password, name, age) VALUES ('admin', 'abc', 'admin', 38);
19+
INSERT INTO vulnapp.tbl_users (username, password, name, age) VALUES ('vampire', 'xyz', 'dhaval', 22);

‎web/xss/template/welcome.html‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,7 @@
1616
<input type="button" value="submit" onclick="changeAgeRequest()"/><br/>
1717
<span id="notice"></span>
1818
</form>
19+
<br>
20+
note: xss end point: /xss?payload=your_script
1921
</body>
2022
</html>

0 commit comments

Comments
 (0)