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-05-21 00:48:59 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
398457427db79d436f77a687d85d4dd5ea66b33b
39845742
2 parents
e0776616
72ce2194
충돌 해결
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
9 deletions
Vulnerablity_DB/VulnCrawler/VulnAbstractCrawler.cs
Vulnerablity_DB/VulnCrawler/VulnWorker.cs
Vulnerablity_DB/VulnCrawler/VulnAbstractCrawler.cs
View file @
3984574
...
...
@@ -20,6 +20,7 @@ namespace VulnCrawler
public
bool
HasCritical
{
get
;
set
;
}
public
string
Code
{
get
;
set
;
}
public
string
Hash
{
get
;
set
;
}
public
IEnumerable
<
string
>
CriticalList
{
get
;
set
;
}
}
protected
Regex
extractMethodLine
;
...
...
@@ -245,6 +246,7 @@ namespace VulnCrawler
public
virtual
IEnumerable
<(
string
methodName
,
IList
<
Block
>
blocks
)>
Process
(
Blob
oldBlob
,
IDictionary
<
string
,
IEnumerable
<
string
>>
table
)
{
foreach
(
var
item
in
table
)
{
// 메서드 이름
string
methodName
=
item
.
Key
;
// 패치 전 원본 파일 스트림
Stream
oldStream
=
oldBlob
.
GetContentStream
();
...
...
@@ -255,18 +257,25 @@ namespace VulnCrawler
string
md5
=
string
.
Empty
;
if
(
item
.
Value
.
Count
()
!=
0
)
{
Console
.
WriteLine
(
"크리티컬 변수 목록"
);
Console
.
ForegroundColor
=
ConsoleColor
.
Cyan
;
foreach
(
var
c
in
item
.
Value
)
{
Console
.
WriteLine
(
c
);
}
Console
.
ResetColor
();
Console
.
WriteLine
(
"-------------------"
);
// 크리티컬 블록 추출
var
blocks
=
GetCriticalBlocks
(
func
,
item
.
Value
).
ToList
();
if
(
blocks
==
null
)
{
continue
;
}
foreach
(
var
block
in
blocks
)
{
block
.
Hash
=
MD5HashFunc
(
block
.
Code
);
block
.
CriticalList
=
item
.
Value
;
}
yield
return
(
methodName
,
blocks
);
}
...
...
Vulnerablity_DB/VulnCrawler/VulnWorker.cs
View file @
3984574
...
...
@@ -34,6 +34,8 @@ namespace VulnCrawler
// 현재 커밋에 대한 패치 엔트리 배열을 출력함
PrintPatchEntrys
(
entrys
,
crawler
,
message
,
cve
);
}
Console
.
ReadLine
();
}
}
...
...
@@ -87,15 +89,22 @@ namespace VulnCrawler
Console
.
BackgroundColor
=
ConsoleColor
.
DarkRed
;
Console
.
WriteLine
(
$
"Patched: \n{entry.Patch}"
);
Console
.
ResetColor
();
var
table
=
self
.
ExtractGitCriticalMethodTable
(
entry
.
Patch
);
foreach
(
var
tuple
in
self
.
Process
(
oldBlob
,
table
))
{
(
var
methodName
,
var
blocks
)
=
tuple
;
Console
.
BackgroundColor
=
ConsoleColor
.
DarkRed
;
Console
.
WriteLine
(
$
"메서드 이름 : {methodName}"
);
Console
.
ResetColor
();
//Console.ForegroundColor = ConsoleColor.Blue;
//foreach (var c in )
//{
// Console.WriteLine(c);
//}
//Console.ResetColor();
foreach
(
var
block
in
blocks
)
{
if
(
block
.
HasCritical
)
{
Console
.
BackgroundColor
=
ConsoleColor
.
DarkMagenta
;
...
...
@@ -122,7 +131,7 @@ namespace VulnCrawler
// //}
//}
Console
.
ReadLine
();
//
Console.ReadLine();
}
else
{
...
...
@@ -168,9 +177,9 @@ namespace VulnCrawler
}
catch
(
Exception
e
)
{
Console
.
WriteLine
(
entry
.
Patch
);
Console
.
WriteLine
(
e
.
ToString
());
Console
.
ReadLine
();
//
Console.WriteLine(entry.Patch);
//
Console.WriteLine(e.ToString());
//
Console.ReadLine();
continue
;
}
...
...
Please
register
or
login
to post a comment