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-01 20:13:29 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
65d2d3c1896ab1118fab406b2fc9ff515f390b19
65d2d3c1
1 parent
fd24e2e7
mysql column 수정
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
12 deletions
Vulnerablity_DB/VulnCrawler/VulnRDS.cs
Vulnerablity_DB/VulnCrawler/VulnRDS.cs
View file @
65d2d3c
...
...
@@ -86,7 +86,7 @@ namespace VulnCrawler
//DB insert
try
{
sql
=
"INSERT INTO vulnInfo(vulnId, lenBlock,
repositName,
cve, funcName, numBlock, codeOriBefore, codeOriAfter, codeAbsBefore, codeAbsAfter, blockHash) "
+
sql
=
"INSERT INTO vulnInfo(vulnId, lenBlock, cve, funcName, numBlock, codeOriBefore, codeOriAfter, codeAbsBefore, codeAbsAfter, blockHash) "
+
$
"VALUES({last_vulnId}, {vuln.LenBlock}, '{vuln.Cve}', '{vuln.FuncName}', {vuln.NumBlock}, '{vuln.CodeOriBefore}', '{vuln.CodeOriAfter}', '{vuln.CodeAbsBefore}', '{vuln.CodeAbsAfter}', '{vuln.BlockHash}')"
;
Console
.
WriteLine
(
sql
);
cmd
=
new
MySqlCommand
(
sql
,
Conn
);
...
...
@@ -147,12 +147,11 @@ namespace VulnCrawler
Console
.
WriteLine
(
e
.
StackTrace
);
}
}
public
static
Vuln
SearchVulnCve
(
string
_cve
)
public
static
Vuln
SearchVulnCve
(
int
_vulnId
)
{
Vuln
vuln
=
new
Vuln
();
Conn
.
Open
();
//특정 cve 가 있는지 검사
String
sql
=
"select * from vulnInfo where cve like '"
+
_
cve
+
"'"
;
String
sql
=
"select * from vulnInfo where cve like '"
+
_
vulnId
+
"'"
;
MySqlCommand
cmd
=
new
MySqlCommand
(
sql
,
Conn
);
MySqlDataReader
rdr
=
cmd
.
ExecuteReader
();
while
(
rdr
.
Read
())
...
...
@@ -168,19 +167,29 @@ namespace VulnCrawler
vuln
.
CodeAbsAfter
=
Convert
.
ToString
(
rdr
[
"codeAbsAfter"
]);
vuln
.
BlockHash
=
Convert
.
ToString
(
rdr
[
"blockHash"
]);
}
Conn
.
Close
();
return
vuln
;
}
public
static
int
ReturnUserLastId
()
public
static
bool
CheckVulnData
(
int
_vulnId
)
{
Conn
.
Open
();
String
sql
=
"select max(userId) from userInfo"
;
string
sql
=
"select count(*) from vulnInfo where vulnId like '"
+
_vulnId
+
"'"
;
MySqlCommand
cmd
=
new
MySqlCommand
(
sql
,
Conn
);
int
last_userId
=
(
Convert
.
ToInt32
(
cmd
.
ExecuteScalar
()))
+
1
;
Conn
.
Close
();
return
last_userId
;
int
RecordCount
=
Convert
.
ToInt32
(
cmd
.
ExecuteScalar
());
if
(
RecordCount
>
0
)
return
true
;
else
return
false
;
}
public
static
bool
CheckUserData
(
int
_userId
)
{
string
sql
=
"select count(*) from userInfo where vulnId like '"
+
_userId
+
"'"
;
MySqlCommand
cmd
=
new
MySqlCommand
(
sql
,
Conn
);
int
RecordCount
=
Convert
.
ToInt32
(
cmd
.
ExecuteScalar
());
if
(
RecordCount
>
0
)
return
true
;
else
return
false
;
}
//public static IEnumerable<string> SearchVulnData(int _len)
//{
//
...
...
Please
register
or
login
to post a comment