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-17 20:44:52 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
e1e20055a63cd4d8717fe33f93513b231dd3bcba
e1e20055
2 parents
eca01dcf
cf43a46d
Merge branch 'master' of
https://github.com/yhackerbv/VulnNottiProject
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
15 deletions
Vulnerablity_DB/VulnCrawler/VulnPython.cs
Vulnerablity_DB/VulnCrawler/VulnPython.cs
View file @
e1e2005
...
...
@@ -16,28 +16,19 @@ namespace VulnCrawler
/// </summary>
public
class
VulnPython
:
VulnAbstractCrawler
{
protected
override
string
Extension
=>
".py"
;
protected
override
string
RegexFuncPattern
=>
$
@"@@ \-(?<{OldStart}>\d+),(?<{OldLines}>\d+) \+(?<{NewStart}>\d+),(?<{NewLines}>\d+) @@ def (?<{MethodName}>\w+)"
;
protected
override
string
ReservedFileName
=>
"PyReserved.txt"
;
// protected override Regex MethodExtractor => new Regex(RegexFuncPattern);
public
override
MatchCollection
GetMatches
(
string
patchCode
)
{
//var regs = Regex.Matches(patchCode, RegexFuncPattern);
var
regs
=
MethodExtractor
.
Matches
(
patchCode
);
return
regs
;
}
protected
override
string
GetOriginalFunc
(
Stream
oldStream
,
string
methodName
)
{
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
)
{
...
...
@@ -65,12 +56,8 @@ namespace VulnCrawler
}
return
oldBuilder
.
ToString
();
}
public
override
string
RemoveComment
(
string
original
)
{
string
txt
=
Regex
.
Replace
(
original
,
Environment
.
NewLine
,
""
);
StringBuilder
sb
=
new
StringBuilder
();
sb
.
Append
(
"\"\"\""
);
sb
.
Append
(
@".*"
);
...
...
@@ -81,7 +68,5 @@ namespace VulnCrawler
}
return
replace
;
}
}
}
...
...
Please
register
or
login
to post a comment