Showing
1 changed file
with
26 additions
and
5 deletions
... | @@ -401,14 +401,13 @@ namespace VulnCrawler | ... | @@ -401,14 +401,13 @@ namespace VulnCrawler |
401 | } | 401 | } |
402 | public static IEnumerable<_Vuln> SelectVulnbyLen(int _lenFunc) | 402 | public static IEnumerable<_Vuln> SelectVulnbyLen(int _lenFunc) |
403 | { | 403 | { |
404 | - // var list = new List<_Vuln>(); | ||
405 | String sql = string.Empty; | 404 | String sql = string.Empty; |
406 | MySqlCommand cmd = new MySqlCommand(); | 405 | MySqlCommand cmd = new MySqlCommand(); |
407 | cmd.Connection = Conn; | 406 | cmd.Connection = Conn; |
408 | cmd.CommandText = "SELECT * FROM vuln_Info where lenFunc=" + _lenFunc; | 407 | cmd.CommandText = "SELECT * FROM vuln_Info where lenFunc=" + _lenFunc; |
409 | 408 | ||
410 | System.Data.DataSet ds = new System.Data.DataSet(); | 409 | System.Data.DataSet ds = new System.Data.DataSet(); |
411 | - MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM vuln_Info where lenFunc=" + _lenFunc, Conn); | 410 | + MySqlDataAdapter da = new MySqlDataAdapter(cmd.CommandText, Conn); |
412 | da.Fill(ds); | 411 | da.Fill(ds); |
413 | 412 | ||
414 | //vuln에 입력 | 413 | //vuln에 입력 |
... | @@ -425,11 +424,33 @@ namespace VulnCrawler | ... | @@ -425,11 +424,33 @@ namespace VulnCrawler |
425 | Url = Convert.ToString(row["url"]) | 424 | Url = Convert.ToString(row["url"]) |
426 | }; | 425 | }; |
427 | yield return vuln; | 426 | yield return vuln; |
428 | - //list.Add(vuln); | ||
429 | } | 427 | } |
430 | - //해당 list 반환 | ||
431 | - // return list; | ||
432 | } | 428 | } |
429 | + public static IEnumerable<_Vuln> SelectVulnbyCve(string _cve) | ||
430 | + { | ||
431 | + String sql = string.Empty; | ||
432 | + MySqlCommand cmd = new MySqlCommand(); | ||
433 | + cmd.Connection = Conn; | ||
434 | + cmd.CommandText = $"SELECT * FROM vuln_Info where cve='" + _cve + $"'"; | ||
433 | 435 | ||
436 | + System.Data.DataSet ds = new System.Data.DataSet(); | ||
437 | + MySqlDataAdapter da = new MySqlDataAdapter(cmd.CommandText, Conn); | ||
438 | + da.Fill(ds); | ||
439 | + //vuln에 입력 | ||
440 | + foreach (System.Data.DataRow row in ds.Tables[0].Rows) | ||
441 | + { | ||
442 | + _Vuln vuln = new _Vuln | ||
443 | + { | ||
444 | + VulnId = Convert.ToInt32(row["vulnId"]), | ||
445 | + Cve = Convert.ToString(row["cve"]), | ||
446 | + FuncName = Convert.ToString(row["funcName"]), | ||
447 | + LenFunc = Convert.ToInt32(row["lenFunc"]), | ||
448 | + Code = Convert.ToString(row["code"]), | ||
449 | + BlockHash = Convert.ToString(row["blockHash"]), | ||
450 | + Url = Convert.ToString(row["url"]) | ||
451 | + }; | ||
452 | + yield return vuln; | ||
453 | + } | ||
454 | + } | ||
434 | } | 455 | } |
435 | } | 456 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment