Merge branch 'master' of https://github.com/yhackerbv/VulnNottiProject
Showing
22 changed files
with
377 additions
and
65 deletions
1 | -<?xml version="1.0" encoding="utf-8"?> | 1 | +<?xml version="1.0" encoding="utf-8"?> |
2 | <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | 2 | <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
3 | <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | 3 | <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> |
4 | <PropertyGroup> | 4 | <PropertyGroup> |
5 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | 5 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
6 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | 6 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
7 | - <ProjectGuid>8b3ec7f4-6106-4f2f-9a57-d10e4bbd93e8</ProjectGuid> | 7 | + <ProjectGuid>{8B3EC7F4-6106-4F2F-9A57-D10E4BBD93E8}</ProjectGuid> |
8 | <OutputType>Library</OutputType> | 8 | <OutputType>Library</OutputType> |
9 | <AppDesignerFolder>Properties</AppDesignerFolder> | 9 | <AppDesignerFolder>Properties</AppDesignerFolder> |
10 | <RootNamespace>AWS_Center</RootNamespace> | 10 | <RootNamespace>AWS_Center</RootNamespace> |
... | @@ -30,24 +30,19 @@ | ... | @@ -30,24 +30,19 @@ |
30 | <WarningLevel>4</WarningLevel> | 30 | <WarningLevel>4</WarningLevel> |
31 | </PropertyGroup> | 31 | </PropertyGroup> |
32 | <ItemGroup> | 32 | <ItemGroup> |
33 | - <Reference Include="System"/> | 33 | + <Reference Include="MySql.Data, Version=8.0.11.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL" /> |
34 | - | 34 | + <Reference Include="System" /> |
35 | - <Reference Include="System.Core"/> | 35 | + <Reference Include="System.Core" /> |
36 | - <Reference Include="System.Xml.Linq"/> | 36 | + <Reference Include="System.Xml.Linq" /> |
37 | - <Reference Include="System.Data.DataSetExtensions"/> | 37 | + <Reference Include="System.Data.DataSetExtensions" /> |
38 | - | 38 | + <Reference Include="Microsoft.CSharp" /> |
39 | - | 39 | + <Reference Include="System.Data" /> |
40 | - <Reference Include="Microsoft.CSharp"/> | 40 | + <Reference Include="System.Net.Http" /> |
41 | - | 41 | + <Reference Include="System.Xml" /> |
42 | - <Reference Include="System.Data"/> | ||
43 | - | ||
44 | - <Reference Include="System.Net.Http"/> | ||
45 | - | ||
46 | - <Reference Include="System.Xml"/> | ||
47 | </ItemGroup> | 42 | </ItemGroup> |
48 | <ItemGroup> | 43 | <ItemGroup> |
49 | <Compile Include="Class1.cs" /> | 44 | <Compile Include="Class1.cs" /> |
50 | <Compile Include="Properties\AssemblyInfo.cs" /> | 45 | <Compile Include="Properties\AssemblyInfo.cs" /> |
51 | </ItemGroup> | 46 | </ItemGroup> |
52 | <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | 47 | <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
53 | - </Project> | 48 | +</Project> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
AWS_Center/AWS_Center.sln
0 → 100644
1 | + | ||
2 | +Microsoft Visual Studio Solution File, Format Version 12.00 | ||
3 | +# Visual Studio 15 | ||
4 | +VisualStudioVersion = 15.0.27428.2037 | ||
5 | +MinimumVisualStudioVersion = 10.0.40219.1 | ||
6 | +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AWS_Center", "AWS_Center.csproj", "{8B3EC7F4-6106-4F2F-9A57-D10E4BBD93E8}" | ||
7 | +EndProject | ||
8 | +Global | ||
9 | + GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
10 | + Debug|Any CPU = Debug|Any CPU | ||
11 | + Release|Any CPU = Release|Any CPU | ||
12 | + EndGlobalSection | ||
13 | + GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
14 | + {8B3EC7F4-6106-4F2F-9A57-D10E4BBD93E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
15 | + {8B3EC7F4-6106-4F2F-9A57-D10E4BBD93E8}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
16 | + {8B3EC7F4-6106-4F2F-9A57-D10E4BBD93E8}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
17 | + {8B3EC7F4-6106-4F2F-9A57-D10E4BBD93E8}.Release|Any CPU.Build.0 = Release|Any CPU | ||
18 | + EndGlobalSection | ||
19 | + GlobalSection(SolutionProperties) = preSolution | ||
20 | + HideSolutionNode = FALSE | ||
21 | + EndGlobalSection | ||
22 | + GlobalSection(ExtensibilityGlobals) = postSolution | ||
23 | + SolutionGuid = {EEBEFAA7-7268-4494-ADAF-291BB2AF8588} | ||
24 | + EndGlobalSection | ||
25 | +EndGlobal |
... | @@ -3,7 +3,7 @@ using System.Collections.Generic; | ... | @@ -3,7 +3,7 @@ using System.Collections.Generic; |
3 | using System.Linq; | 3 | using System.Linq; |
4 | using System.Text; | 4 | using System.Text; |
5 | using System.Threading.Tasks; | 5 | using System.Threading.Tasks; |
6 | - | 6 | +using MySql.Data.MySqlClient; |
7 | 7 | ||
8 | // 참고(C# mysql 연결) | 8 | // 참고(C# mysql 연결) |
9 | #region MySql 연결 | 9 | #region MySql 연결 |
... | @@ -40,6 +40,8 @@ namespace AWS_Center | ... | @@ -40,6 +40,8 @@ namespace AWS_Center |
40 | { | 40 | { |
41 | public static class VulnRDS | 41 | public static class VulnRDS |
42 | { | 42 | { |
43 | + public static MySqlConnection Conn { get; set; } | ||
44 | + | ||
43 | public class Vuln | 45 | public class Vuln |
44 | { | 46 | { |
45 | public int Len { get; set; } /* 발견된 취약점 함수 PreFunc 부분의 코드 길이 */ | 47 | public int Len { get; set; } /* 발견된 취약점 함수 PreFunc 부분의 코드 길이 */ |
... | @@ -55,10 +57,30 @@ namespace AWS_Center | ... | @@ -55,10 +57,30 @@ namespace AWS_Center |
55 | public Vuln() | 57 | public Vuln() |
56 | { | 58 | { |
57 | 59 | ||
60 | + | ||
58 | } | 61 | } |
59 | 62 | ||
60 | 63 | ||
61 | } | 64 | } |
65 | + | ||
66 | + //connect | ||
67 | + public static void Connect() | ||
68 | + { | ||
69 | + MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder() | ||
70 | + { | ||
71 | + Server = "vulndb.cby38wfppa7l.us-east-2.rds.amazonaws.com", | ||
72 | + UserID = "yhackerbv", | ||
73 | + Password = "guswhd12", | ||
74 | + Database = "vuln", | ||
75 | + Port = 3306, | ||
76 | + }; | ||
77 | + string strConn = builder.ToString(); | ||
78 | + builder = null; | ||
79 | + Conn = new MySqlConnection(strConn); | ||
80 | + | ||
81 | + | ||
82 | + | ||
83 | + } | ||
62 | public static void InsertVulnData(int _len, string _repoName, string _cve, string _funcName, | 84 | public static void InsertVulnData(int _len, string _repoName, string _cve, string _funcName, |
63 | string _preFunc, string _afterFunc, string _hash) | 85 | string _preFunc, string _afterFunc, string _hash) |
64 | { | 86 | { |
... | @@ -66,11 +88,16 @@ namespace AWS_Center | ... | @@ -66,11 +88,16 @@ namespace AWS_Center |
66 | * DB에 취약점 데이터가 이미 있는지 검사해야함 | 88 | * DB에 취약점 데이터가 이미 있는지 검사해야함 |
67 | * | 89 | * |
68 | */ | 90 | */ |
69 | - } | ||
70 | 91 | ||
71 | - public static IEnumerable<string> SearchVulnData(int _len) | 92 | + Conn.Open(); |
72 | - { | 93 | + |
94 | + | ||
73 | 95 | ||
74 | } | 96 | } |
97 | + | ||
98 | + //public static IEnumerable<string> SearchVulnData(int _len) | ||
99 | + //{ | ||
100 | + // | ||
101 | + //} | ||
75 | } | 102 | } |
76 | } | 103 | } | ... | ... |
Tester/App.config
0 → 100644
Tester/Program.cs
0 → 100644
1 | +using System; | ||
2 | +using System.Collections.Generic; | ||
3 | +using System.Linq; | ||
4 | +using System.Text; | ||
5 | +using System.Threading.Tasks; | ||
6 | +using MySql.Data.MySqlClient; | ||
7 | + | ||
8 | +namespace Tester | ||
9 | +{ | ||
10 | + class Program | ||
11 | + { | ||
12 | + static void Main(string[] args) | ||
13 | + { | ||
14 | + | ||
15 | + | ||
16 | + } | ||
17 | + } | ||
18 | +} | ||
19 | + | ||
20 | + | ||
21 | +namespace AWS_Center | ||
22 | +{ | ||
23 | + public static class VulnRDS | ||
24 | + { | ||
25 | + public static MySqlConnection Conn { get; set; } | ||
26 | + | ||
27 | + public class Vuln | ||
28 | + { | ||
29 | + public int VulnId { get; set; } /* 취약점 ID */ | ||
30 | + public int LenBlock { get; set; } /* 취약점 BLOCK 길이 */ | ||
31 | + public string RepositName { get; set; } /* 취약점 레파지토리 이름 */ | ||
32 | + public string Cve { get; set; } /* 취약점 CVE */ | ||
33 | + public string FuncName { get; set; } /* 취약점 함수 이름 */ | ||
34 | + public string Language { get; set; } /* 취약점 언어 종류 */ | ||
35 | + public string CodeOriBefore { get; set; } /* 취약점 패치 전 원본 코드 */ | ||
36 | + public string CodeOriAfter { get; set; } /* 취약점 패치 후 원본 코드 */ | ||
37 | + public string CodeAbsBefore { get; set; } /* 취약점 패치 전 추상화 코드 */ | ||
38 | + public string CodeAbsAfter { get; set; } /* 취약점 패치 후 추상화 코드 */ | ||
39 | + public string BlockHash { get; set; } /* 취약점 블록 해시 값 */ | ||
40 | + // 생성자 | ||
41 | + public Vuln() | ||
42 | + { | ||
43 | + | ||
44 | + | ||
45 | + } | ||
46 | + } | ||
47 | + | ||
48 | + public class User | ||
49 | + { | ||
50 | + public int UserId { get; set; } /* 유저 ID */ | ||
51 | + public string RepositName { get; set; } /* 유저 레파지토리 이름 */ | ||
52 | + public string Cve { get; set; } /* 취약점 CVE */ | ||
53 | + public string CodeOriBefore { get; set; } /* 취약점 패치 전 원본 코드 */ | ||
54 | + public string CodeOriAfter { get; set; } /* 취약점 패치 후 원본 코드 */ | ||
55 | + public string FuncName { get; set; } /* 취약점 함수 이름 */ | ||
56 | + public string DetectDate { get; set; } /* 검사 날짜 */ | ||
57 | + // 생성자 | ||
58 | + public User() | ||
59 | + { | ||
60 | + | ||
61 | + | ||
62 | + } | ||
63 | + | ||
64 | + } | ||
65 | + //connect | ||
66 | + public static void Connect() | ||
67 | + { | ||
68 | + MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder() | ||
69 | + { | ||
70 | + Server = "vulndb.cby38wfppa7l.us-east-2.rds.amazonaws.com", | ||
71 | + UserID = "yhackerbv", | ||
72 | + Password = "guswhd12", | ||
73 | + Database = "vuln", | ||
74 | + Port = 3306, | ||
75 | + }; | ||
76 | + string strConn = builder.ToString(); | ||
77 | + builder = null; | ||
78 | + Conn = new MySqlConnection(strConn); | ||
79 | + } | ||
80 | + public static void InsertVulnData(Vuln vuln) | ||
81 | + { | ||
82 | + /* | ||
83 | + * DB에 취약점 데이터가 이미 있는지 검사해야함 | ||
84 | + * | ||
85 | + */ | ||
86 | + | ||
87 | + Conn.Open(); | ||
88 | + | ||
89 | + } | ||
90 | + | ||
91 | + //public static IEnumerable<string> SearchVulnData(int _len) | ||
92 | + //{ | ||
93 | + // | ||
94 | + //} | ||
95 | + } | ||
96 | +} |
Tester/Properties/AssemblyInfo.cs
0 → 100644
1 | +using System.Reflection; | ||
2 | +using System.Runtime.CompilerServices; | ||
3 | +using System.Runtime.InteropServices; | ||
4 | + | ||
5 | +// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해 | ||
6 | +// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면 | ||
7 | +// 이러한 특성 값을 변경하세요. | ||
8 | +[assembly: AssemblyTitle("Tester")] | ||
9 | +[assembly: AssemblyDescription("")] | ||
10 | +[assembly: AssemblyConfiguration("")] | ||
11 | +[assembly: AssemblyCompany("")] | ||
12 | +[assembly: AssemblyProduct("Tester")] | ||
13 | +[assembly: AssemblyCopyright("Copyright © 2018")] | ||
14 | +[assembly: AssemblyTrademark("")] | ||
15 | +[assembly: AssemblyCulture("")] | ||
16 | + | ||
17 | +// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에 | ||
18 | +// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면 | ||
19 | +// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요. | ||
20 | +[assembly: ComVisible(false)] | ||
21 | + | ||
22 | +// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다. | ||
23 | +[assembly: Guid("ac204ded-c47f-46fe-b357-01c71849ea76")] | ||
24 | + | ||
25 | +// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다. | ||
26 | +// | ||
27 | +// 주 버전 | ||
28 | +// 부 버전 | ||
29 | +// 빌드 번호 | ||
30 | +// 수정 버전 | ||
31 | +// | ||
32 | +// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호가 자동으로 | ||
33 | +// 지정되도록 할 수 있습니다. | ||
34 | +// [assembly: AssemblyVersion("1.0.*")] | ||
35 | +[assembly: AssemblyVersion("1.0.0.0")] | ||
36 | +[assembly: AssemblyFileVersion("1.0.0.0")] |
Tester/Tester.csproj
0 → 100644
1 | +<?xml version="1.0" encoding="utf-8"?> | ||
2 | +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
3 | + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
4 | + <PropertyGroup> | ||
5 | + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
6 | + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
7 | + <ProjectGuid>{AC204DED-C47F-46FE-B357-01C71849EA76}</ProjectGuid> | ||
8 | + <OutputType>Exe</OutputType> | ||
9 | + <RootNamespace>Tester</RootNamespace> | ||
10 | + <AssemblyName>Tester</AssemblyName> | ||
11 | + <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> | ||
12 | + <FileAlignment>512</FileAlignment> | ||
13 | + <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> | ||
14 | + </PropertyGroup> | ||
15 | + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
16 | + <PlatformTarget>AnyCPU</PlatformTarget> | ||
17 | + <DebugSymbols>true</DebugSymbols> | ||
18 | + <DebugType>full</DebugType> | ||
19 | + <Optimize>false</Optimize> | ||
20 | + <OutputPath>bin\Debug\</OutputPath> | ||
21 | + <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
22 | + <ErrorReport>prompt</ErrorReport> | ||
23 | + <WarningLevel>4</WarningLevel> | ||
24 | + </PropertyGroup> | ||
25 | + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
26 | + <PlatformTarget>AnyCPU</PlatformTarget> | ||
27 | + <DebugType>pdbonly</DebugType> | ||
28 | + <Optimize>true</Optimize> | ||
29 | + <OutputPath>bin\Release\</OutputPath> | ||
30 | + <DefineConstants>TRACE</DefineConstants> | ||
31 | + <ErrorReport>prompt</ErrorReport> | ||
32 | + <WarningLevel>4</WarningLevel> | ||
33 | + </PropertyGroup> | ||
34 | + <ItemGroup> | ||
35 | + <Reference Include="MySql.Data, Version=8.0.11.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL" /> | ||
36 | + <Reference Include="System" /> | ||
37 | + <Reference Include="System.Core" /> | ||
38 | + <Reference Include="System.Xml.Linq" /> | ||
39 | + <Reference Include="System.Data.DataSetExtensions" /> | ||
40 | + <Reference Include="Microsoft.CSharp" /> | ||
41 | + <Reference Include="System.Data" /> | ||
42 | + <Reference Include="System.Net.Http" /> | ||
43 | + <Reference Include="System.Xml" /> | ||
44 | + </ItemGroup> | ||
45 | + <ItemGroup> | ||
46 | + <Compile Include="Program.cs" /> | ||
47 | + <Compile Include="Properties\AssemblyInfo.cs" /> | ||
48 | + </ItemGroup> | ||
49 | + <ItemGroup> | ||
50 | + <None Include="App.config" /> | ||
51 | + </ItemGroup> | ||
52 | + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
53 | +</Project> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
VulnNotti/material-dashboard-html-v2.0.0/material-dashboard-html-v2.0.0/.DS_Store
deleted
100644 → 0
No preview for this file type
VulnNotti/material-dashboard-html-v2.0.0/material-dashboard-html-v2.0.0/BS4/.DS_Store
deleted
100644 → 0
No preview for this file type
VulnNotti/material-dashboard-html-v2.0.0/material-dashboard-html-v2.0.0/BS4/assets/.DS_Store
deleted
100644 → 0
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
VulnNotti/material-dashboard-html-v2.0.0/material-dashboard-html-v2.0.0/BS4/docs/.DS_Store
deleted
100644 → 0
No preview for this file type
No preview for this file type
... | @@ -67,15 +67,16 @@ namespace VulnCrawler | ... | @@ -67,15 +67,16 @@ namespace VulnCrawler |
67 | public static void Run() { | 67 | public static void Run() { |
68 | // Repository 폴더들이 있는 주소를 지정하면 하위 폴더 목록을 가져옴(Repository 목록) | 68 | // Repository 폴더들이 있는 주소를 지정하면 하위 폴더 목록을 가져옴(Repository 목록) |
69 | 69 | ||
70 | + | ||
70 | // var fields = VulnWorker.GetCriticalVariant(@"return _is_safe_url(url, host) and _is_safe_url(url.replace('\\', '/'), host)"); | 71 | // var fields = VulnWorker.GetCriticalVariant(@"return _is_safe_url(url, host) and _is_safe_url(url.replace('\\', '/'), host)"); |
71 | var c = new VulnC(); | 72 | var c = new VulnC(); |
72 | - var fields = c.ExtractCriticalVariant(@"!DoReadFile (infile, &ds64_chunk, sizeof (DS64Chunk), &bcount) ||/* aaaa */"); | 73 | + var fields = c.ExtractCriticalVariant(@"if (s->session->peer != s->session->sess_cert->peer_key->x509)"); |
73 | foreach (var item in fields) | 74 | foreach (var item in fields) |
74 | { | 75 | { |
75 | Console.WriteLine(item); | 76 | Console.WriteLine(item); |
76 | } | 77 | } |
77 | // return; | 78 | // return; |
78 | - var directorys = Directory.GetDirectories(@"c:\VulnPy"); | 79 | + var directorys = Directory.GetDirectories(@"c:\VulnC"); |
79 | if (directorys.Length == 0) { | 80 | if (directorys.Length == 0) { |
80 | Console.WriteLine("Repository 목록 찾기 실패"); | 81 | Console.WriteLine("Repository 목록 찾기 실패"); |
81 | return; | 82 | return; |
... | @@ -83,7 +84,7 @@ namespace VulnCrawler | ... | @@ -83,7 +84,7 @@ namespace VulnCrawler |
83 | // Repository 목록 만큼 반복함. | 84 | // Repository 목록 만큼 반복함. |
84 | foreach (var directory in directorys) { | 85 | foreach (var directory in directorys) { |
85 | // 템플릿 패턴화 T : VulnAbstractCrawler | 86 | // 템플릿 패턴화 T : VulnAbstractCrawler |
86 | - VulnWorker.Run<VulnPython>(directory); | 87 | + VulnWorker.Run<VulnC>(directory); |
87 | } | 88 | } |
88 | } | 89 | } |
89 | 90 | ... | ... |
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
... | @@ -8,9 +8,6 @@ using System.Text.RegularExpressions; | ... | @@ -8,9 +8,6 @@ using System.Text.RegularExpressions; |
8 | using System.Threading.Tasks; | 8 | using System.Threading.Tasks; |
9 | namespace VulnCrawler | 9 | namespace VulnCrawler |
10 | { | 10 | { |
11 | - | ||
12 | - | ||
13 | - | ||
14 | /// <summary> | 11 | /// <summary> |
15 | /// 파이썬 크롤러 | 12 | /// 파이썬 크롤러 |
16 | /// </summary> | 13 | /// </summary> |
... | @@ -68,5 +65,15 @@ namespace VulnCrawler | ... | @@ -68,5 +65,15 @@ namespace VulnCrawler |
68 | } | 65 | } |
69 | return replace; | 66 | return replace; |
70 | } | 67 | } |
68 | + | ||
69 | + public override IDictionary<string, IEnumerable<string>> ExtractGitCriticalMethodTable(string srcCode) | ||
70 | + { | ||
71 | + throw new NotImplementedException(); | ||
72 | + } | ||
73 | + | ||
74 | + protected override IList<Block> GetCriticalBlocks(string srcCode, IEnumerable<string> criticalList) | ||
75 | + { | ||
76 | + throw new NotImplementedException(); | ||
77 | + } | ||
71 | } | 78 | } |
72 | } | 79 | } | ... | ... |
... | @@ -17,6 +17,7 @@ namespace VulnCrawler | ... | @@ -17,6 +17,7 @@ namespace VulnCrawler |
17 | var crawler = new T(); | 17 | var crawler = new T(); |
18 | crawler.Init(dirPath); | 18 | crawler.Init(dirPath); |
19 | var commits = crawler.Commits; | 19 | var commits = crawler.Commits; |
20 | + Console.WriteLine(commits.Count()); | ||
20 | foreach (var commit in commits) { | 21 | foreach (var commit in commits) { |
21 | // 커밋 메시지 | 22 | // 커밋 메시지 |
22 | string message = commit.Message; | 23 | string message = commit.Message; |
... | @@ -33,6 +34,8 @@ namespace VulnCrawler | ... | @@ -33,6 +34,8 @@ namespace VulnCrawler |
33 | // 현재 커밋에 대한 패치 엔트리 배열을 출력함 | 34 | // 현재 커밋에 대한 패치 엔트리 배열을 출력함 |
34 | PrintPatchEntrys(entrys, crawler, message, cve); | 35 | PrintPatchEntrys(entrys, crawler, message, cve); |
35 | } | 36 | } |
37 | + Console.ReadLine(); | ||
38 | + | ||
36 | } | 39 | } |
37 | } | 40 | } |
38 | 41 | ||
... | @@ -42,6 +45,9 @@ namespace VulnCrawler | ... | @@ -42,6 +45,9 @@ namespace VulnCrawler |
42 | foreach (var entry in entrys) { | 45 | foreach (var entry in entrys) { |
43 | // 기존 소스코드 | 46 | // 기존 소스코드 |
44 | var oldOid = entry.OldOid; | 47 | var oldOid = entry.OldOid; |
48 | + | ||
49 | + try | ||
50 | + { | ||
45 | Blob oldBlob = self.Repository.Lookup<Blob>(oldOid); | 51 | Blob oldBlob = self.Repository.Lookup<Blob>(oldOid); |
46 | string oldContent = oldBlob.GetContentText(); | 52 | string oldContent = oldBlob.GetContentText(); |
47 | 53 | ||
... | @@ -49,46 +55,22 @@ namespace VulnCrawler | ... | @@ -49,46 +55,22 @@ namespace VulnCrawler |
49 | var newOid = entry.Oid; | 55 | var newOid = entry.Oid; |
50 | Blob newBlob = self.Repository.Lookup<Blob>(newOid); | 56 | Blob newBlob = self.Repository.Lookup<Blob>(newOid); |
51 | string newContent = newBlob.GetContentText(); | 57 | string newContent = newBlob.GetContentText(); |
52 | - | ||
53 | var regs = self.GetMatches(entry.Patch); | 58 | var regs = self.GetMatches(entry.Patch); |
54 | - | ||
55 | #region 패치 전 후 코드 출력 | 59 | #region 패치 전 후 코드 출력 |
56 | // 패치 전 코드 (oldContent) | 60 | // 패치 전 코드 (oldContent) |
57 | // 패치 후 코드 (newContent) | 61 | // 패치 후 코드 (newContent) |
58 | // 패치 코드 (entry.Patch) | 62 | // 패치 코드 (entry.Patch) |
59 | // 출력 | 63 | // 출력 |
60 | - //if (regs.Count > 0) { | 64 | + if (regs.Count > 0) |
61 | - // Console.BackgroundColor = ConsoleColor.DarkBlue; | 65 | + { |
62 | - // Console.WriteLine($"Old Content: \n{oldContent}"); | 66 | + Console.BackgroundColor = ConsoleColor.DarkBlue; |
63 | - // Console.ResetColor(); | 67 | + Console.WriteLine($"Old Content: \n{oldContent}"); |
64 | - | 68 | + Console.ResetColor(); |
65 | - // Console.BackgroundColor = ConsoleColor.DarkMagenta; | ||
66 | - // Console.WriteLine($"New Content: \n{newContent}"); | ||
67 | - // Console.ResetColor(); | ||
68 | - // Console.BackgroundColor = ConsoleColor.DarkRed; | ||
69 | - // Console.WriteLine($"Patched: \n{entry.Patch}"); | ||
70 | - | ||
71 | - // Console.ResetColor(); | ||
72 | - // Console.WriteLine("-----------"); | ||
73 | - // Console.WriteLine(regs.Count); | ||
74 | - | ||
75 | - //} | ||
76 | - | ||
77 | - // 패치 코드에서 매칭된 파이썬 함수들로부터 | ||
78 | - // 패치 전 코드 파일(oldBlob)을 탐색하여 원본 파이썬 함수 가져오고(originalFunc) | ||
79 | - // | ||
80 | -#endregion | ||
81 | - | ||
82 | - foreach (var reg in regs) { | ||
83 | - var match = reg as Match; | ||
84 | - string methodName = match.Groups[VulnAbstractCrawler.MethodName].Value; | ||
85 | - | ||
86 | - string originalFunc, md5; | ||
87 | 69 | ||
88 | - (originalFunc, md5) = self.Process(oldBlob.GetContentStream(), | 70 | + //Console.BackgroundColor = ConsoleColor.DarkMagenta; |
89 | - match.Groups[VulnAbstractCrawler.MethodName].Value); | 71 | + //Console.WriteLine($"New Content: \n{newContent}"); |
72 | + //Console.ResetColor(); | ||
90 | 73 | ||
91 | - #region 현재 패치 엔트리 정보 출력(추가된 줄 수, 삭제된 줄 수, 패치 이전 경로, 패치 후 경로) | ||
92 | Console.ForegroundColor = ConsoleColor.Blue; | 74 | Console.ForegroundColor = ConsoleColor.Blue; |
93 | Console.WriteLine($"status: {entry.Status.ToString()}"); | 75 | Console.WriteLine($"status: {entry.Status.ToString()}"); |
94 | Console.WriteLine($"added: {entry.LinesAdded.ToString()}, deleted: {entry.LinesDeleted.ToString()}"); | 76 | Console.WriteLine($"added: {entry.LinesAdded.ToString()}, deleted: {entry.LinesDeleted.ToString()}"); |
... | @@ -104,20 +86,103 @@ namespace VulnCrawler | ... | @@ -104,20 +86,103 @@ namespace VulnCrawler |
104 | Console.ForegroundColor = ConsoleColor.Yellow; | 86 | Console.ForegroundColor = ConsoleColor.Yellow; |
105 | Console.WriteLine($"Commit Message: {commitMsg}"); | 87 | Console.WriteLine($"Commit Message: {commitMsg}"); |
106 | Console.ResetColor(); | 88 | Console.ResetColor(); |
107 | - | ||
108 | - // 패치 전 원본 함수 | ||
109 | - Console.WriteLine($"Original Func: {originalFunc}"); | ||
110 | - // 해쉬 후 | ||
111 | - Console.WriteLine($"Original Func MD5: {md5}"); | ||
112 | Console.BackgroundColor = ConsoleColor.DarkRed; | 89 | Console.BackgroundColor = ConsoleColor.DarkRed; |
113 | Console.WriteLine($"Patched: \n{entry.Patch}"); | 90 | Console.WriteLine($"Patched: \n{entry.Patch}"); |
91 | + Console.ResetColor(); | ||
92 | + var table = self.ExtractGitCriticalMethodTable(entry.Patch); | ||
93 | + foreach (var tuple in self.Process(oldBlob, table)) | ||
94 | + { | ||
95 | + (var methodName, var blocks) = tuple; | ||
96 | + Console.BackgroundColor = ConsoleColor.DarkRed; | ||
97 | + Console.WriteLine($"메서드 이름 : {methodName}"); | ||
98 | + Console.ResetColor(); | ||
99 | + //Console.ForegroundColor = ConsoleColor.Blue; | ||
100 | + //foreach (var c in ) | ||
101 | + //{ | ||
102 | + // Console.WriteLine(c); | ||
103 | + //} | ||
104 | + //Console.ResetColor(); | ||
105 | + foreach (var block in blocks) | ||
106 | + { | ||
114 | 107 | ||
108 | + if (block.HasCritical) | ||
109 | + { | ||
110 | + Console.BackgroundColor = ConsoleColor.DarkMagenta; | ||
111 | + } | ||
112 | + else | ||
113 | + { | ||
114 | + Console.BackgroundColor = ConsoleColor.DarkGreen; | ||
115 | + } | ||
116 | + Console.WriteLine($"=====block({block.Num}, {block.HasCritical.ToString()})"); | ||
117 | + Console.WriteLine(block.Code); | ||
115 | Console.ResetColor(); | 118 | Console.ResetColor(); |
116 | - Console.WriteLine("=============================="); | 119 | + Console.WriteLine($"MD5 = {block.Hash}"); |
120 | + } | ||
121 | + | ||
122 | + } | ||
123 | + | ||
124 | + | ||
125 | + //foreach (var item in table) | ||
126 | + //{ | ||
127 | + // Console.WriteLine($"Method : {item.Key}"); | ||
128 | + // //foreach (var b in item.Value) | ||
129 | + // //{ | ||
130 | + // // Console.WriteLine($"--{b}"); | ||
131 | + // //} | ||
132 | + | ||
133 | + //} | ||
134 | + // Console.ReadLine(); | ||
135 | + } | ||
136 | + else | ||
137 | + { | ||
138 | + continue; | ||
139 | + } | ||
140 | + | ||
117 | 141 | ||
142 | + | ||
143 | + // 패치 코드에서 매칭된 파이썬 함수들로부터 | ||
144 | + // 패치 전 코드 파일(oldBlob)을 탐색하여 원본 파이썬 함수 가져오고(originalFunc) | ||
145 | + // | ||
118 | #endregion | 146 | #endregion |
119 | 147 | ||
148 | + //foreach (var reg in regs) | ||
149 | + //{ | ||
150 | + | ||
151 | + // var match = reg as Match; | ||
152 | + // string methodName = match.Groups[VulnAbstractCrawler.MethodName].Value.Trim(); | ||
153 | + // string originalFunc, md5; | ||
154 | + // (originalFunc, md5) = self.Process(oldBlob.GetContentStream(), | ||
155 | + // methodName); | ||
156 | + | ||
157 | + | ||
158 | + | ||
159 | + // #region 현재 패치 엔트리 정보 출력(추가된 줄 수, 삭제된 줄 수, 패치 이전 경로, 패치 후 경로) | ||
160 | + | ||
161 | + | ||
162 | + // // 패치 전 원본 함수 | ||
163 | + // Console.WriteLine($"Original Func: {originalFunc}"); | ||
164 | + // // 해쉬 후 | ||
165 | + // Console.WriteLine($"Original Func MD5: {md5}"); | ||
166 | + // //Console.BackgroundColor = ConsoleColor.DarkRed; | ||
167 | + // //Console.WriteLine($"Patched: \n{entry.Patch}"); | ||
168 | + | ||
169 | + // Console.ResetColor(); | ||
170 | + // Console.ForegroundColor = ConsoleColor.Red; | ||
171 | + // Console.WriteLine("=============================="); | ||
172 | + // Console.ResetColor(); | ||
173 | + // #endregion | ||
174 | + | ||
175 | + //} | ||
176 | + //Console.ReadLine(); | ||
120 | } | 177 | } |
178 | + catch (Exception e) | ||
179 | + { | ||
180 | + // Console.WriteLine(entry.Patch); | ||
181 | + // Console.WriteLine(e.ToString()); | ||
182 | + // Console.ReadLine(); | ||
183 | + continue; | ||
184 | + } | ||
185 | + | ||
121 | } | 186 | } |
122 | } | 187 | } |
123 | 188 | ... | ... |
_config.yml
0 → 100644
1 | +theme: jekyll-theme-midnight | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment