Skip to content

Commit 377c903

Browse files
committed
update
0 parents  commit 377c903

File tree

3 files changed

+308
-0
lines changed

3 files changed

+308
-0
lines changed

data.txt

Whitespace-only changes.

index.js

+308
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,308 @@
1+
import axios from 'axios';
2+
import fs from 'fs/promises';
3+
import chalk from 'chalk';
4+
import ora from 'ora';
5+
import Table from 'cli-table3';
6+
import { SocksProxyAgent } from 'socks-proxy-agent';
7+
import { HttpsProxyAgent } from 'https-proxy-agent';
8+
import figlet from 'figlet'; // Tambahkan ini
9+
10+
const BASE_URL = 'https://api.depined.org/api';
11+
12+
// Fungsi untuk menampilkan banner ASCII art
13+
const displayBanner = () => {
14+
console.log(chalk.green(figlet.textSync('AirdropInsiders', { horizontalLayout: 'default' })));
15+
};
16+
17+
// Format timestamps
18+
const getTimestamp = () => {
19+
return new Date().toLocaleTimeString();
20+
};
21+
22+
// Create stats table with simplified columns
23+
const createStatsTable = (accounts) => {
24+
const table = new Table({
25+
head: ['Account', 'Username', 'Email', 'Proxy', 'Status', 'Points Today', 'Total Points', 'Last Update'],
26+
style: {
27+
head: ['cyan'],
28+
border: ['gray']
29+
}
30+
});
31+
32+
accounts.forEach(account => {
33+
table.push([
34+
account.token.substring(0, 8) + '...',
35+
account.username || '-',
36+
account.email || '-',
37+
account.proxyConfig ? `${account.proxyConfig.type}://${account.proxyConfig.host}:${account.proxyConfig.port}`.substring(0, 20) + '...' : 'Direct',
38+
account.status,
39+
account.pointsToday?.toFixed(2) || '0.00',
40+
account.totalPoints?.toFixed(2) || '0.00',
41+
account.lastUpdate || '-'
42+
]);
43+
});
44+
45+
return table;
46+
};
47+
48+
// Update log success
49+
const logSuccess = (accountId, message, pointsToday, totalPoints, username, email) => {
50+
console.log(
51+
chalk.green(`[${getTimestamp()}] Account ${accountId}: ${message}`) +
52+
chalk.blue(` | ${username}`) +
53+
chalk.yellow(` | ${email}`) +
54+
chalk.magenta(` | Points Today: ${pointsToday?.toFixed(2)}`) +
55+
chalk.cyan(` | Total Points: ${totalPoints?.toFixed(2)}`)
56+
);
57+
};
58+
59+
// Parse proxy string
60+
const parseProxyString = (proxyString) => {
61+
try {
62+
const [protocol, rest] = proxyString.trim().split('://');
63+
if (!rest) throw new Error('Invalid proxy format');
64+
65+
let [credentials, hostPort] = rest.split('@');
66+
if (!hostPort) {
67+
hostPort = credentials;
68+
credentials = null;
69+
}
70+
71+
const [host, port] = hostPort.split(':');
72+
if (!host || !port) throw new Error('Invalid proxy host/port');
73+
74+
let auth = null;
75+
if (credentials) {
76+
const [username, password] = credentials.split(':');
77+
if (username && password) {
78+
auth = { username, password };
79+
}
80+
}
81+
82+
return {
83+
type: protocol.toLowerCase(),
84+
host,
85+
port: parseInt(port),
86+
auth
87+
};
88+
} catch (error) {
89+
throw new Error(`Failed to parse proxy string: ${proxyString}`);
90+
}
91+
};
92+
93+
// Create proxy agent based on configuration
94+
const createProxyAgent = (proxyConfig) => {
95+
const { type, host, port, auth } = proxyConfig;
96+
const proxyUrl = auth
97+
? `${type}://${auth.username}:${auth.password}@${host}:${port}`
98+
: `${type}://${host}:${port}`;
99+
100+
if (type === 'socks5' || type === 'socks4') {
101+
return new SocksProxyAgent(proxyUrl);
102+
} else if (type === 'http' || type === 'https') {
103+
return new HttpsProxyAgent(proxyUrl);
104+
} else {
105+
throw new Error(`Unsupported proxy type: ${type}`);
106+
}
107+
};
108+
109+
// Get stats
110+
const getStats = async (token, proxyConfig = null) => {
111+
const headers = {
112+
'Accept': 'application/json',
113+
'Authorization': `Bearer ${token}`,
114+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'
115+
};
116+
117+
try {
118+
const axiosConfig = {
119+
headers,
120+
timeout: 10000
121+
};
122+
123+
if (proxyConfig) {
124+
axiosConfig.httpsAgent = createProxyAgent(proxyConfig);
125+
}
126+
127+
const res = await axios.get(`${BASE_URL}/stats/earnings`, axiosConfig);
128+
129+
const data = res.data.data;
130+
return {
131+
pointsToday: data.total_points_today || 0,
132+
totalPoints: data.total_points_balance || 0
133+
};
134+
} catch (error) {
135+
throw error;
136+
}
137+
};
138+
139+
// Get user profile
140+
const getUserProfile = async (token, proxyConfig = null) => {
141+
const headers = {
142+
'Accept': 'application/json',
143+
'Authorization': `Bearer ${token}`,
144+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'
145+
};
146+
147+
try {
148+
const axiosConfig = {
149+
headers,
150+
timeout: 10000
151+
};
152+
153+
if (proxyConfig) {
154+
axiosConfig.httpsAgent = createProxyAgent(proxyConfig);
155+
}
156+
157+
const res = await axios.get(`${BASE_URL}/user/overview/profile`, axiosConfig);
158+
return {
159+
username: res.data.data.profile.username || '-',
160+
email: res.data.data.user_details.email || '-'
161+
};
162+
} catch (error) {
163+
throw error;
164+
}
165+
};
166+
167+
// Ping function
168+
const ping = async (token, proxyConfig = null) => {
169+
const headers = {
170+
'Accept': 'application/json',
171+
'Authorization': `Bearer ${token}`,
172+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36'
173+
};
174+
175+
try {
176+
const axiosConfig = {
177+
headers,
178+
timeout: 10000
179+
};
180+
181+
if (proxyConfig) {
182+
axiosConfig.httpsAgent = createProxyAgent(proxyConfig);
183+
}
184+
185+
const res = await axios.post(
186+
`${BASE_URL}/user/widget-connect`,
187+
{ connected: true },
188+
axiosConfig
189+
);
190+
191+
return res.data;
192+
} catch (error) {
193+
throw error;
194+
}
195+
};
196+
197+
// Read and validate input files
198+
const readInputFiles = async () => {
199+
try {
200+
const tokenData = await fs.readFile('data.txt', 'utf8');
201+
const tokens = tokenData.split('\n')
202+
.map(line => line.trim())
203+
.filter(line => line.length > 0);
204+
205+
if (tokens.length === 0) {
206+
throw new Error('No tokens found in data.txt');
207+
}
208+
209+
let proxies = [];
210+
try {
211+
const proxyData = await fs.readFile('proxy.txt', 'utf8');
212+
proxies = proxyData.split('\n')
213+
.map(line => line.trim())
214+
.filter(line => line.length > 0)
215+
.map(proxyString => parseProxyString(proxyString));
216+
} catch (error) {
217+
console.log(chalk.yellow('No proxy.txt found or error reading proxies. Running without proxies.'));
218+
}
219+
220+
return { tokens, proxies };
221+
} catch (error) {
222+
throw new Error(`Failed to read input files: ${error.message}`);
223+
}
224+
};
225+
226+
// Main function
227+
const main = async () => {
228+
displayBanner(); // Tampilkan banner saat aplikasi dimulai
229+
230+
const spinner = ora('Reading input files...').start();
231+
const { tokens, proxies } = await readInputFiles();
232+
spinner.succeed(`Loaded ${tokens.length} tokens and ${proxies.length} proxies`);
233+
234+
const accounts = tokens.map((token, index) => ({
235+
token,
236+
proxyConfig: proxies[index % proxies.length] || null,
237+
status: 'Initializing',
238+
username: null,
239+
email: null,
240+
pointsToday: 0,
241+
totalPoints: 0,
242+
lastUpdate: null
243+
}));
244+
245+
while (true) {
246+
console.clear();
247+
displayBanner(); // Tampilkan banner sebelum setiap refresh tabel
248+
console.log(chalk.yellow('Join Us : https://t.me/AirdropInsiderID\n'));
249+
console.log(chalk.cyan('=== Depined Multi-Account Manager ===\n'));
250+
console.log(createStatsTable(accounts).toString());
251+
console.log(chalk.cyan('\n=== Activity Log ==='));
252+
253+
for (let i = 0; i < accounts.length; i++) {
254+
const account = accounts[i];
255+
256+
try {
257+
// Get user profile if not already fetched
258+
if (!account.username || !account.email) {
259+
const profile = await getUserProfile(account.token, account.proxyConfig);
260+
account.username = profile.username;
261+
account.email = profile.email;
262+
}
263+
264+
// Ping server
265+
await ping(account.token, account.proxyConfig);
266+
account.status = chalk.green('Connected');
267+
268+
// Get stats
269+
const stats = await getStats(account.token, account.proxyConfig);
270+
271+
// Update account data
272+
account.pointsToday = stats.pointsToday;
273+
account.totalPoints = stats.totalPoints;
274+
account.lastUpdate = getTimestamp();
275+
276+
logSuccess(
277+
i + 1,
278+
`Ping successful (${account.proxyConfig ? account.proxyConfig.type : 'Direct'})`,
279+
stats.pointsToday,
280+
stats.totalPoints,
281+
account.username,
282+
account.email
283+
);
284+
285+
} catch (error) {
286+
account.status = chalk.red('Error');
287+
account.lastUpdate = getTimestamp();
288+
console.log(chalk.red(`[${getTimestamp()}] Account ${i + 1}: Error - ${error.message}`));
289+
}
290+
291+
// Add small delay between accounts to prevent rate limiting
292+
await new Promise(resolve => setTimeout(resolve, 1000));
293+
}
294+
295+
// Wait before next update (30 seconds)
296+
await new Promise(resolve => setTimeout(resolve, 30000));
297+
}
298+
};
299+
300+
// Start the application
301+
(async () => {
302+
try {
303+
await main();
304+
} catch (error) {
305+
console.error(chalk.red('Application error:', error.message));
306+
process.exit(1);
307+
}
308+
})();

proxy.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)