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-16 09:27:54 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a3acbbbfdaab008d078d853bdb8c187069d2f6b1
a3acbbbf
1 parent
3cca2477
0516
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
21 deletions
Vulnerablity_DB/VulnCrawler/VulnAbstractCrawler.cs
Vulnerablity_DB/VulnCrawler/VulnC.cs
Vulnerablity_DB/VulnCrawler/VulnPython.cs
Vulnerablity_DB/VulnCrawler/VulnAbstractCrawler.cs
View file @
a3acbbb
...
...
@@ -30,6 +30,8 @@ namespace VulnCrawler
Repository
.
Dispose
();
}
protected
virtual
Regex
MethodExtractor
=>
new
Regex
(
RegexFuncPattern
);
#
region
메서드
패턴
정규식
그룹
// 정규식 그룹화
// @@ -oldStart,oldLines +newStart,newLines @@ MethodName():
...
...
Vulnerablity_DB/VulnCrawler/VulnC.cs
View file @
a3acbbb
...
...
@@ -10,10 +10,11 @@ namespace VulnCrawler
{
public
class
VulnC
:
VulnAbstractCrawler
{
protected
override
string
RegexFuncPattern
=>
$
@"@@ \-(?<{OldStart}>\d+),(?<{OldLines}>\d+) \+(?<{NewStart}>\d+),(?<{NewLines}>\d+) @@ (?<{MethodName}>
.+
)"
;
protected
override
string
RegexFuncPattern
=>
$
@"@@ \-(?<{OldStart}>\d+),(?<{OldLines}>\d+) \+(?<{NewStart}>\d+),(?<{NewLines}>\d+) @@ (?<{MethodName}>
(static)? [\w]+ [\w]+)\([\w \*\,\t\n]*\
)"
;
protected
override
string
Extension
=>
".c"
;
public
override
MatchCollection
GetMatches
(
string
patchCode
)
{
var
regs
=
Regex
.
Matches
(
patchCode
,
RegexFuncPattern
);
return
regs
;
...
...
@@ -38,26 +39,8 @@ namespace VulnCrawler
using
(
var
reader
=
new
StreamReader
(
oldStream
))
{
int
defSpace
=
0
;
while
(!
reader
.
EndOfStream
)
{
string
line
=
reader
.
ReadLine
();
if
(
defSpace
>
0
)
{
if
(
line
.
Length
<
defSpace
)
{
continue
;
}
string
concat
=
line
.
Substring
(
0
,
defSpace
);
if
(
string
.
IsNullOrWhiteSpace
(
concat
))
{
string
trim
=
line
.
Trim
();
// #으로 시작한다면 주석이니 제거
if
(
trim
.
StartsWith
(
"#"
))
{
continue
;
}
oldBuilder
.
AppendLine
(
line
);
}
else
{
continue
;
}
}
if
(
Regex
.
Match
(
line
,
$
@"{methodName}"
).
Success
)
{
defSpace
=
line
.
IndexOf
(
methodName
);
oldBuilder
.
AppendLine
(
line
);
}
...
...
Vulnerablity_DB/VulnCrawler/VulnPython.cs
View file @
a3acbbb
...
...
@@ -19,9 +19,13 @@ namespace VulnCrawler
protected
override
string
Extension
=>
".py"
;
protected
override
string
RegexFuncPattern
=>
$
@"@@ \-(?<{OldStart}>\d+),(?<{OldLines}>\d+) \+(?<{NewStart}>\d+),(?<{NewLines}>\d+) @@ def (?<{MethodName}>\w+)"
;
// protected override Regex MethodExtractor => new Regex(RegexFuncPattern);
public
override
MatchCollection
GetMatches
(
string
patchCode
)
{
var
regs
=
Regex
.
Matches
(
patchCode
,
RegexFuncPattern
);
//var regs = Regex.Matches(patchCode, RegexFuncPattern);
var
regs
=
MethodExtractor
.
Matches
(
patchCode
);
return
regs
;
}
...
...
Please
register
or
login
to post a comment