Showing
5 changed files
with
24 additions
and
17 deletions
... | @@ -25,21 +25,14 @@ namespace DownloaderGithubClone | ... | @@ -25,21 +25,14 @@ namespace DownloaderGithubClone |
25 | Console.Write("Git Repository URL을 입력하세요 : "); | 25 | Console.Write("Git Repository URL을 입력하세요 : "); |
26 | string url = Console.ReadLine(); | 26 | string url = Console.ReadLine(); |
27 | //https://github.com/django/django.git | 27 | //https://github.com/django/django.git |
28 | - | ||
29 | - | ||
30 | string pattern = @"https://github.com/.+/(?<ProjectName>.+)\.(.+)"; | 28 | string pattern = @"https://github.com/.+/(?<ProjectName>.+)\.(.+)"; |
31 | - | ||
32 | var match = Regex.Match(url, pattern); | 29 | var match = Regex.Match(url, pattern); |
33 | - | ||
34 | if (!match.Success) { | 30 | if (!match.Success) { |
35 | Console.WriteLine($"패턴이 맞지 않습니다. Pattern : {pattern}"); | 31 | Console.WriteLine($"패턴이 맞지 않습니다. Pattern : {pattern}"); |
36 | return; | 32 | return; |
37 | } | 33 | } |
38 | - | ||
39 | - | ||
40 | string prName = match.Groups["ProjectName"].Value; | 34 | string prName = match.Groups["ProjectName"].Value; |
41 | Console.WriteLine(prName); | 35 | Console.WriteLine(prName); |
42 | - | ||
43 | int idx = 1; | 36 | int idx = 1; |
44 | string path = Path.Combine(dir, prName); | 37 | string path = Path.Combine(dir, prName); |
45 | if (Directory.Exists(path)) { | 38 | if (Directory.Exists(path)) { | ... | ... |
... | @@ -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,6 +111,7 @@ namespace VulnUserCodeAnalyzer | ... | @@ -111,6 +111,7 @@ 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 | ||
... | @@ -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 | /* 경과 시간 체크 */ |
... | @@ -327,6 +337,7 @@ namespace VulnUserCodeAnalyzer | ... | @@ -327,6 +337,7 @@ namespace VulnUserCodeAnalyzer |
327 | { | 337 | { |
328 | type = "EXCUTE"; | 338 | type = "EXCUTE"; |
329 | } | 339 | } |
340 | + | ||
330 | var urlBytes = Convert.FromBase64String(findCveDict[cve].FirstOrDefault().Url); | 341 | var urlBytes = Convert.FromBase64String(findCveDict[cve].FirstOrDefault().Url); |
331 | string url = Encoding.Unicode.GetString(urlBytes); | 342 | string url = Encoding.Unicode.GetString(urlBytes); |
332 | 343 | ... | ... |
... | @@ -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 | ... | ... |
-
Please register or login to post a comment