├── main.js ├── .gitignore ├── src ├── json │ └── client_secret.json.example ├── utils │ ├── generator.js │ └── logger.js ├── classes │ ├── authGmail.js │ ├── proxy.js │ └── ariChain.js └── index.js ├── package.json └── readme.md /main.js: -------------------------------------------------------------------------------- 1 | const { main } = require("./src"); 2 | 3 | main().catch((err) => console.error(err)); 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | package-lock.json 2 | accounts.txt 3 | accountsBot.txt 4 | node_modules/ 5 | src/json/token.json 6 | src/json/client_secret.json 7 | proxy.txt -------------------------------------------------------------------------------- /src/json/client_secret.json.example: -------------------------------------------------------------------------------- 1 | { 2 | "email": "your_email", 3 | "geminiApi": "your_apikey", 4 | "prompt": "This is a CAPTCHA image. Please read and provide only the text/characters shown in the image. Return only the characters, no additional text or explanation.", 5 | "captha2Apikey": "your_2captcha_apikey", 6 | "installed": { 7 | "client_id": "your_client_id", 8 | "project_id": "your_project_id", 9 | "auth_uri": "your_auth_uri", 10 | "token_uri": "your_token_uri", 11 | "auth_provider_x509_cert_url": "your_auth_provider_x509_cert_url", 12 | "client_secret": "your_client_secret", 13 | "redirect_uris": [ 14 | "http://localhost:3000/oauth2callback" 15 | ] 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "arichain-autoref", 3 | "version": "1.0.0", 4 | "description": "auto reff arichain", 5 | "main": "main.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": { 12 | "@2captcha/captcha-solver": "^1.3.0", 13 | "@faker-js/faker": "^9.3.0", 14 | "@google-cloud/local-auth": "^3.0.1", 15 | "@google/generative-ai": "^0.21.0", 16 | "axios": "^1.7.9", 17 | "chalk": "^4.1.2", 18 | "cheerio": "^1.0.0", 19 | "express": "^4.21.2", 20 | "fs": "^0.0.1-security", 21 | "googleapis": "^144.0.0", 22 | "https-proxy-agent": "^7.0.6", 23 | "nodemailer": "^6.9.16", 24 | "qs": "^6.14.0", 25 | "readline": "^1.3.0", 26 | "socks-proxy-agent": "^8.0.5" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/utils/generator.js: -------------------------------------------------------------------------------- 1 | class EmailGenerator { 2 | constructor(baseEmail) { 3 | this.baseEmail = baseEmail; 4 | } 5 | 6 | generateCaseVariations() { 7 | const [username, domain] = this.baseEmail.split("@"); 8 | let newUsername = ""; 9 | 10 | for (let char of username) { 11 | if (Math.random() < 0.5) { 12 | newUsername += char.toUpperCase(); 13 | } else { 14 | newUsername += char.toLowerCase(); 15 | } 16 | } 17 | 18 | return `${newUsername}@${domain}`; 19 | } 20 | 21 | generateRandomVariation() { 22 | return this.generateCaseVariations(); 23 | } 24 | } 25 | 26 | function generateRandomPassword(length = 12) { 27 | const charset = 28 | "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+-=[]{}|;:,.<>?"; 29 | let password = ""; 30 | 31 | for (let i = 0; i < length; i++) { 32 | const randomIndex = Math.floor(Math.random() * charset.length); 33 | password += charset[randomIndex]; 34 | } 35 | 36 | return password; 37 | } 38 | 39 | module.exports = { EmailGenerator, generateRandomPassword }; 40 | -------------------------------------------------------------------------------- /src/utils/logger.js: -------------------------------------------------------------------------------- 1 | const readline = require("readline"); 2 | const chalk = require("chalk"); 3 | 4 | const rl = readline.createInterface({ 5 | input: process.stdin, 6 | output: process.stdout, 7 | }); 8 | 9 | const prompt = (question) => 10 | new Promise((resolve) => rl.question(question, resolve)); 11 | 12 | function logMessage( 13 | accountNum = null, 14 | total = null, 15 | message = "", 16 | messageType = "info" 17 | ) { 18 | const timestamp = new Date().toISOString().replace("T", " ").substring(0, 19); 19 | const accountStatus = accountNum && total ? `${accountNum}/${total}` : ""; 20 | 21 | const colors = { 22 | info: chalk.white, 23 | success: chalk.green, 24 | error: chalk.red, 25 | warning: chalk.yellow, 26 | process: chalk.cyan, 27 | debug: chalk.magenta, 28 | }; 29 | 30 | const logColor = colors[messageType] || chalk.white; 31 | console.log( 32 | `${chalk.white("[")}${chalk.dim(timestamp)}${chalk.white("]")} ` + 33 | `${chalk.white("[")}${chalk.yellow(accountStatus)}${chalk.white("]")} ` + 34 | `${logColor(message)}` 35 | ); 36 | } 37 | 38 | module.exports = { 39 | prompt, 40 | logMessage, 41 | rl, 42 | }; 43 | -------------------------------------------------------------------------------- /src/classes/authGmail.js: -------------------------------------------------------------------------------- 1 | const fs = require("fs"); 2 | const path = require("path"); 3 | const express = require("express"); 4 | const { google } = require("googleapis"); 5 | const credentials = JSON.parse( 6 | fs.readFileSync(path.resolve(__dirname, "../json/client_secret.json")) 7 | ); 8 | const SCOPES = [ 9 | "https://www.googleapis.com/auth/gmail.send", 10 | "https://www.googleapis.com/auth/gmail.readonly", 11 | ]; 12 | const TOKEN_PATH = path.join(__dirname, "../json/token.json"); 13 | const { client_secret, client_id, redirect_uris } = credentials.installed; 14 | const oAuth2Client = new google.auth.OAuth2( 15 | client_id, 16 | client_secret, 17 | redirect_uris[0] 18 | ); 19 | 20 | function getAccessToken() { 21 | return new Promise((resolve, reject) => { 22 | const authUrl = oAuth2Client.generateAuthUrl({ 23 | access_type: "offline", 24 | scope: SCOPES, 25 | }); 26 | console.log("Authorize this app by visiting this url:", authUrl); 27 | 28 | const app = express(); 29 | 30 | app.get("/oauth2callback", (req, res) => { 31 | const code = req.query.code; 32 | oAuth2Client.getToken(code, (err, token) => { 33 | if (err) { 34 | console.error("Error retrieving access token", err); 35 | res.status(500).send("Authentication failed"); 36 | return reject(err); 37 | } 38 | oAuth2Client.setCredentials(token); 39 | fs.writeFileSync(TOKEN_PATH, JSON.stringify(token)); 40 | res.send("Authentication successful! You can close this window."); 41 | resolve(oAuth2Client); 42 | server.close(); 43 | }); 44 | }); 45 | 46 | const server = app.listen(3000, () => { 47 | console.log("Listening on port 3000 for OAuth2 callback"); 48 | }); 49 | }); 50 | } 51 | 52 | async function authorize() { 53 | try { 54 | const token = JSON.parse(fs.readFileSync(TOKEN_PATH)); 55 | oAuth2Client.setCredentials(token); 56 | return oAuth2Client; 57 | } catch (err) { 58 | return await getAccessToken(); 59 | } 60 | } 61 | 62 | module.exports = { authorize }; 63 | -------------------------------------------------------------------------------- /src/classes/proxy.js: -------------------------------------------------------------------------------- 1 | const { HttpsProxyAgent } = require("https-proxy-agent"); 2 | const chalk = require("chalk"); 3 | const fs = require("fs"); 4 | const axios = require("axios"); 5 | let proxyList = []; 6 | let axiosConfig = {}; 7 | 8 | function getProxyAgent(proxyUrl) { 9 | try { 10 | const isSocks = proxyUrl.toLowerCase().startsWith("socks"); 11 | if (isSocks) { 12 | const { SocksProxyAgent } = require("socks-proxy-agent"); 13 | return new SocksProxyAgent(proxyUrl); 14 | } 15 | return new HttpsProxyAgent( 16 | proxyUrl.startsWith("http") ? proxyUrl : `http://${proxyUrl}` 17 | ); 18 | } catch (error) { 19 | console.log(chalk.red(`[!] Error creating proxy agent: ${error.message}`)); 20 | return null; 21 | } 22 | } 23 | 24 | function loadProxies() { 25 | try { 26 | const proxyFile = fs.readFileSync("proxy.txt", "utf8"); 27 | proxyList = proxyFile 28 | .split("\n") 29 | .filter((line) => line.trim()) 30 | .map((proxy) => { 31 | proxy = proxy.trim(); 32 | if (!proxy.includes("://")) { 33 | return `http://${proxy}`; 34 | } 35 | return proxy; 36 | }); 37 | 38 | if (proxyList.length === 0) { 39 | throw new Error("No proxies found in proxy.txt"); 40 | } 41 | console.log( 42 | chalk.green(`✓ Loaded ${proxyList.length} proxies from proxy.txt`) 43 | ); 44 | return true; 45 | } catch (error) { 46 | console.error(chalk.red(`[!] Error loading proxy: ${error.message}`)); 47 | return false; 48 | } 49 | } 50 | 51 | async function checkIP() { 52 | try { 53 | const response = await axios.get( 54 | "https://api.ipify.org?format=json", 55 | axiosConfig 56 | ); 57 | const ip = response.data.ip; 58 | console.log(chalk.green(`[+] Ip Using: ${ip}`)); 59 | return true; 60 | } catch (error) { 61 | console.log(chalk.red(`[!] Failed to get IP: ${error.message}`)); 62 | return false; 63 | } 64 | } 65 | 66 | async function getRandomProxy() { 67 | if (proxyList.length === 0) { 68 | axiosConfig = {}; 69 | await checkIP(); 70 | return null; 71 | } 72 | 73 | let proxyAttempt = 0; 74 | while (proxyAttempt < proxyList.length) { 75 | const proxy = proxyList[Math.floor(Math.random() * proxyList.length)]; 76 | try { 77 | const agent = getProxyAgent(proxy); 78 | if (!agent) continue; 79 | 80 | axiosConfig.httpsAgent = agent; 81 | await checkIP(); 82 | return proxy; 83 | } catch (error) { 84 | proxyAttempt++; 85 | } 86 | } 87 | 88 | console.log(chalk.red("[!] Using default IP")); 89 | axiosConfig = {}; 90 | await checkIP(); 91 | return null; 92 | } 93 | 94 | module.exports = { 95 | getProxyAgent, 96 | loadProxies, 97 | getRandomProxy, 98 | }; 99 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Ari Chain Wallet Auto Referral Bot 2 | 3 | This bot automates the process of creating accounts and using referral codes for the AriChain Wallet. 4 | 5 | ## Features 6 | 7 | - Automatically generates random email addresses. 8 | - Uses proxies to avoid IP bans. 9 | - Logs the created accounts. 10 | - Handles email verification. 11 | 12 | ## Requirements 13 | 14 | - Node.js 18 v18.20.5 LTS or latest. 15 | - npm (Node Package Manager) 16 | - Use 2Captcha Services [2Captcha](https://2captcha.com/?from=24541144), free version you can using gemini apikey. 17 | 18 | ## Installation 19 | 20 | 1. Clone the repository: 21 | 22 | ```sh 23 | git clone https://github.com/ahlulmukh/arichain-autoreff.git 24 | cd arichain-autoreff 25 | ``` 26 | 27 | 2. Install the dependencies: 28 | 29 | ```sh 30 | npm install 31 | ``` 32 | 33 | 3. Create a `proxy.txt` file in the root directory and add your proxies (one per line). 34 | 35 | 4. change `client_secret.json.example` to `client_secret.json`. 36 | 37 | 5. Set up Gmail API credentials: 38 | 39 | - Go to the [Google Cloud Console](https://console.developers.google.com/). 40 | - Create a new project. 41 | - Enable the Gmail API for the project. 42 | - Create OAuth 2.0 credentials for a native application. 43 | - Download the `client_secret.json` open it and copy paste to `src/json/client_secret.json`. 44 | - Don't forget to change the email referral verification in `client_secret.json`. 45 | - Change gemini apikey in `client_secret.json`. 46 | 47 | 6. If you want using 2 Captcha service you can fill your apikey in `client_secret.json` and change `"captha2Apikey": "your_2captcha_apikey",` with your apikey. 48 | 49 | Get gemini apikey : [Here](https://aistudio.google.com/app/apikey) 50 | 51 | Tutorial video, how to get api credentials : [Here](https://t.me/elpuqus/138) 52 | 53 | ## Usage 54 | 55 | 1. Run the bot: 56 | 57 | ```sh 58 | node main.js 59 | ``` 60 | 61 | 2. Follow the prompts to enter your referral code, address to transfer token and the number of accounts you want to create, and dont forget too choice your solve captcha too. 62 | 63 | 3. If this is your first time running the bot, you will be prompted to authorize the application to access your Gmail account. Follow the instructions to complete the authorization. 64 | 65 | ## Output 66 | 67 | - The created accounts will be saved in `accounts.txt`. 68 | 69 | ## Notes 70 | 71 | - If you get error `invalid creds` you can delete token in `src/json/token.json` 72 | - Make sure to use valid proxies to avoid IP bans. 73 | - The bot will attempt to verify the email up to 5 times before giving up. 74 | 75 | ## Stay Connected 76 | 77 | - Channel Telegram : [Telegram](https://t.me/elpuqus) 78 | - Channel WhatsApp : [Whatsapp](https://whatsapp.com/channel/0029VavBRhGBqbrEF9vxal1R) 79 | 80 | ## Donation 81 | 82 | If you would like to support the development of this project, you can make a donation using the following addresses: 83 | 84 | - Solana: `FPDcn6KfFrZm3nNwvrwJqq5jzRwqfKbGZ3TxmJNsWrh9` 85 | - EVM: `0xae1920bb53f16df1b8a15fc3544064cc71addd92` 86 | - BTC: `bc1pnzm240jfj3ac9yk579hxcldjjwzcuhcpvd3y3jdph3ats25lrmcsln99qf` 87 | 88 | ## Disclaimer 89 | 90 | This tool is for educational purposes only. Use it at your own risk. 91 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | const { prompt, logMessage, rl } = require("./utils/logger"); 2 | const ariChain = require("./classes/ariChain"); 3 | const { generateRandomPassword } = require("./utils/generator"); 4 | const { authorize } = require("./classes/authGmail"); 5 | const { getRandomProxy, loadProxies } = require("./classes/proxy"); 6 | 7 | const chalk = require("chalk"); 8 | const fs = require("fs"); 9 | const path = require("path"); 10 | 11 | async function checkAuth() { 12 | const clientSecretPath = path.resolve(__dirname, "json/client_secret.json"); 13 | const tokenPath = path.resolve(__dirname, "json/token.json"); 14 | 15 | if (!fs.existsSync(clientSecretPath)) { 16 | console.error( 17 | chalk.red( 18 | "client_secret.json not found. Please provide a valid client_secret.json file." 19 | ) 20 | ); 21 | process.exit(1); 22 | } 23 | 24 | const clientSecret = JSON.parse(fs.readFileSync(clientSecretPath)); 25 | const requiredFields = [ 26 | "client_id", 27 | "project_id", 28 | "auth_uri", 29 | "token_uri", 30 | "auth_provider_x509_cert_url", 31 | "client_secret", 32 | ]; 33 | 34 | const isValidClientSecret = requiredFields.every( 35 | (field) => 36 | clientSecret.installed[field] && 37 | !clientSecret.installed[field].includes("your_") 38 | ); 39 | 40 | if (!isValidClientSecret) { 41 | console.error( 42 | chalk.red( 43 | "client_secret.json contains example values. Please provide valid credentials." 44 | ) 45 | ); 46 | process.exit(1); 47 | } 48 | 49 | if (!fs.existsSync(tokenPath)) { 50 | console.log( 51 | chalk.yellow("Token not found. Starting Gmail authentication...") 52 | ); 53 | await authorize(); 54 | } else { 55 | try { 56 | const token = JSON.parse(fs.readFileSync(tokenPath)); 57 | if (!token.access_token) { 58 | console.log( 59 | chalk.yellow("Invalid token. Starting Gmail authentication...") 60 | ); 61 | await authorize(); 62 | } 63 | } catch (err) { 64 | console.log( 65 | chalk.yellow("Error reading token. Starting Gmail authentication...") 66 | ); 67 | await authorize(); 68 | } 69 | } 70 | } 71 | 72 | async function main() { 73 | await checkAuth(); 74 | 75 | console.log( 76 | chalk.cyan(` 77 | ░█▀█░█▀▄░▀█▀░█▀▀░█░█░█▀█░▀█▀░█▀█ 78 | ░█▀█░█▀▄░░█░░█░░░█▀█░█▀█░░█░░█░█ 79 | ░▀░▀░▀░▀░▀▀▀░▀▀▀░▀░▀░▀░▀░▀▀▀░▀░▀ 80 | By : El Puqus Airdrop 81 | github.com/ahlulmukh 82 | `) 83 | ); 84 | 85 | const use2CaptchaResponse = await prompt( 86 | chalk.yellow("Use 2Captcha ? (y/n): ") 87 | ); 88 | const use2Captcha = use2CaptchaResponse.toLowerCase() === "y"; 89 | const refCode = await prompt(chalk.yellow("Enter Referral Code: ")); 90 | const toAddress = await prompt( 91 | chalk.yellow("Enter target address for token transfer: ") 92 | ); 93 | const count = parseInt(await prompt(chalk.yellow("How many do you want? "))); 94 | const proxiesLoaded = loadProxies(); 95 | if (!proxiesLoaded) { 96 | console.log(chalk.yellow("No proxy available. Using default IP.")); 97 | } 98 | let successful = 0; 99 | 100 | const accountAri = fs.createWriteStream("accounts.txt", { flags: "a" }); 101 | 102 | for (let i = 0; i < count; i++) { 103 | console.log(chalk.white("-".repeat(85))); 104 | logMessage(i + 1, count, "Process", "debug"); 105 | 106 | const currentProxy = await getRandomProxy(); 107 | const generator = new ariChain(refCode, currentProxy); 108 | 109 | try { 110 | const email = generator.generateTempEmail(); 111 | const password = generateRandomPassword(); 112 | 113 | const emailSent = await generator.sendEmailCode(email, use2Captcha); 114 | if (!emailSent) continue; 115 | 116 | const account = await generator.registerAccount(email, password); 117 | 118 | if (account) { 119 | accountAri.write(`Email: ${email}\n`); 120 | accountAri.write(`Password: ${password}\n`); 121 | accountAri.write(`Reff To: ${refCode}\n`); 122 | accountAri.write("-".repeat(85) + "\n"); 123 | 124 | successful++; 125 | logMessage(i + 1, count, "Account Success Create!", "success"); 126 | logMessage(i + 1, count, `Email: ${email}`, "success"); 127 | logMessage(i + 1, count, `Password: ${password}`, "success"); 128 | logMessage(i + 1, count, `Reff To : ${refCode}`, "success"); 129 | 130 | const address = account.result.address; 131 | try { 132 | const checkinResult = await generator.checkinDaily(address); 133 | logMessage(i + 1, count, `Checkin Daily Done`, "success"); 134 | if (!checkinResult) { 135 | throw new Error("Gagal checkin"); 136 | } 137 | const transferResult = await generator.transferToken( 138 | email, 139 | toAddress, 140 | password, 141 | 60 142 | ); 143 | if (!transferResult) { 144 | throw new Error("Gagal transfer token"); 145 | } 146 | logMessage(i + 1, count, `Transfer Token Done`, "success"); 147 | } catch (error) { 148 | logMessage(i + 1, count, error.message, "error"); 149 | continue; 150 | } 151 | } else { 152 | logMessage(i + 1, count, "Register Account Failed", "error"); 153 | if (generator.proxy) { 154 | logMessage(i + 1, count, `Failed proxy: ${generator.proxy}`, "error"); 155 | } 156 | } 157 | } catch (error) { 158 | logMessage(i + 1, count, `Error: ${error.message}`, "error"); 159 | } 160 | } 161 | 162 | accountAri.end(); 163 | 164 | console.log(chalk.magenta("\n[*] Dono bang!")); 165 | console.log(chalk.green(`[*] Account dono ${successful} dari ${count} akun`)); 166 | console.log(chalk.magenta("[*] Result in accounts.txt")); 167 | rl.close(); 168 | } 169 | 170 | module.exports = { main }; 171 | -------------------------------------------------------------------------------- /src/classes/ariChain.js: -------------------------------------------------------------------------------- 1 | const axios = require("axios"); 2 | const { Solver } = require("@2captcha/captcha-solver"); 3 | const { google } = require("googleapis"); 4 | const { logMessage } = require("../utils/logger"); 5 | const { getProxyAgent } = require("./proxy"); 6 | const fs = require("fs"); 7 | const { EmailGenerator } = require("../utils/generator"); 8 | const path = require("path"); 9 | const TOKEN_PATH = path.join(__dirname, "../json/token.json"); 10 | const confEmail = JSON.parse( 11 | fs.readFileSync(path.resolve(__dirname, "../json/client_secret.json")) 12 | ).email; 13 | const confApi = JSON.parse( 14 | fs.readFileSync(path.resolve(__dirname, "../json/client_secret.json")) 15 | ).geminiApi; 16 | const gemeiniPrompt = JSON.parse( 17 | fs.readFileSync(path.resolve(__dirname, "../json/client_secret.json")) 18 | ).prompt; 19 | const captchaApi = JSON.parse( 20 | fs.readFileSync(path.resolve(__dirname, "../json/client_secret.json")) 21 | ).captha2Apikey; 22 | const qs = require("qs"); 23 | const { GoogleGenerativeAI } = require("@google/generative-ai"); 24 | 25 | function loadOAuth2Client() { 26 | const credentials = JSON.parse( 27 | fs.readFileSync(path.resolve(__dirname, "../json/client_secret.json")) 28 | ); 29 | const { client_id, client_secret, redirect_uris } = credentials.installed; 30 | const oAuth2Client = new google.auth.OAuth2( 31 | client_id, 32 | client_secret, 33 | redirect_uris[0] 34 | ); 35 | const token = JSON.parse(fs.readFileSync(TOKEN_PATH)); 36 | oAuth2Client.setCredentials(token); 37 | return oAuth2Client; 38 | } 39 | 40 | class ariChain { 41 | constructor(refCode, proxy = null) { 42 | this.refCode = refCode; 43 | this.proxy = proxy; 44 | this.axiosConfig = { 45 | ...(this.proxy && { httpsAgent: getProxyAgent(this.proxy) }), 46 | timeout: 60000, 47 | }; 48 | this.gmailClient = google.gmail({ 49 | version: "v1", 50 | auth: loadOAuth2Client(), 51 | }); 52 | this.baseEmail = confEmail; 53 | this.gemini = new GoogleGenerativeAI(confApi); 54 | this.model = this.gemini.getGenerativeModel({ 55 | model: "gemini-1.5-flash", 56 | }); 57 | this.twoCaptchaSolver = new Solver(captchaApi); 58 | } 59 | 60 | async makeRequest(method, url, config = {}) { 61 | try { 62 | const response = await axios({ 63 | method, 64 | url, 65 | ...this.axiosConfig, 66 | ...config, 67 | }); 68 | return response; 69 | } catch (error) { 70 | logMessage( 71 | this.currentNum, 72 | this.total, 73 | `Request failed: ${error.message}`, 74 | "error" 75 | ); 76 | if (this.proxy) { 77 | logMessage( 78 | this.currentNum, 79 | this.total, 80 | `Failed proxy: ${this.proxy}`, 81 | "error" 82 | ); 83 | } 84 | return null; 85 | } 86 | } 87 | 88 | generateTempEmail() { 89 | const emailGenerator = new EmailGenerator(this.baseEmail); 90 | const tempEmail = emailGenerator.generateRandomVariation(); 91 | logMessage( 92 | this.currentNum, 93 | this.total, 94 | `Email using: ${tempEmail}`, 95 | "success" 96 | ); 97 | return tempEmail; 98 | } 99 | 100 | async getCaptchaCode() { 101 | try { 102 | const headers = { 103 | accept: "*/*", 104 | }; 105 | const response = await this.makeRequest( 106 | "POST", 107 | "https://arichain.io/api/captcha/create", 108 | { headers } 109 | ); 110 | 111 | return response; 112 | } catch { 113 | console.error("Error create captcha :", error); 114 | return null; 115 | } 116 | } 117 | 118 | async getCaptchaImage(uniqueIdx) { 119 | try { 120 | const response = await this.makeRequest( 121 | "GET", 122 | `http://arichain.io/api/captcha/get?unique_idx=${uniqueIdx}`, 123 | { responseType: "arraybuffer" } 124 | ); 125 | return response.data; 126 | } catch { 127 | console.error("Error get image captcha:", error); 128 | return null; 129 | } 130 | } 131 | 132 | async solveCaptchaWithGemini(imageBuffer) { 133 | try { 134 | const prompt = gemeiniPrompt; 135 | const image = { 136 | inlineData: { 137 | data: Buffer.from(imageBuffer).toString("base64"), 138 | mimeType: "image/png", 139 | }, 140 | }; 141 | 142 | const result = await this.model.generateContent([prompt, image]); 143 | const captchaText = result.response.text().trim(); 144 | const cleanedCaptchaText = captchaText.replace(/\s/g, ""); 145 | 146 | logMessage( 147 | this.currentNum, 148 | this.total, 149 | "Solve captcha done...", 150 | "success" 151 | ); 152 | return cleanedCaptchaText; 153 | } catch (error) { 154 | console.error("Error solving CAPTCHA with Gemini:", error); 155 | return null; 156 | } 157 | } 158 | 159 | async solveCaptchaWith2Captcha(imageBuffer) { 160 | try { 161 | const base64Image = Buffer.from(imageBuffer).toString("base64"); 162 | const res = await this.twoCaptchaSolver.imageCaptcha({ 163 | body: `data:image/png;base64,${base64Image}`, 164 | regsense: 1, 165 | }); 166 | 167 | return res.data; 168 | } catch (error) { 169 | console.error("Error solving CAPTCHA with 2Captcha:", error); 170 | return null; 171 | } 172 | } 173 | 174 | async sendEmailCode(email, use2Captcha = false) { 175 | logMessage( 176 | this.currentNum, 177 | this.total, 178 | "Processing send email code...", 179 | "process" 180 | ); 181 | 182 | let captchaResponse; 183 | let captchaText; 184 | let response; 185 | const maxAttempts = 3; 186 | let attempts = 0; 187 | 188 | while (attempts < maxAttempts) { 189 | attempts++; 190 | logMessage( 191 | this.currentNum, 192 | this.total, 193 | `Attempt ${attempts} to solve CAPTCHA...`, 194 | "process" 195 | ); 196 | 197 | captchaResponse = await this.getCaptchaCode(); 198 | if ( 199 | !captchaResponse || 200 | !captchaResponse.data || 201 | !captchaResponse.data.result 202 | ) { 203 | logMessage( 204 | this.currentNum, 205 | this.total, 206 | "Failed to get CAPTCHA", 207 | "error" 208 | ); 209 | continue; 210 | } 211 | 212 | const uniqueIdx = captchaResponse.data.result.unique_idx; 213 | 214 | const captchaImageBuffer = await this.getCaptchaImage(uniqueIdx); 215 | if (!captchaImageBuffer) { 216 | logMessage( 217 | this.currentNum, 218 | this.total, 219 | "Failed to get CAPTCHA image", 220 | "error" 221 | ); 222 | continue; 223 | } 224 | 225 | if (use2Captcha) { 226 | captchaText = await this.solveCaptchaWith2Captcha(captchaImageBuffer); 227 | } else { 228 | captchaText = await this.solveCaptchaWithGemini(captchaImageBuffer); 229 | } 230 | 231 | if (!captchaText) { 232 | logMessage( 233 | this.currentNum, 234 | this.total, 235 | "Failed to solve CAPTCHA", 236 | "error" 237 | ); 238 | continue; 239 | } 240 | 241 | const headers = { 242 | accept: "*/*", 243 | "content-type": "application/x-www-form-urlencoded", 244 | }; 245 | 246 | const data = qs.stringify({ 247 | email: email, 248 | unique_idx: uniqueIdx, 249 | captcha_string: captchaText, 250 | }); 251 | 252 | response = await this.makeRequest( 253 | "POST", 254 | "https://arichain.io/api/Email/send_valid_email", 255 | { headers, data } 256 | ); 257 | 258 | if (!response) { 259 | logMessage( 260 | this.currentNum, 261 | this.total, 262 | "Failed to send email", 263 | "error" 264 | ); 265 | continue; 266 | } 267 | 268 | if (response.data.status === "fail") { 269 | if (response.data.msg === "captcha is not valid") { 270 | logMessage( 271 | this.currentNum, 272 | this.total, 273 | "CAPTCHA is not valid, retrying...", 274 | "warning" 275 | ); 276 | continue; 277 | } else { 278 | logMessage(this.currentNum, this.total, response.data.msg, "error"); 279 | return false; 280 | } 281 | } 282 | 283 | logMessage( 284 | this.currentNum, 285 | this.total, 286 | "Email sent successfully", 287 | "success" 288 | ); 289 | return true; 290 | } 291 | 292 | logMessage( 293 | this.currentNum, 294 | this.total, 295 | "Failed to send email after multiple attempts", 296 | "error" 297 | ); 298 | return false; 299 | } 300 | 301 | async getCodeVerification(tempEmail) { 302 | logMessage( 303 | this.currentNum, 304 | this.total, 305 | "Waiting for code verification...", 306 | "process" 307 | ); 308 | 309 | const maxAttempts = 5; 310 | for (let attempt = 0; attempt < maxAttempts; attempt++) { 311 | logMessage( 312 | this.currentNum, 313 | this.total, 314 | `Attempt ${attempt + 1}`, 315 | "process" 316 | ); 317 | 318 | logMessage( 319 | this.currentNum, 320 | this.total, 321 | "Waiting for 10sec...", 322 | "warning" 323 | ); 324 | await new Promise((resolve) => setTimeout(resolve, 10000)); 325 | 326 | const messages = await this.gmailClient.users.messages.list({ 327 | userId: "me", 328 | q: `to:${tempEmail}`, 329 | }); 330 | 331 | if (messages.data.messages && messages.data.messages.length > 0) { 332 | const messageId = messages.data.messages[0].id; 333 | const message = await this.gmailClient.users.messages.get({ 334 | userId: "me", 335 | id: messageId, 336 | format: "full", 337 | }); 338 | 339 | const emailBody = message.data.payload.body.data; 340 | if (emailBody) { 341 | const decodedBody = Buffer.from(emailBody, "base64").toString( 342 | "utf-8" 343 | ); 344 | 345 | const codeMatch = decodedBody.match(/\b\d{6}\b/); 346 | if (codeMatch) { 347 | const verificationCode = codeMatch[0]; 348 | logMessage( 349 | this.currentNum, 350 | this.total, 351 | `Verificatin code found: ${verificationCode}`, 352 | "success" 353 | ); 354 | return verificationCode; 355 | } 356 | } 357 | } 358 | 359 | logMessage( 360 | this.currentNum, 361 | this.total, 362 | "Verification code not found. Waiting for 5 sec...", 363 | "warning" 364 | ); 365 | await new Promise((resolve) => setTimeout(resolve, 5000)); 366 | } 367 | 368 | logMessage( 369 | this.currentNum, 370 | this.total, 371 | "Error get code verification.", 372 | "error" 373 | ); 374 | return null; 375 | } 376 | 377 | async checkinDaily(address) { 378 | const headers = { 379 | accept: "*/*", 380 | "content-type": "application/x-www-form-urlencoded", 381 | }; 382 | const data = qs.stringify({ address }); 383 | const response = await this.makeRequest( 384 | "POST", 385 | "https://arichain.io/api/event/checkin", 386 | { 387 | headers, 388 | data, 389 | } 390 | ); 391 | if (!response) { 392 | logMessage(this.currentNum, this.total, "Failed checkin", "error"); 393 | return null; 394 | } 395 | return response.data; 396 | } 397 | 398 | async transferToken(email, toAddress, password, amount = 60) { 399 | const headers = { 400 | accept: "*/*", 401 | "content-type": "application/x-www-form-urlencoded", 402 | }; 403 | const transferData = qs.stringify({ 404 | email, 405 | to_address: toAddress, 406 | pw: password, 407 | amount, 408 | }); 409 | const response = await this.makeRequest( 410 | "POST", 411 | "https://arichain.io/api/wallet/transfer_mobile", 412 | { 413 | headers, 414 | data: transferData, 415 | } 416 | ); 417 | if (!response) { 418 | logMessage(this.currentNum, this.total, "Failed send token", "error"); 419 | return null; 420 | } 421 | return response.data; 422 | } 423 | 424 | async registerAccount(email, password) { 425 | logMessage(this.currentNum, this.total, "Register account...", "process"); 426 | 427 | const verifyCode = await this.getCodeVerification(email); 428 | if (!verifyCode) { 429 | logMessage( 430 | this.currentNum, 431 | this.total, 432 | "Failed get code verification.", 433 | "error" 434 | ); 435 | return null; 436 | } 437 | 438 | const headers = { 439 | accept: "*/*", 440 | "content-type": "application/x-www-form-urlencoded", 441 | }; 442 | 443 | const registerData = qs.stringify({ 444 | email: email, 445 | pw: password, 446 | pw_re: password, 447 | valid_code: verifyCode, 448 | invite_code: this.refCode, 449 | }); 450 | 451 | const response = await this.makeRequest( 452 | "POST", 453 | "https://arichain.io/api/Account/signup", 454 | { 455 | headers, 456 | data: registerData, 457 | } 458 | ); 459 | 460 | if (response.data.status === "fail") { 461 | logMessage(this.currentNum, this.total, response.data.msg, "error"); 462 | return null; 463 | } 464 | 465 | logMessage(this.currentNum, this.total, "Register succes.", "success"); 466 | 467 | return response.data; 468 | } 469 | } 470 | 471 | module.exports = ariChain; 472 | --------------------------------------------------------------------------------