Beispiel #1
0
        public List <Offence> FindOffences()
        {
            List <Offence> offences = new List <Offence> ();
            //This one is: Paste Search by NetBootCamp (90+ sites)
            //https://cse.google.com/cse/publicurl?cx=013212718322258083429:lha4khxcshs&q=@emaildomain
            List <string> offenceSearchTerms = StorageHelper.ReadLines(StorageHelper.RepoName.EMAIL_OFFENCES);

            foreach (string offence in offenceSearchTerms)
            {
                if (offence.StartsWith("#"))
                {
                    continue;
                }

                Console.WriteLine("Searching for offence:" + offence);
                foreach (string url in searchUrls(offence))
                {
                    Console.Write("\tProcessing:" + url);
                    if (url == null || url == "")
                    {
                        continue;
                    }

                    if (ModuleHelper.HasProcessedUrl(url))
                    {
                        Console.WriteLine(":Already processed.");
                        continue;
                    }

                    if (ModuleHelper.IsViolation(url, offence))
                    {
                        Console.WriteLine("::FOUND OFFENCE::");

                        offences.Add(new Offence()
                        {
                            Text = offence,
                            Type = this.GetType().ToString(),
                            Url  = url
                        });

                        ModuleHelper.ReportViolation(url, offence);
                    }
                    else
                    {
                        Console.WriteLine(":No violations found.");
                    }

                    ModuleHelper.MarkUrlAsProcessed(url);
                }
            }

            return(offences);
        }
Beispiel #2
0
        public List <Offence> FindOffences()
        {
            List <Offence> offences           = new List <Offence> ();
            List <string>  offenceSearchTerms = StorageHelper.ReadLines(StorageHelper.RepoName.GITHUB_OFFENCES);

            foreach (string offence in offenceSearchTerms)
            {
                if (offence.StartsWith("#"))
                {
                    continue;
                }

                Console.WriteLine("Searching for git offence:" + offence);
                foreach (string url in searchGitUrls(offence))
                {
                    Console.Write("\tProcessing:" + url);
                    if (url == null || url == "")
                    {
                        continue;
                    }

                    if (ModuleHelper.HasProcessedUrl(url))
                    {
                        Console.WriteLine(":Already processed.");
                        continue;
                    }

                    if (ModuleHelper.IsViolation(url, offence))
                    {
                        Console.WriteLine("::FOUND OFFENCE::");

                        offences.Add(new Offence()
                        {
                            Text = offence,
                            Type = this.GetType().ToString(),
                            Url  = url
                        });

                        ModuleHelper.ReportViolation(url, offence);
                    }
                    else
                    {
                        Console.WriteLine(":No violations found.");
                    }

                    ModuleHelper.MarkUrlAsProcessed(url);
                }
            }

            return(offences);
        }