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-03 15:09:24 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4e6b5f513bfae20f2d5a53a3857caba7edcf0fc1
4e6b5f51
1 parent
43cab5c9
0503
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
6 deletions
Vulnerablity_DB/VulnCrawler/VulnC.cs
Vulnerablity_DB/VulnCrawler/VulnC.cs
View file @
4e6b5f5
...
...
@@ -10,21 +10,62 @@ namespace VulnCrawler
{
public
class
VulnC
:
VulnAbstractCrawler
{
protected
override
string
RegexFuncPattern
=>
$
@"@@ \-(?<{OldStart}>\d+),(?<{OldLines}>\d+) \+(?<{NewStart}>\d+),(?<{NewLines}>\d+) @@ (?<{MethodName}>.+)"
;
protected
override
string
RegexFuncPattern
=>
throw
new
NotImplementedException
();
protected
override
string
Extension
=>
throw
new
NotImplementedException
();
protected
override
string
Extension
=>
".c"
;
public
override
MatchCollection
GetMatches
(
string
patchCode
)
{
throw
new
NotImplementedException
();
var
regs
=
Regex
.
Matches
(
patchCode
,
RegexFuncPattern
);
return
regs
;
}
public
override
string
RemoveComment
(
string
original
)
{
throw
new
NotImplementedException
();
string
txt
=
Regex
.
Replace
(
original
,
Environment
.
NewLine
,
""
);
//StringBuilder sb = new StringBuilder();
//sb.Append("\"\"\"");
//sb.Append(@".*");
//sb.Append("\"\"\"");
//string replace = txt;
//if (Regex.Match(txt, sb.ToString()).Success) {
// replace = Regex.Replace(txt, sb.ToString(), "");
//}
return
replace
;
}
protected
override
string
GetOriginalFunc
(
Stream
oldStream
,
string
methodName
)
{
throw
new
NotImplementedException
();
StringBuilder
oldBuilder
=
new
StringBuilder
();
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
);
}
}
}
return
oldBuilder
.
ToString
();
}
}
}
...
...
Please
register
or
login
to post a comment