Toggle navigation
Toggle navigation
This project
Loading...
Sign in
노현종
/
2018-1-Capstone1-VulnNotti
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
이지윤
2018-06-09 10:17:42 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0121a72f369fa9526860ff84158b015d42ef34a6
0121a72f
1 parent
41390e98
vuln_Detail 추가
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
0 deletions
Vulnerablity_DB/VulnCrawler/VulnRDS.cs
Vulnerablity_DB/VulnCrawler/VulnRDS.cs
View file @
0121a72
...
...
@@ -53,6 +53,16 @@ namespace VulnCrawler
return
802558182
+
EqualityComparer
<
string
>.
Default
.
GetHashCode
(
BlockHash
);
}
}
public
class
Vuln_detail
{
public
int
Index
{
get
;
set
;
}
=
-
1
;
/* index key */
public
string
Type
{
get
;
set
;
}
=
"NULL"
;
/* type */
public
string
Year
{
get
;
set
;
}
=
"NULL"
;
/* year */
public
string
Level
{
get
;
set
;
}
=
"NULL"
;
/* level */
public
string
UserName
{
get
;
set
;
}
=
"NULL"
;
/* user name */
public
string
CveName
{
get
;
set
;
}
=
"NULL"
;
/* cve name */
}
//connect
public
static
void
Connect
(
AWS
.
Account
account
,
string
dbName
)
{
...
...
@@ -214,6 +224,44 @@ namespace VulnCrawler
Console
.
ReadLine
();
}
}
public
static
void
InsertVulnDetail
(
Vuln_detail
vuln
)
{
String
sql
=
string
.
Empty
;
MySqlCommand
cmd
=
null
;
Retry
:
//DB insert
try
{
cmd
=
new
MySqlCommand
{
Connection
=
Conn
,
//db에 추가
CommandText
=
"INSERT INTO vulnDetail(type, year, level, userName, cveName) VALUES(@type, @year, @level, @userName, @cveName)"
};
cmd
.
Parameters
.
AddWithValue
(
"@type"
,
$
"{vuln.Type}"
);
cmd
.
Parameters
.
AddWithValue
(
"@year"
,
$
"{vuln.Year}"
);
cmd
.
Parameters
.
AddWithValue
(
"@level"
,
$
"{vuln.Level}"
);
cmd
.
Parameters
.
AddWithValue
(
"@userName"
,
$
"{vuln.UserName}"
);
cmd
.
Parameters
.
AddWithValue
(
"@cveName"
,
$
"{vuln.CveName}"
);
cmd
.
ExecuteNonQuery
();
//콘솔출력용
sql
=
"INSERT INTO vulnDetail(type, year, level, userName, cveName) "
+
$
"VALUES({vuln.Type}, {vuln.Year}, {vuln.Level}, {vuln.UserName}, {vuln.CveName})"
;
Console
.
WriteLine
(
sql
);
}
catch
(
Exception
e
)
{
Console
.
WriteLine
(
e
.
ToString
());
string
es
=
e
.
ToString
();
if
(
es
.
Contains
(
"Connection must be valid and open"
))
{
Connect
(
Account
,
DbName
);
goto
Retry
;
}
}
}
public
static
void
UpdateVulnData
(
int
_vulnId
,
_Vuln
vuln
)
{
String
sql
=
string
.
Empty
;
MySqlCommand
cmd
=
null
;
...
...
Please
register
or
login
to post a comment