Ejemplo n.º 1
0
        static async Task ScanLink(Int32 workshopID)
        {
            WorkshopAddon Addon = await WorkshopHTTPAPI.GetAddonByIDAsync(workshopID, steamApiKey);

            Console.Write("Downloading Addon: {0}\n", Addon.URL);
            GMADAddon parsedAddon;

            using (var wc = new WebClient())
            {
                Byte[] data = await wc.DownloadDataTaskAsync(Addon.URL);

                parsedAddon = GMADParser.Parse(data);
                data        = new Byte[0];
            }

            Backdoor backdoorFinder = new Backdoor(parsedAddon);

            try
            {
                List <List <Backdoor.FlagStruct> > flagList = backdoorFinder.scanFile();

                foreach (var flagFile in flagList)
                {
                    foreach (Backdoor.FlagStruct fileStruct in flagFile)
                    {
                        int               lineNumber      = fileStruct.lineNumber;
                        String            FlagStr         = fileStruct.FlagStr;
                        GMADAddon.File    AddonFile       = fileStruct.AddonFile;
                        GMADAddon._Author Author          = parsedAddon.Author;
                        String            FlagDescription = fileStruct.FlagDescription;
                        Regex             CheckRegex      = fileStruct.CheckRegex;
                        int               CheckType       = fileStruct.CheckType;
                        int               Priority        = fileStruct.Priority;
                        string            AddonUrl        = "https://steamcommunity.com/sharedfiles/filedetails/?id=" + Addon.ID.ToString();

                        Console.Write("Potential Backdoor found in Addon:\nline number: {0}\nAddon URL: {1}\nAuthor SteamID: {2}\nFlag: {3}\nCode: {4}\n",
                                      lineNumber.ToString(),
                                      AddonUrl,
                                      Author.SteamID64,
                                      FlagDescription,
                                      FlagStr
                                      );
                    }
                }
            }
            catch (Exception ex)
            {
                Console.Write("Something went wrong...");
                Console.Write(ex.Message + "\n");
                Console.ReadLine();
            }
        }
Ejemplo n.º 2
0
        static async Task MainAsync()
        {
            if (!DataLog.configExists())
            {
                Init();
                steamApiKey = DataLog.getConfigVar("apikey");
                webhookURL  = DataLog.getConfigVar("webhookurl");
            }
            else
            {
                steamApiKey = DataLog.getConfigVar("apikey");
                webhookURL  = DataLog.getConfigVar("webhookurl");
            }

            Console.Write("What do you want to do? ");
            String Action = Console.ReadLine();

            if (Action == "help")
            {
                Console.Write("Commands: \nhelp - print help text\nscanlink [workshopLink] - scans the individual file\nwhitelistaddon [workshopURL]\nscanworkshop - scans the entire workshop\nextractaddon [workshopLink] - extracts an addon\n");
                await MainAsync();
            }
            else if (Action.StartsWith("scanlink"))
            {
                string workshopURL = Action.Split(' ')[1];
                Int32  workshopID  = WorkshopDownload.ParseID(workshopURL);

                await ScanLink(workshopID);
                await MainAsync();
            }
            else if (Action.StartsWith("whitelistaddon"))
            {
                string        workshopURL = Action.Split(' ')[1];
                Int32         workshopID  = WorkshopDownload.ParseID(workshopURL);
                WorkshopAddon Addon       = await WorkshopHTTPAPI.GetAddonByIDAsync(workshopID, steamApiKey);

                whiteListAddon(Addon);
                await MainAsync();
            }
            else if (Action == "scanworkshop")
            {
                await ScanWorkshop();
            }
            else if (Action.StartsWith("extractaddon"))
            {
                string        workshopURL   = Action.Split(' ')[1];
                Int32         workshopID    = WorkshopDownload.ParseID(workshopURL);
                WorkshopAddon workshopAddon = await WorkshopHTTPAPI.GetAddonByIDAsync(workshopID, steamApiKey);

                Console.Write("Downloading Addon: {0}\n", workshopAddon.URL);
                GMADAddon parsedAddon;

                using (var wc = new WebClient())
                {
                    Byte[] data = await wc.DownloadDataTaskAsync(workshopAddon.URL);

                    parsedAddon = GMADParser.Parse(data);
                    data        = new Byte[0];
                }

                WorkshopDownload.Extract(parsedAddon);
                await MainAsync();
            }
        }