简单钓鱼获取Telegram用户绑定手机号

文摘   2024-07-17 09:21   北京  

Telegram用户手机号获取方式这个被问过很多次,其实还是有挺多方式的,我用过的一种有效的方法,会涉及一些社会工程学,但可以以批量推广收集用户手机号,就是建立一些钓鱼机器人,利用telegram内置分享手机号码功能,这些机器人会提示用户分享他们的电话号码(Telegram 的内置功能)以继续使用机器人的服务,效果如下:

而且方便的是有可以直接复用的机器人和官方api,现有的解决方案(如 @protestchat_bot 或 @Checknumb_bot)已经发挥了这一作用。上面测试机器人获取到的绑定手机号码结果可以在@TgAnalyst_bot中输入目标帐户的 ID查询。

这种机器人可以配合各类github中功能机器人使用,买卖货币,Ins、x、facebook自动关注、还有各种大火的AI制图改图之类的都可以使用,且可以直接无脑推广收集,钓鱼手段主要还是靠思路,多翻翻官方文档总有适合你的方式。



--------------------------------


如果想从头写,下面这个这个是个简单的参考demo:


使用的是Telegram Bot API(https://www.nuget.org/packages/Telegram.Bot),在向用户请求时可以获取电话号码,且用户不用填写号码,系统自动获取号码,效果如下:

当用户点击/myNumber

用户会有确认界面:

 就可以得到用户绑定的电话号码

控制台输出效果:

看一下这个简单的控制台应用程序,但是您需要做一些更改来处理数字:

添加Handler.ch以下几行到BotOnMessageReceived

if (message.Type == MessageType.Contact && message.Contact != null)
{
Console.WriteLine($"Phone number: {message.Contact.PhoneNumber}");
}

如果某一天存储库被删除,则需要以下代码:

Program.cs

public static class Program{    private static TelegramBotClient? bot;
public static async Task Main() { bot = new TelegramBotClient(/*TODO: BotToken hier*/);
User me = await bot.GetMeAsync(); Console.Title = me.Username ?? "My awesome bot";
using var cts = new CancellationTokenSource();
ReceiverOptions receiverOptions = new() { AllowedUpdates = { } }; bot.StartReceiving(Handlers.HandleUpdateAsync, Handlers.HandleErrorAsync, receiverOptions, cts.Token);
Console.WriteLine($"Start listening for @{me.Username}"); Console.ReadLine();
cts.Cancel(); }}

Handlers.cs

 internal class Handlers    {        public static Task HandleErrorAsync(ITelegramBotClient botClient, Exception exception, CancellationToken cancellationToken)        {            var errorMessage = exception switch            {                ApiRequestException apiRequestException => $"Telegram API Error:\n[{apiRequestException.ErrorCode}]\n{apiRequestException.Message}",                _ => exception.ToString()            };
Console.WriteLine(errorMessage); return Task.CompletedTask; }
public static async Task HandleUpdateAsync(ITelegramBotClient botClient, Update update, CancellationToken cancellationToken) { var handler = update.Type switch { UpdateType.Message => BotOnMessageReceived(botClient, update.Message!), _ => UnknownUpdateHandlerAsync(botClient, update) };
try { await handler; } catch (Exception exception) { await HandleErrorAsync(botClient, exception, cancellationToken); } }
private static async Task BotOnMessageReceived(ITelegramBotClient botClient, Message message) { Console.WriteLine($"Receive message type: {message.Type}");
if (message.Type == MessageType.Contact && message.Contact != null) { // TODO: save the number... Console.WriteLine($"Phone number: {message.Contact.PhoneNumber}"); }
if (message.Type != MessageType.Text) return; var action = message.Text!.Split(' ')[0] switch { "/myNumber" => RequestContactAndLocation(botClient, message), _ => Usage(botClient, message) }; Message sentMessage = await action; Console.WriteLine($"The message was sent with id: {sentMessage.MessageId}");

static async Task<Message> RequestContactAndLocation(ITelegramBotClient botClient, Message message) { ReplyKeyboardMarkup requestReplyKeyboard = new( new[] { // KeyboardButton.WithRequestLocation("Location"), // this for the location if you need it KeyboardButton.WithRequestContact("Send my phone Number"), });
return await botClient.SendTextMessageAsync(chatId: message.Chat.Id, text: "Could you please send your phone number?", replyMarkup: requestReplyKeyboard); }
static async Task<Message> Usage(ITelegramBotClient botClient, Message message) { const string usage = "/myNumber - to send your phone number";
return await botClient.SendTextMessageAsync(chatId: message.Chat.Id, text: usage, replyMarkup: new ReplyKeyboardRemove()); } } private static Task UnknownUpdateHandlerAsync(ITelegramBotClient botClient, Update update) { Console.WriteLine($"Unknown update type: {update.Type}"); return Task.CompletedTask; }}

军机故阁
最新的安全情报与技术
 最新文章