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 19:52:02 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
cf43a46dc3ff8dfc81f94244ad71134fde6d7e36
cf43a46d
1 parent
5e7bb17e
크리티컬 변수 추출 보완
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
6 deletions
Vulnerablity_DB/VulnCrawler/Program.cs
Vulnerablity_DB/VulnCrawler/VulnAbstractCrawler.cs
Vulnerablity_DB/VulnCrawler/Program.cs
View file @
cf43a46
...
...
@@ -69,7 +69,7 @@ namespace VulnCrawler
// var fields = VulnWorker.GetCriticalVariant(@"return _is_safe_url(url, host) and _is_safe_url(url.replace('\\', '/'), host)");
var
c
=
new
VulnC
();
var
fields
=
c
.
GetCriticalVariant
(
@"cs64_chunk.chunkSize64 = 12345678;
"
);
var
fields
=
c
.
ExtractCriticalVariant
(
@"!DoReadFile (infile, &ds64_chunk, sizeof (DS64Chunk), &bcount) ||/* aaaa */
"
);
foreach
(
var
item
in
fields
)
{
Console
.
WriteLine
(
item
);
...
...
Vulnerablity_DB/VulnCrawler/VulnAbstractCrawler.cs
View file @
cf43a46
...
...
@@ -168,24 +168,33 @@ namespace VulnCrawler
/// </summary>
/// <param name="line">현재 코드줄</param>
/// <returns></returns>
public
IEnumerable
<
string
>
Ge
tCriticalVariant
(
string
line
)
public
IEnumerable
<
string
>
Extrac
tCriticalVariant
(
string
line
)
{
line
=
line
.
Trim
();
if
(
string
.
IsNullOrWhiteSpace
(
line
))
{
yield
break
;
}
if
(
line
.
StartsWith
(
"//"
))
{
yield
break
;
}
string
declarePattern
=
@"(?<Declare>[a-zA-Z0-9_\.]+) [a-zA-Z0-9_\.]+ ="
;
// 메서드 정규식 패턴
string
methodPattern
=
@"(
\w
+)\s*\("
;
string
methodPattern
=
@"(
[a-zA-Z0-9_\.]
+)\s*\("
;
// 변수 정규식 패턴
string
fieldPattern
=
@"^*?[a-zA-Z0-9_\.]+"
;
string
fieldPattern
=
@"^*?[a-zA-Z0-9_\.
\[\]
]+"
;
string
invalidPattern
=
@"^[\d\.]+"
;
string
commentPattern
=
@"("".*"")"
;
string
commentPattern
=
@"[""].*[""]"
;
string
commentPattern2
=
@"\/\/.*"
;
string
commentPattern3
=
@"\/\*.+\*\/"
;
line
=
Regex
.
Replace
(
line
,
commentPattern
,
""
);
line
=
Regex
.
Replace
(
line
,
commentPattern2
,
""
);
line
=
Regex
.
Replace
(
line
,
commentPattern3
,
""
);
// 메서드 목록
var
methodSets
=
new
HashSet
<
string
>();
...
...
@@ -208,7 +217,7 @@ namespace VulnCrawler
if
(
method
.
Success
)
{
Console
.
WriteLine
(
method
.
Groups
[
1
].
Value
);
methodSets
.
Add
(
method
.
Groups
[
1
].
Value
);
methodSets
.
Add
(
method
.
Groups
[
1
].
Value
);
// aaaa
}
}
Console
.
WriteLine
(
"----"
);
...
...
Please
register
or
login
to post a comment