Script Create Akun Am Premium (commonjs)
JavaScriptPublicby zx-apiAug 3, 2026, 11:52 AMExpires: Never1,326 views
1/**
2 * GenerateAmPremAkun - Pake Api Fongsidev Not ByFc
3 * Bypass: Menggunakan FongsiDev API Gak Pake ByFc Lagi Soalnya Udah di blokir website nya
4 * By Zx
5 * Sumber Kode Saluran: https://whatsapp.com/channel/0029VbDLqe7EquiSF4STU13o
6 * Saluran Rest api ya: https://whatsapp.com/channel/0029VapkSr45q08hPPPVqy26
7 */
8
9const https = require('https');
10const { URL, URLSearchParams } = require('url');
11const crypto = require('crypto');
12const zlib = require('zlib');
13const fs = require('fs');
14
15class GenerateAmPremAkun {
16 constructor(config = {}) {
17 this.baseUrl = config.baseUrl || 'https://amprem.irfanjawa.com';
18 this.timeout = config.timeout || 30000;
19 this.maxRetries = config.maxRetries || 3;
20 this.retryDelay = config.retryDelay || 2000;
21 this.debug = config.debug !== false;
22 this.turnstileSiteKey = config.turnstileSiteKey || '0x4AAAAAADsWLA16vNVNqTCH';
23 this.userAgent = 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/150.0.0.0 Mobile Safari/537.36';
24 this.cookies = new Map();
25 this.user = null;
26 this.credentials = null;
27 this.lastRequestTime = 0;
28 this.v2AdsMethod = { url: '/api/ads/record', payload: { source: 'generator-v2' } };
29 this.firebaseApiKey = 'AIzaSyDrZ9jr_Y16ltSBqsQR5IH6I04FRga6Ki0';
30
31 this.cfApiUrl = 'https://fgsi.dpdns.org/api/tools/cfclearance/turnstile-min';
32 this.cfApiKey = config.cfApiKey || 'APIKEY_REST_API_FGSI'; // Create Apikey nya di https://fgsi.dpdns.org/ ya cuki plan free gak usah premium ๐ฅฐ
33 }
34
35 _log(...a) { if (this.debug) console.log(`[AM ${new Date().toISOString().slice(11, 19)}]`, ...a); }
36 _sleep(ms) { return new Promise(r => setTimeout(r, ms)); }
37 async _rateLimit() {
38 const wait = 700 - (Date.now() - this.lastRequestTime);
39 if (wait > 0) await this._sleep(wait);
40 this.lastRequestTime = Date.now();
41 }
42 _parseCookies(list) {
43 (Array.isArray(list) ? list : [list]).forEach(c => {
44 const [name, ...v] = c.split(';')[0].split('=');
45 this.cookies.set(name.trim(), v.join('=').trim());
46 });
47 }
48 _cookieStr() { return [...this.cookies.entries()].map(([k, v]) => `${k}=${v}`).join('; '); }
49 _parseCooldown(msg) {
50 const m = /(\d+)\s*detik/i.exec(msg || '');
51 return m ? parseInt(m[1], 10) : null;
52 }
53 _randEmail() { return crypto.randomBytes(8).toString('hex') + '@zxy.com'; }
54 _randPass() { return crypto.randomBytes(12).toString('base64') + 'A1!'; }
55
56 async _request(method, path, body = null, options = {}) {
57 await this._rateLimit();
58 const url = new URL(path, this.baseUrl);
59 const headers = {
60 'User-Agent': this.userAgent,
61 'Accept': 'application/json',
62 'Accept-Encoding': 'gzip, deflate',
63 'Content-Type': 'application/json',
64 'Referer': options.referer || `${this.baseUrl}/dashboard/generator-v2`,
65 'Origin': this.baseUrl,
66 };
67 if (this.cookies.size > 0) headers['Cookie'] = this._cookieStr();
68 let payload = null;
69 if (body !== null) {
70 payload = JSON.stringify(body);
71 headers['Content-Length'] = Buffer.byteLength(payload);
72 }
73
74 let lastErr;
75 for (let attempt = 1; attempt <= this.maxRetries; attempt++) {
76 try {
77 const res = await new Promise((resolve, reject) => {
78 const req = https.request(url, { method, headers, timeout: this.timeout }, (r) => {
79 const chunks = [];
80 r.on('data', c => chunks.push(c));
81 r.on('end', () => {
82 let raw = Buffer.concat(chunks);
83 try {
84 const enc = r.headers['content-encoding'];
85 if (enc === 'gzip') raw = zlib.gunzipSync(raw);
86 else if (enc === 'deflate') raw = zlib.inflateSync(raw);
87 else if (enc === 'br') raw = zlib.brotliDecompressSync(raw);
88 } catch {}
89 resolve({ statusCode: r.statusCode, headers: r.headers, text: raw.toString('utf-8') });
90 });
91 });
92 req.on('error', reject);
93 req.on('timeout', () => { req.destroy(); reject(new Error('timeout')); });
94 if (payload) req.write(payload);
95 req.end();
96 });
97
98 if (res.headers['set-cookie']) this._parseCookies(res.headers['set-cookie']);
99 let json = null;
100 try { json = JSON.parse(res.text); } catch {}
101 const result = { statusCode: res.statusCode, text: res.text, json, ok: res.statusCode >= 200 && res.statusCode < 300 };
102
103 if (!options.silent) {
104 this._log(`${method} ${path} โ ${res.statusCode} ${json?.message || json?.error || ''}`);
105 }
106
107 if (!result.ok && !options.allowFail && res.statusCode !== 403) {
108 throw new Error(`HTTP ${res.statusCode}: ${res.text.slice(0, 120)}`);
109 }
110 return result;
111 } catch (err) {
112 lastErr = err;
113 if (attempt < this.maxRetries) await this._sleep(this.retryDelay * attempt);
114 }
115 }
116 throw lastErr;
117 }
118 _get(p, o = {}) { return this._request('GET', p, null, o); }
119 _post(p, b, o = {}) { return this._request('POST', p, b, o); }
120
121 async solveTurnstile() {
122 this._log('๐ก๏ธ Menyelesaikan Turnstile via FongsiDev API...');
123
124 const apiUrl = new URL(this.cfApiUrl);
125 apiUrl.searchParams.append('apikey', this.cfApiKey);
126 apiUrl.searchParams.append('url', `${this.baseUrl}/auth`);
127 apiUrl.searchParams.append('sitekey', this.turnstileSiteKey);
128
129 const res = await new Promise((resolve, reject) => {
130 const req = https.request(apiUrl, {
131 method: 'GET',
132 timeout: 60000,
133 headers: {
134 'Accept': 'application/json',
135 'User-Agent': this.userAgent
136 }
137 }, (r) => {
138 const chunks = [];
139 r.on('data', c => chunks.push(c));
140 r.on('end', () => {
141 let raw = Buffer.concat(chunks);
142 try {
143 const enc = r.headers['content-encoding'];
144 if (enc === 'gzip') raw = zlib.gunzipSync(raw);
145 else if (enc === 'deflate') raw = zlib.inflateSync(raw);
146 } catch {}
147 resolve({ statusCode: r.statusCode, text: raw.toString('utf-8') });
148 });
149 });
150 req.on('error', reject);
151 req.on('timeout', () => { req.destroy(); reject(new Error('API timeout')); });
152 req.end();
153 });
154
155 if (res.statusCode >= 200 && res.statusCode < 300) {
156 let json;
157 try { json = JSON.parse(res.text); } catch { throw new Error(`API mengembalikan bukan JSON: ${res.text.slice(0, 100)}`); }
158
159 // FIX: FongsiDev mengembalikan { status: true, data: { token: "..." } }
160 let token = json.result || json.token || json.response || json.cf_turnstile_response;
161 if (!token && json.data) {
162 if (typeof json.data === 'string') token = json.data;
163 else if (typeof json.data === 'object' && json.data.token) token = json.data.token;
164 }
165
166 if (!token || typeof token !== 'string' || token.length < 50) {
167 throw new Error(`API gagal mendapatkan token valid. Response: ${JSON.stringify(json).slice(0, 200)}`);
168 }
169
170 this._log(`โ Turnstile solved via FongsiDev (${token.length} chars)`);
171 return token;
172 } else {
173 throw new Error(`FongsiDev API Error ${res.statusCode}: ${res.text.slice(0, 150)}`);
174 }
175 }
176
177 async register() {
178 this.credentials = { email: this._randEmail(), password: this._randPass() };
179 this._log(`๐ Register: ${this.credentials.email}`);
180 const token = await this.solveTurnstile();
181 const res = await this._post('/api/auth/register', { ...this.credentials, turnstileToken: token }, { allowFail: true, referer: `${this.baseUrl}/auth` });
182 if (!res.ok || res.json?.success === false) throw new Error(res.json?.error || 'Register failed');
183 this._log('โ Registered');
184 }
185
186 async login() {
187 this._log(`๐ Login: ${this.credentials.email}`);
188 const token = await this.solveTurnstile();
189 const res = await this._post('/api/auth/login', { ...this.credentials, turnstileToken: token }, { allowFail: true, referer: `${this.baseUrl}/auth` });
190 if (!res.ok || !res.json?.success) throw new Error(res.json?.error || 'Login failed');
191 this.user = res.json.user;
192 this._log('โ Logged in');
193 }
194
195 async getStatus() {
196 const res = await this._get('/api/generator-v2/status', { allowFail: true });
197 return res.ok ? res.json : null;
198 }
199
200 async watchV2Ads(target = 5) {
201 this._log(`๐ฏ Menonton iklan V2 (target: ${target})...`);
202 for (let i = 0; i < 60; i++) {
203 const st = await this.getStatus();
204 const count = st?.session?.adsCompleted || 0;
205 if (count >= target) {
206 this._log(`โ Target V2 ads tercapai: ${count}/${target}`);
207 return count;
208 }
209 const res = await this._post(this.v2AdsMethod.url, this.v2AdsMethod.payload, { allowFail: true });
210 if (res.ok && res.json?.success) {
211 this._log(`โ V2 Ad recorded (Progress: ${res.json.message || ''})`);
212 await this._sleep(4000);
213 continue;
214 }
215 if (res.statusCode === 400) {
216 const wait = this._parseCooldown(res.json?.error) ?? 10;
217 this._log(`โณ Cooldown: tunggu ${wait + 1}s...`);
218 await this._sleep((wait + 1) * 1000);
219 continue;
220 }
221 throw new Error(res.json?.error || `V2 record failed HTTP ${res.statusCode}`);
222 }
223 throw new Error('V2 Ads loop melebihi batas');
224 }
225
226 async triggerAMLogin(email) {
227 this._log('๐ฅ Phase 3a: Trigger Firebase Auth (Alight Motion)...');
228 const urlV1 = `https://identitytoolkit.googleapis.com/v1/accounts:sendOobCode?key=${this.firebaseApiKey}`;
229 const payload = JSON.stringify({
230 email: email, requestType: "EMAIL_SIGNIN", continueUrl: "https://alightcreative.com",
231 canHandleCodeInApp: true, androidPackageName: "com.alightcreative.motion",
232 androidInstallApp: true, androidMinimumVersion: "12", iOSBundleId: "com.alightcreative.alightmotion"
233 });
234 const referers = ['https://alight-creative.firebaseapp.com/', 'https://alightcreative.com/'];
235 for (const referer of referers) {
236 const headers = {
237 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload),
238 'User-Agent': this.userAgent, 'X-Client-Version': 'Chrome/JsCore/10.12.0/FirebaseCore-web',
239 'Referer': referer, 'Origin': referer.endsWith('/') ? referer.slice(0, -1) : referer
240 };
241 try {
242 const res = await new Promise((resolve, reject) => {
243 const req = https.request(urlV1, { method: 'POST', headers, timeout: 15000 }, (r) => {
244 let data = ''; r.on('data', chunk => data += chunk); r.on('end', () => resolve({ statusCode: r.statusCode, text: data }));
245 });
246 req.on('error', reject); req.write(payload); req.end();
247 });
248 if (res.statusCode === 200) {
249 this._log(`โ Email verifikasi AM berhasil dikirim! (Referer: ${referer})`);
250 return true;
251 } else if (res.statusCode === 403 && res.text.includes('referer')) {
252 continue;
253 }
254 } catch (err) {}
255 }
256 return false;
257 }
258
259 _cleanDeepLink(u) {
260 if (!u) return u;
261 return u.split(/%27%3E|'%3E|'>|"%3E|">/)[0].trim();
262 }
263
264 async extractDeepLink(timeoutMs = 150000) {
265 this._log('๐ Phase 3b: menunggu server mengekstrak link2...');
266 const start = Date.now();
267 let lastStage = '';
268 while (Date.now() - start < timeoutMs) {
269 const poll = await this._get('/api/generator-v2/poll-email', { allowFail: true });
270 if (poll.ok && poll.json) {
271 if (poll.json.stage !== lastStage) {
272 this._log(` poll: [${poll.json.stage}] ${poll.json.message || ''}`);
273 lastStage = poll.json.stage;
274 }
275 const early = poll.json.link2ExtractedUrl || poll.json.url || poll.json.deepLink;
276 if (early) return this._cleanDeepLink(early);
277 }
278 const st = await this.getStatus();
279 const url = st?.session?.link2ExtractedUrl;
280 if (url) {
281 this._log('โ Deep link didapatkan!');
282 return this._cleanDeepLink(url);
283 }
284 await this._sleep(5000);
285 }
286 return null;
287 }
288
289 _extractOobCode(deepLink) {
290 try {
291 const url = new URL(deepLink);
292 let innerLink = url.searchParams.get('link') || deepLink;
293 innerLink = decodeURIComponent(innerLink);
294 const innerUrl = new URL(innerLink);
295 return innerUrl.searchParams.get('oobCode');
296 } catch (e) {
297 const match = /oobCode(?:%3D|=)([^&%]+)/i.exec(deepLink);
298 return match ? decodeURIComponent(match[1]) : null;
299 }
300 }
301
302 async getFirebaseTokens(email, oobCode) {
303 this._log('๐ฅ Phase 4: Menukar oobCode dengan Firebase Tokens...');
304 const url = `https://identitytoolkit.googleapis.com/v1/accounts:signInWithEmailLink?key=${this.firebaseApiKey}`;
305 const payload = JSON.stringify({ email, oobCode });
306 const headers = {
307 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload),
308 'User-Agent': this.userAgent, 'X-Client-Version': 'Chrome/JsCore/10.12.0/FirebaseCore-web',
309 'Referer': 'https://alight-creative.firebaseapp.com/', 'Origin': 'https://alight-creative.firebaseapp.com'
310 };
311 const res = await new Promise((resolve, reject) => {
312 const req = https.request(url, { method: 'POST', headers, timeout: 15000 }, (r) => {
313 let data = ''; r.on('data', chunk => data += chunk); r.on('end', () => resolve({ statusCode: r.statusCode, text: data }));
314 });
315 req.on('error', reject); req.write(payload); req.end();
316 });
317 if (res.statusCode === 200) {
318 const json = JSON.parse(res.text);
319 this._log('โ Firebase Tokens berhasil diekstrak!');
320 return { idToken: json.idToken, refreshToken: json.refreshToken, email: json.email };
321 }
322 this._log(`โ ๏ธ Gagal mendapatkan tokens: ${res.statusCode} ${res.text.slice(0, 100)}`);
323 return null;
324 }
325
326 _extractLinkFromText(text) {
327 if (!text) return null;
328 const m = /https:\/\/alight-creative\.firebaseapp\.com\/__\/auth\/links\?[^"'<>\s\\]+/i.exec(text);
329 if (m) return m[0].replace(/&/g, '&');
330 const m2 = /https:\/\/alightcreative\.com\/auth_action\/\?[^"'<>\s\\]+/i.exec(text);
331 return m2 ? m2[0].replace(/&/g, '&') : null;
332 }
333
334 async _tryTempMailInbox(tempEmail, silent = false) {
335 const candidates = [
336 `/api/temp-mail/messages?email=${encodeURIComponent(tempEmail)}`,
337 `/api/temp-mail/inbox?email=${encodeURIComponent(tempEmail)}`,
338 `/api/temp-mail/messages?address=${encodeURIComponent(tempEmail)}`,
339 ];
340 for (const p of candidates) {
341 try {
342 const res = await this._get(p, { allowFail: true, silent });
343 if (res.ok && res.text && /alight/i.test(res.text)) {
344 const link = this._extractLinkFromText(res.text);
345 if (link) return link;
346 }
347 } catch {}
348 }
349 return null;
350 }
351
352 async waitForAppLink(previousLink, tempEmail, timeoutMs = 240000) {
353 this._log('๐ฑ Phase 5: menunggu link login BARU dari aplikasi di HP Anda...');
354 const prevCode = this._extractOobCode(previousLink || '');
355 const start = Date.now();
356 let dotCount = 0;
357
358 while (Date.now() - start < timeoutMs) {
359 const stRes = await this._get('/api/generator-v2/status', { allowFail: true, silent: true });
360 const st = stRes?.ok ? stRes.json : null;
361 const u1 = st?.session?.link2ExtractedUrl;
362 if (u1 && this._extractOobCode(u1) && this._extractOobCode(u1) !== prevCode) {
363 if (dotCount > 0) process.stdout.write('\n');
364 return this._cleanDeepLink(u1);
365 }
366
367 const poll = await this._get('/api/generator-v2/poll-email', { allowFail: true, silent: true });
368 const u2 = poll?.json?.link2ExtractedUrl || poll?.json?.url || poll?.json?.deepLink;
369 if (u2 && this._extractOobCode(u2) && this._extractOobCode(u2) !== prevCode) {
370 if (dotCount > 0) process.stdout.write('\n');
371 return this._cleanDeepLink(u2);
372 }
373
374 const u3 = await this._tryTempMailInbox(tempEmail, true);
375 if (u3 && this._extractOobCode(u3) && this._extractOobCode(u3) !== prevCode) {
376 if (dotCount > 0) process.stdout.write('\n');
377 return this._cleanDeepLink(u3);
378 }
379
380 process.stdout.write('.');
381 dotCount++;
382 if (dotCount % 60 === 0) process.stdout.write('\n');
383
384 await this._sleep(4000);
385 }
386 if (dotCount > 0) process.stdout.write('\n');
387 return null;
388 }
389
390 async fullAutoWorkflow() {
391 console.log('โ'.repeat(62));
392 console.log('๐ GenerateAmPremAkun v21 - Pake Api Fongsidev Not ByFc');
393 console.log('โ'.repeat(62));
394
395 await this.register();
396 await this.login();
397 await this.watchV2Ads(1);
398
399 this._log('๐ง Generate Temp Mail...');
400 const gen = await this._post('/api/temp-mail/generate', {}, { allowFail: true });
401 if (!gen.ok || !gen.json?.success) throw new Error(gen.json?.error || 'Gagal buat temp mail');
402 const tempEmail = gen.json.emailAddress;
403 this._log(`โ Temp email: ${tempEmail} (sisa poin: ${gen.json.adPoints})`);
404
405 await this.watchV2Ads(5);
406
407 this._log('๐ Select Email & Trigger Magic Link...');
408 const sel = await this._post('/api/generator-v2/select-email', { emailAddress: tempEmail }, { allowFail: true });
409 if (!sel.ok || !sel.json?.success) throw new Error(sel.json?.error || 'select-email gagal');
410 this._log(`โ ${sel.json.message}`);
411
412 this._log('โณ Polling verifikasi link1 (premium)...');
413 let premium = false;
414 for (let i = 0; i < 40 && !premium; i++) {
415 await this._sleep(3000);
416 const poll = await this._get('/api/generator-v2/poll-email', { allowFail: true });
417 if (poll.ok && poll.json?.message) {
418 this._log(` poll: [${poll.json.stage}] ${poll.json.message}`);
419 if (/premium aktif/i.test(poll.json.message)) premium = true;
420 }
421 const st2 = await this.getStatus();
422 if (st2?.isPremium === true) premium = true;
423 }
424
425 let deepLink = null;
426 let tokens = null;
427 if (premium) {
428 const firebaseOk = await this.triggerAMLogin(tempEmail);
429 if (firebaseOk) {
430 deepLink = await this.extractDeepLink();
431 if (deepLink) {
432 const oobCode = this._extractOobCode(deepLink);
433 if (oobCode) tokens = await this.getFirebaseTokens(tempEmail, oobCode);
434 }
435 }
436 }
437
438 let appLink = null;
439 if (premium) {
440 console.log('');
441 console.log('๐ฑ SEKARANG DI HP ANDA (script menunggu 4 menit):');
442 console.log(` 1. Buka aplikasi Alight Motion.`);
443 console.log(` 2. Login โ pilih masuk dengan EMAIL.`);
444 console.log(` 3. Ketik email: ${tempEmail}`);
445 console.log(` 4. Aplikasi akan mengirim email login.`);
446 console.log(' Script otomatis menyergap link loginnya...');
447 appLink = await this.waitForAppLink(deepLink, tempEmail);
448 if (appLink) {
449 this._log('โ Link login aplikasi BARU berhasil disergap!');
450 }
451 }
452
453 const final = await this.getStatus();
454
455 console.log('โ'.repeat(62));
456 console.log(premium ? 'โ
โ
PREMIUM SUKSES DIAKTIFKAN! โ
โ
' : 'โ ๏ธ Cek status di atas');
457 console.log(` Email AM : ${tempEmail}`);
458 console.log(` Premium : ${premium ? 'YES' : 'NO'}`);
459 if (tokens) {
460 console.log('โ'.repeat(62));
461 console.log('๐ (OPSIONAL - untuk Mod APK) Refresh Token:');
462 console.log(` ${tokens.refreshToken}`);
463 }
464 if (appLink) {
465 console.log('โ'.repeat(62));
466 console.log('๐ฑ LINK LOGIN APLIKASI RESMI (DEEP LINK):');
467 console.log(' โ ๏ธ PENTING: JANGAN paste langsung di address bar Chrome!');
468 console.log(' ๐ฒ CARA PAKAI:');
469 console.log(' 1. Copy link di bawah, kirim ke WA / Telegram / Gmail di HP.');
470 console.log(' 2. Buka pesan tsb, KLIK linknya dari dalam WA/Gmail.');
471 console.log(' 3. Pilih "Buka di Alight Motion" saat muncul pop-up.');
472 console.log('โ'.repeat(62));
473 console.log(appLink);
474 console.log('โ'.repeat(62));
475 fs.writeFileSync('app_login_link.txt', appLink);
476 } else if (premium) {
477 console.log('โ'.repeat(62));
478 console.log('โ ๏ธ Script gagal menyergap link otomatis. Cara manual:');
479 console.log(' Buka dashboard amprem โ menu Temp Mail di HP โ');
480 console.log(' buka email terbaru dari Alight Motion โ ketuk linknya.');
481 }
482 console.log('โ'.repeat(62));
483
484 return { timestamp: new Date().toISOString(), credentials: this.credentials, tempEmail, premium, tokens, deepLink, appLink };
485 }
486}
487
488(async () => {
489 const scraper = new GenerateAmPremAkun({ debug: true });
490 try {
491 const result = await scraper.fullAutoWorkflow();
492 const file = `premium_${Date.now()}.json`;
493 fs.writeFileSync(file, JSON.stringify(result, null, 2));
494 console.log(`๐พ Saved: ${file}${result.appLink ? ' + app_login_link.txt' : ''}`);
495 } catch (e) {
496 console.error('โ Fatal:', e.message);
497 process.exit(1);
498 }
499})();499 linesยท21,367 charsยท21.0 KB
WwrapยทFfullscreen