Create srv.js
Browse files
srv.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const express=require('express'),fs=require('fs'),path=require('path'),os=require('os');
|
| 2 |
+
const app=express(),port=7860;
|
| 3 |
+
const allow=['MLBB','BS','PUBG'];
|
| 4 |
+
async function pull(g){
|
| 5 |
+
if(!allow.includes(g)) throw 0;
|
| 6 |
+
const s=(await(await fetch('https://aamod.site/genkey/index.php')).text()).match(/sessionToken\s*=\s*["']([^"']+)/)[1];
|
| 7 |
+
const d=Buffer.from(`game=${g}&token=${s}`).toString('base64');
|
| 8 |
+
return (await(await fetch(`https://aamod.site/genkey/genkey.php?data=${d}`)).text()).match(/gameKey[^>]*>([^<]+)/)[1].trim();
|
| 9 |
+
}
|
| 10 |
+
app.get('/key',async(q,r)=>{try{r.json({key:await pull(q.query.game||'MLBB')})}catch{r.status(500).json({e:1})}});
|
| 11 |
+
app.get('/key/bulk',async(q,r)=>{try{const g=q.query.game||'MLBB',n=Math.min(parseInt(q.query.qty)||10,1000),k=await Promise.all([...Array(n)].map(()=>pull(g))),f=path.join(os.tmpdir(),`${g}-${Date.now()}.txt`);fs.writeFileSync(f,k.join('\n'));r.download(f,()=>fs.unlinkSync(f))}catch{r.status(500).json({e:1})}});
|
| 12 |
+
app.listen(port,()=>console.log(port));
|