노현종

SelectAllReposit 수정

...@@ -534,24 +534,23 @@ namespace VulnCrawler ...@@ -534,24 +534,23 @@ namespace VulnCrawler
534 yield return a; 534 yield return a;
535 } 535 }
536 } 536 }
537 - public static IEnumerable<string> SelectAllReposit() 537 + public static IEnumerable<(string userName, string repository)> SelectAllReposit()
538 { 538 {
539 String sql = string.Empty; 539 String sql = string.Empty;
540 - MySqlCommand cmd = new MySqlCommand(); 540 + MySqlCommand cmd = new MySqlCommand
541 - cmd.Connection = Conn; 541 + {
542 - cmd.CommandText = "SELECT repository FROM vuln.auth_user "; 542 + Connection = Conn,
543 - string a = null; 543 + CommandText = "SELECT username, repository FROM vuln.auth_user "
544 - 544 + };
545 System.Data.DataSet ds = new System.Data.DataSet(); 545 System.Data.DataSet ds = new System.Data.DataSet();
546 MySqlDataAdapter da = new MySqlDataAdapter(cmd.CommandText, Conn); 546 MySqlDataAdapter da = new MySqlDataAdapter(cmd.CommandText, Conn);
547 da.Fill(ds); 547 da.Fill(ds);
548 //vuln에 입력 548 //vuln에 입력
549 foreach (System.Data.DataRow row in ds.Tables[0].Rows) 549 foreach (System.Data.DataRow row in ds.Tables[0].Rows)
550 { 550 {
551 - a = Convert.ToString(row["repository"]); 551 + string repo = Convert.ToString(row["repository"]);
552 - Console.WriteLine(a); 552 + string user = Convert.ToString(row["username"]);
553 - 553 + yield return (user, repo);
554 - yield return a;
555 } 554 }
556 } 555 }
557 public static IEnumerable<string> SelectReposit_detail() 556 public static IEnumerable<string> SelectReposit_detail()
......
...@@ -111,8 +111,9 @@ namespace VulnUserCodeAnalyzer ...@@ -111,8 +111,9 @@ namespace VulnUserCodeAnalyzer
111 { 111 {
112 static void Main(string[] args) 112 static void Main(string[] args)
113 { 113 {
114 +
114 /* 연도별 CVE JSON 파일 로드 */ 115 /* 연도별 CVE JSON 파일 로드 */
115 - CVE_JSON.AutoLoad(); 116 + //CVE_JSON.AutoLoad();
116 117
117 /* 크롤러 타입 */ 118 /* 크롤러 타입 */
118 var crawler = new VulnC(); 119 var crawler = new VulnC();
...@@ -150,6 +151,15 @@ namespace VulnUserCodeAnalyzer ...@@ -150,6 +151,15 @@ namespace VulnUserCodeAnalyzer
150 return; 151 return;
151 } 152 }
152 153
154 + var reposits = VulnRDS.SelectAllReposit();
155 +
156 + foreach (var (userName, repository) in reposits)
157 + {
158 + Console.WriteLine($"{userName}, {repository}");
159 + }
160 +
161 + Console.ReadLine();
162 +
153 /* hashDict = 사용된 사용자 함수 정보 */ 163 /* hashDict = 사용된 사용자 함수 정보 */
154 var hashDict = new Dictionary<int, HashSet<VulnAbstractCrawler.UserBlock>>(); 164 var hashDict = new Dictionary<int, HashSet<VulnAbstractCrawler.UserBlock>>();
155 /* 경과 시간 체크 */ 165 /* 경과 시간 체크 */
......
...@@ -38,6 +38,9 @@ ...@@ -38,6 +38,9 @@
38 </Reference> 38 </Reference>
39 <Reference Include="System" /> 39 <Reference Include="System" />
40 <Reference Include="System.Core" /> 40 <Reference Include="System.Core" />
41 + <Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
42 + <HintPath>..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
43 + </Reference>
41 <Reference Include="System.Xml.Linq" /> 44 <Reference Include="System.Xml.Linq" />
42 <Reference Include="System.Data.DataSetExtensions" /> 45 <Reference Include="System.Data.DataSetExtensions" />
43 <Reference Include="Microsoft.CSharp" /> 46 <Reference Include="Microsoft.CSharp" />
......
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <packages> 2 <packages>
3 <package id="Newtonsoft.Json" version="11.0.2" targetFramework="net461" /> 3 <package id="Newtonsoft.Json" version="11.0.2" targetFramework="net461" />
4 + <package id="System.ValueTuple" version="4.5.0" targetFramework="net461" />
4 </packages> 5 </packages>
...\ No newline at end of file ...\ No newline at end of file
......