이경수
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
......
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 부분의 코드 길이 */
...@@ -54,10 +56,30 @@ namespace AWS_Center ...@@ -54,10 +56,30 @@ namespace AWS_Center
54 // 생성자 56 // 생성자
55 public Vuln() 57 public Vuln()
56 { 58 {
57 - 59 +
60 +
58 } 61 }
59 62
60 - 63 +
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 +
61 } 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)
...@@ -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 }
......
1 +<?xml version="1.0" encoding="utf-8" ?>
2 +<configuration>
3 + <startup>
4 + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
5 + </startup>
6 +</configuration>
...\ No newline at end of file ...\ No newline at end of file
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 +}
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")]
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
...@@ -66,16 +66,17 @@ namespace VulnCrawler ...@@ -66,16 +66,17 @@ namespace VulnCrawler
66 } 66 }
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.
...@@ -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 }
......
This diff is collapsed. Click to expand it.
1 +theme: jekyll-theme-midnight
...\ No newline at end of file ...\ No newline at end of file