예제 #1
0
 /// <summary>
 /// Find all respositories with login name of owasp
 /// This routine does not use pagination
 /// </summary>
 public void GitHubListRepositories()
 {
     try {
         GitHubCommits githubCommits = new GitHubCommits();
         Stream        resStream     = null;
         resStream = GitHubRepositories.GitHubURL_ListRepositories().GetResponse().GetResponseStream();
         JArray  jsonVal = JArray.Parse(Request2String.ConvertRequest2String(resStream)) as JArray;
         dynamic repos   = jsonVal;
         foreach (dynamic repo in repos)
         {
             DashBoardData dbData = new DashBoardData();
             if (repo.name == string.Empty)
             {
                 throw new ArgumentNullException();
             }
             dbData.Repo_User             = "******";
             dbData.Repo_Name             = repo.name;
             dbData.Description           = repo.description;
             dbData.OpenIssuesCount       = repo.open_issues_count;
             dbData.Lanuage               = repo.language;
             dbData.Repo_LastActivityDate = repo.updated_at;
             githubCommits.Commits(dbData);
         }
         GitHubFindRespositories();  // find repositories where the user name is not "OWASP"
     }catch (Exception e) {
         System.Console.WriteLine(e.Message);
         Environment.Exit(-1);
     }
 }
예제 #2
0
        static void Main(string[] args)
        {
            dictionary = new Dictionary <string, DashBoardData>();
            GitHubRepositories githubRepositories = new GitHubRepositories();

            try {
                githubRepositories.GitHubListRepositories();

                MediaWiki.TableHeader();
                MediaWiki.TableRow();

                CSV.CSVHeader();
                CSV.CSVRow();
            }
            catch (Exception e) {
                System.Console.Out.WriteLine(e.Message);
                Environment.Exit(-1);
            }
        }
예제 #3
0
 /// <summary>
 /// Find OWASP respositories via search, repositories with login name of owasp will not be added.
 /// Pagination is in use
 /// </summary>
 private void GitHubFindRespositories()
 {
     try {
         for (int pageNumber = 1; pageNumber < 32; pageNumber++)
         {
             GitHubCommits githubCommits = new GitHubCommits();
             Stream        resStream     = null;
             resStream = GitHubRepositories.GitHubURL_SearchRepositories(pageNumber).GetResponse().GetResponseStream();
             string  s1      = Request2String.ConvertRequest2String(resStream);
             JObject results = JObject.Parse(s1);
             foreach (var result in results["items"])
             {
                 Console.WriteLine("start specific repo" + "  " + (string)result["name"]);
                 string name  = (string)result["name"];
                 string owner = (string)result["owner"]["login"];
                 if (!owner.ToLower().Equals("owasp"))
                 {
                     resStream = GitHubRepositories.GitHubURL_ARepository(owner, name).GetResponse().GetResponseStream();
                     string        s2     = Request2String.ConvertRequest2String(resStream);
                     JObject       repo   = JObject.Parse(s2);
                     DashBoardData dbData = new DashBoardData();
                     dbData.Repo_User             = (string)repo["owner"]["login"];
                     dbData.Repo_Name             = (string)repo["name"];
                     dbData.Description           = (string)repo["description"];
                     dbData.OpenIssuesCount       = (int)repo["open_issues_count"];
                     dbData.Lanuage               = (string)repo["lanuage"];
                     dbData.Repo_LastActivityDate = (DateTime)repo["updated_at"];
                     System.Console.WriteLine(dbData.Repo_Name);
                     githubCommits.Commits(dbData);
                 }
                 Console.WriteLine("end specific repo");
             }
             Console.WriteLine("End GitHubFindRespositories()");
         }
     }
     catch (Exception e) {
         System.Console.WriteLine(e.Message);
         Environment.Exit(-1);
     }
 }