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 01:30:18 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
bea587fc5729f0e15c682f1cb79942cbc665aeeb
bea587fc
2 parents
39845742
15323188
충돌
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
3 deletions
Vulnerablity_DB/VulnCrawler/VulnC.cs
Vulnerablity_DB/VulnCrawler/VulnC.cs
View file @
bea587f
...
...
@@ -229,6 +229,8 @@ namespace VulnCrawler
protected
override
IList
<
Block
>
GetCriticalBlocks
(
string
srcCode
,
IEnumerable
<
string
>
criticalList
)
{
// srcCode = Regex.Replace(srcCode, @"if.+\n\{", @"if.+\{", RegexOptions.Multiline);
var
split
=
srcCode
.
Split
(
'\n'
);
int
bracketCount
=
0
;
var
blockList
=
new
List
<
Block
>();
...
...
@@ -238,22 +240,46 @@ namespace VulnCrawler
{
return
null
;
}
bool
hasIf
=
false
;
bool
mainLine
=
true
;
/* 현재 라인이 메인 코드 라인인지 */
bool
criticalBlock
=
false
;
/* 현재 라인이
메인 코드
라인인지 */
int
blockNum
=
1
;
/*
현재 라인이 메인 코드 라인인지
*/
bool
criticalBlock
=
false
;
/* 현재 라인이
크리티컬 블록
라인인지 */
int
blockNum
=
1
;
/*
블록 번호
*/
foreach
(
var
line
in
split
)
{
bool
hasRight
=
false
;
string
trim
=
line
.
Trim
();
/* 중괄호 수 세기 */
int
openBracketCount
=
trim
.
Count
(
c
=>
c
==
'{'
);
int
closeBracketCount
=
trim
.
Count
(
c
=>
c
==
'}'
);
//if (!hasIf)
//{
// if (Regex.IsMatch(trim, @"^if.+\)$"))
// {
// // Console.WriteLine("if 들어감");
// hasIf = true;
// }
//}
//else
//{
// if (!Regex.IsMatch(trim, @"^\{"))
// {
// openBracketCount++;
// }
// hasIf = false;
//}
int
subtract
=
openBracketCount
-
closeBracketCount
;
bracketCount
+=
subtract
;
if
(
trim
.
Equals
(
"}"
))
{
builder
.
AppendLine
(
line
);
contin
ue
;
hasRight
=
tr
ue
;
}
/* 중괄호 연산 결과 1이라는 것은 메인 라인 */
if
(
bracketCount
==
1
)
...
...
@@ -313,10 +339,14 @@ namespace VulnCrawler
}
}
if
(!
hasRight
)
{
builder
.
AppendLine
(
line
);
}
}
/* 마지막 남은게 있을 수 있으니 추가 */
string
fs
=
builder
.
ToString
();
if
(!
string
.
IsNullOrWhiteSpace
(
fs
))
...
...
Please
register
or
login
to post a comment