├── Route2Netch ├── App.config ├── Properties │ ├── Settings.settings │ ├── AssemblyInfo.cs │ ├── Settings.Designer.cs │ ├── Resources.Designer.cs │ └── Resources.resx ├── Program.cs ├── Route2Netch.csproj ├── Form1.Designer.cs ├── Form1.resx └── Form1.cs ├── README.md ├── LICENSE ├── Route2Netch.sln └── .gitignore /Route2Netch/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Route2Netch/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Route2Netch 2 | A tool help you make your own Netch/SSTap rule from game accelerator. 3 | 一个帮助你将加速器路由表转换成Netch/SSTap模式文件的小工具。 4 | 测试过的:小黑盒加速器模式1,腾讯加速器模式1,UU加速器模式3 5 | 原理/要求见[这里](https://github.com/FQrabbit/SSTap-Rule/blob/master/doc/UU-extract.md) 6 | 不确保完全兼容其他加速器,如果要进行兼容请求请在issue里附带抓取的路由表 7 | -------------------------------------------------------------------------------- /Route2Netch/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace Route2Netch 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// 应用程序的主入口点。 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new Form1()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Route2Netch/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的一般信息由以下 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("Route2Netch")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Route2Netch")] 13 | [assembly: AssemblyCopyright("Copyright © 2020")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 会使此程序集中的类型 18 | //对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型 19 | //请将此类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("4c0997a0-193d-474a-9d8a-18dd86774e04")] 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")] 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 ColdThunder11 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Route2Netch.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29806.167 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Route2Netch", "Route2Netch\Route2Netch.csproj", "{4C0997A0-193D-474A-9D8A-18DD86774E04}" 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 | {4C0997A0-193D-474A-9D8A-18DD86774E04}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {4C0997A0-193D-474A-9D8A-18DD86774E04}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {4C0997A0-193D-474A-9D8A-18DD86774E04}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {4C0997A0-193D-474A-9D8A-18DD86774E04}.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 = {A8C927A0-492C-4C24-B1DF-1EFE78311ECB} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /Route2Netch/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Route2Netch.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Route2Netch/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本: 4.0.30319.42000 5 | // 6 | // 对此文件的更改可能导致不正确的行为,如果 7 | // 重新生成代码,则所做更改将丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Route2Netch.Properties 12 | { 13 | 14 | 15 | /// 16 | /// 强类型资源类,用于查找本地化字符串等。 17 | /// 18 | // 此类是由 StronglyTypedResourceBuilder 19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 20 | // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen 21 | // (以 /str 作为命令选项),或重新生成 VS 项目。 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources 26 | { 27 | 28 | private static global::System.Resources.ResourceManager resourceMan; 29 | 30 | private static global::System.Globalization.CultureInfo resourceCulture; 31 | 32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 33 | internal Resources() 34 | { 35 | } 36 | 37 | /// 38 | /// 返回此类使用的缓存 ResourceManager 实例。 39 | /// 40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 41 | internal static global::System.Resources.ResourceManager ResourceManager 42 | { 43 | get 44 | { 45 | if ((resourceMan == null)) 46 | { 47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Route2Netch.Properties.Resources", typeof(Resources).Assembly); 48 | resourceMan = temp; 49 | } 50 | return resourceMan; 51 | } 52 | } 53 | 54 | /// 55 | /// 覆盖当前线程的 CurrentUICulture 属性 56 | /// 使用此强类型的资源类的资源查找。 57 | /// 58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 59 | internal static global::System.Globalization.CultureInfo Culture 60 | { 61 | get 62 | { 63 | return resourceCulture; 64 | } 65 | set 66 | { 67 | resourceCulture = value; 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Route2Netch/Route2Netch.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {4C0997A0-193D-474A-9D8A-18DD86774E04} 8 | WinExe 9 | Route2Netch 10 | Route2Netch 11 | v4.5 12 | 512 13 | true 14 | 15 | 16 | AnyCPU 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | AnyCPU 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | Form 50 | 51 | 52 | Form1.cs 53 | 54 | 55 | 56 | 57 | Form1.cs 58 | 59 | 60 | ResXFileCodeGenerator 61 | Resources.Designer.cs 62 | Designer 63 | 64 | 65 | True 66 | Resources.resx 67 | 68 | 69 | SettingsSingleFileGenerator 70 | Settings.Designer.cs 71 | 72 | 73 | True 74 | Settings.settings 75 | True 76 | 77 | 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /Route2Netch/Form1.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Route2Netch 2 | { 3 | partial class Form1 4 | { 5 | /// 6 | /// 必需的设计器变量。 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// 清理所有正在使用的资源。 12 | /// 13 | /// 如果应释放托管资源,为 true;否则为 false。 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows 窗体设计器生成的代码 24 | 25 | /// 26 | /// 设计器支持所需的方法 - 不要修改 27 | /// 使用代码编辑器修改此方法的内容。 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.button1 = new System.Windows.Forms.Button(); 32 | this.textBox1 = new System.Windows.Forms.TextBox(); 33 | this.label1 = new System.Windows.Forms.Label(); 34 | this.button2 = new System.Windows.Forms.Button(); 35 | this.label2 = new System.Windows.Forms.Label(); 36 | this.button3 = new System.Windows.Forms.Button(); 37 | this.SuspendLayout(); 38 | // 39 | // button1 40 | // 41 | this.button1.Location = new System.Drawing.Point(203, 140); 42 | this.button1.Name = "button1"; 43 | this.button1.Size = new System.Drawing.Size(170, 37); 44 | this.button1.TabIndex = 0; 45 | this.button1.Text = "抓取为Netch规则"; 46 | this.button1.UseVisualStyleBackColor = true; 47 | this.button1.Click += new System.EventHandler(this.button1_Click); 48 | // 49 | // textBox1 50 | // 51 | this.textBox1.Font = new System.Drawing.Font("宋体", 9F); 52 | this.textBox1.Location = new System.Drawing.Point(37, 46); 53 | this.textBox1.Name = "textBox1"; 54 | this.textBox1.Size = new System.Drawing.Size(286, 28); 55 | this.textBox1.TabIndex = 4; 56 | // 57 | // label1 58 | // 59 | this.label1.AutoSize = true; 60 | this.label1.Location = new System.Drawing.Point(12, 9); 61 | this.label1.Name = "label1"; 62 | this.label1.Size = new System.Drawing.Size(62, 18); 63 | this.label1.TabIndex = 5; 64 | this.label1.Text = "游戏名"; 65 | // 66 | // button2 67 | // 68 | this.button2.Location = new System.Drawing.Point(12, 140); 69 | this.button2.Name = "button2"; 70 | this.button2.Size = new System.Drawing.Size(170, 37); 71 | this.button2.TabIndex = 6; 72 | this.button2.Text = "抓取为SSTap规则"; 73 | this.button2.UseVisualStyleBackColor = true; 74 | this.button2.Click += new System.EventHandler(this.button2_Click); 75 | // 76 | // label2 77 | // 78 | this.label2.AutoSize = true; 79 | this.label2.Location = new System.Drawing.Point(34, 96); 80 | this.label2.Name = "label2"; 81 | this.label2.Size = new System.Drawing.Size(80, 18); 82 | this.label2.TabIndex = 7; 83 | this.label2.Text = "等待任务"; 84 | // 85 | // button3 86 | // 87 | this.button3.Location = new System.Drawing.Point(15, 183); 88 | this.button3.Name = "button3"; 89 | this.button3.Size = new System.Drawing.Size(358, 37); 90 | this.button3.TabIndex = 8; 91 | this.button3.Text = "小孩子才做选择,我全都要"; 92 | this.button3.UseVisualStyleBackColor = true; 93 | this.button3.Click += new System.EventHandler(this.button3_Click); 94 | // 95 | // Form1 96 | // 97 | this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F); 98 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 99 | this.ClientSize = new System.Drawing.Size(385, 231); 100 | this.Controls.Add(this.button3); 101 | this.Controls.Add(this.label2); 102 | this.Controls.Add(this.button2); 103 | this.Controls.Add(this.label1); 104 | this.Controls.Add(this.textBox1); 105 | this.Controls.Add(this.button1); 106 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; 107 | this.Name = "Form1"; 108 | this.Text = "路由表规则抓取"; 109 | this.ResumeLayout(false); 110 | this.PerformLayout(); 111 | 112 | } 113 | 114 | #endregion 115 | 116 | private System.Windows.Forms.Button button1; 117 | private System.Windows.Forms.TextBox textBox1; 118 | private System.Windows.Forms.Label label1; 119 | private System.Windows.Forms.Button button2; 120 | private System.Windows.Forms.Label label2; 121 | private System.Windows.Forms.Button button3; 122 | } 123 | } 124 | 125 | -------------------------------------------------------------------------------- /Route2Netch/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /Route2Netch/Form1.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Aa][Rr][Mm]/ 27 | [Aa][Rr][Mm]64/ 28 | bld/ 29 | [Bb]in/ 30 | [Oo]bj/ 31 | [Ll]og/ 32 | [Ll]ogs/ 33 | 34 | # Visual Studio 2015/2017 cache/options directory 35 | .vs/ 36 | # Uncomment if you have tasks that create the project's static files in wwwroot 37 | #wwwroot/ 38 | 39 | # Visual Studio 2017 auto generated files 40 | Generated\ Files/ 41 | 42 | # MSTest test Results 43 | [Tt]est[Rr]esult*/ 44 | [Bb]uild[Ll]og.* 45 | 46 | # NUnit 47 | *.VisualState.xml 48 | TestResult.xml 49 | nunit-*.xml 50 | 51 | # Build Results of an ATL Project 52 | [Dd]ebugPS/ 53 | [Rr]eleasePS/ 54 | dlldata.c 55 | 56 | # Benchmark Results 57 | BenchmarkDotNet.Artifacts/ 58 | 59 | # .NET Core 60 | project.lock.json 61 | project.fragment.lock.json 62 | artifacts/ 63 | 64 | # StyleCop 65 | StyleCopReport.xml 66 | 67 | # Files built by Visual Studio 68 | *_i.c 69 | *_p.c 70 | *_h.h 71 | *.ilk 72 | *.meta 73 | *.obj 74 | *.iobj 75 | *.pch 76 | *.pdb 77 | *.ipdb 78 | *.pgc 79 | *.pgd 80 | *.rsp 81 | *.sbr 82 | *.tlb 83 | *.tli 84 | *.tlh 85 | *.tmp 86 | *.tmp_proj 87 | *_wpftmp.csproj 88 | *.log 89 | *.vspscc 90 | *.vssscc 91 | .builds 92 | *.pidb 93 | *.svclog 94 | *.scc 95 | 96 | # Chutzpah Test files 97 | _Chutzpah* 98 | 99 | # Visual C++ cache files 100 | ipch/ 101 | *.aps 102 | *.ncb 103 | *.opendb 104 | *.opensdf 105 | *.sdf 106 | *.cachefile 107 | *.VC.db 108 | *.VC.VC.opendb 109 | 110 | # Visual Studio profiler 111 | *.psess 112 | *.vsp 113 | *.vspx 114 | *.sap 115 | 116 | # Visual Studio Trace Files 117 | *.e2e 118 | 119 | # TFS 2012 Local Workspace 120 | $tf/ 121 | 122 | # Guidance Automation Toolkit 123 | *.gpState 124 | 125 | # ReSharper is a .NET coding add-in 126 | _ReSharper*/ 127 | *.[Rr]e[Ss]harper 128 | *.DotSettings.user 129 | 130 | # TeamCity is a build add-in 131 | _TeamCity* 132 | 133 | # DotCover is a Code Coverage Tool 134 | *.dotCover 135 | 136 | # AxoCover is a Code Coverage Tool 137 | .axoCover/* 138 | !.axoCover/settings.json 139 | 140 | # Visual Studio code coverage results 141 | *.coverage 142 | *.coveragexml 143 | 144 | # NCrunch 145 | _NCrunch_* 146 | .*crunch*.local.xml 147 | nCrunchTemp_* 148 | 149 | # MightyMoose 150 | *.mm.* 151 | AutoTest.Net/ 152 | 153 | # Web workbench (sass) 154 | .sass-cache/ 155 | 156 | # Installshield output folder 157 | [Ee]xpress/ 158 | 159 | # DocProject is a documentation generator add-in 160 | DocProject/buildhelp/ 161 | DocProject/Help/*.HxT 162 | DocProject/Help/*.HxC 163 | DocProject/Help/*.hhc 164 | DocProject/Help/*.hhk 165 | DocProject/Help/*.hhp 166 | DocProject/Help/Html2 167 | DocProject/Help/html 168 | 169 | # Click-Once directory 170 | publish/ 171 | 172 | # Publish Web Output 173 | *.[Pp]ublish.xml 174 | *.azurePubxml 175 | # Note: Comment the next line if you want to checkin your web deploy settings, 176 | # but database connection strings (with potential passwords) will be unencrypted 177 | *.pubxml 178 | *.publishproj 179 | 180 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 181 | # checkin your Azure Web App publish settings, but sensitive information contained 182 | # in these scripts will be unencrypted 183 | PublishScripts/ 184 | 185 | # NuGet Packages 186 | *.nupkg 187 | # NuGet Symbol Packages 188 | *.snupkg 189 | # The packages folder can be ignored because of Package Restore 190 | **/[Pp]ackages/* 191 | # except build/, which is used as an MSBuild target. 192 | !**/[Pp]ackages/build/ 193 | # Uncomment if necessary however generally it will be regenerated when needed 194 | #!**/[Pp]ackages/repositories.config 195 | # NuGet v3's project.json files produces more ignorable files 196 | *.nuget.props 197 | *.nuget.targets 198 | 199 | # Microsoft Azure Build Output 200 | csx/ 201 | *.build.csdef 202 | 203 | # Microsoft Azure Emulator 204 | ecf/ 205 | rcf/ 206 | 207 | # Windows Store app package directories and files 208 | AppPackages/ 209 | BundleArtifacts/ 210 | Package.StoreAssociation.xml 211 | _pkginfo.txt 212 | *.appx 213 | *.appxbundle 214 | *.appxupload 215 | 216 | # Visual Studio cache files 217 | # files ending in .cache can be ignored 218 | *.[Cc]ache 219 | # but keep track of directories ending in .cache 220 | !?*.[Cc]ache/ 221 | 222 | # Others 223 | ClientBin/ 224 | ~$* 225 | *~ 226 | *.dbmdl 227 | *.dbproj.schemaview 228 | *.jfm 229 | *.pfx 230 | *.publishsettings 231 | orleans.codegen.cs 232 | 233 | # Including strong name files can present a security risk 234 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 235 | #*.snk 236 | 237 | # Since there are multiple workflows, uncomment next line to ignore bower_components 238 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 239 | #bower_components/ 240 | 241 | # RIA/Silverlight projects 242 | Generated_Code/ 243 | 244 | # Backup & report files from converting an old project file 245 | # to a newer Visual Studio version. Backup files are not needed, 246 | # because we have git ;-) 247 | _UpgradeReport_Files/ 248 | Backup*/ 249 | UpgradeLog*.XML 250 | UpgradeLog*.htm 251 | ServiceFabricBackup/ 252 | *.rptproj.bak 253 | 254 | # SQL Server files 255 | *.mdf 256 | *.ldf 257 | *.ndf 258 | 259 | # Business Intelligence projects 260 | *.rdl.data 261 | *.bim.layout 262 | *.bim_*.settings 263 | *.rptproj.rsuser 264 | *- [Bb]ackup.rdl 265 | *- [Bb]ackup ([0-9]).rdl 266 | *- [Bb]ackup ([0-9][0-9]).rdl 267 | 268 | # Microsoft Fakes 269 | FakesAssemblies/ 270 | 271 | # GhostDoc plugin setting file 272 | *.GhostDoc.xml 273 | 274 | # Node.js Tools for Visual Studio 275 | .ntvs_analysis.dat 276 | node_modules/ 277 | 278 | # Visual Studio 6 build log 279 | *.plg 280 | 281 | # Visual Studio 6 workspace options file 282 | *.opt 283 | 284 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 285 | *.vbw 286 | 287 | # Visual Studio LightSwitch build output 288 | **/*.HTMLClient/GeneratedArtifacts 289 | **/*.DesktopClient/GeneratedArtifacts 290 | **/*.DesktopClient/ModelManifest.xml 291 | **/*.Server/GeneratedArtifacts 292 | **/*.Server/ModelManifest.xml 293 | _Pvt_Extensions 294 | 295 | # Paket dependency manager 296 | .paket/paket.exe 297 | paket-files/ 298 | 299 | # FAKE - F# Make 300 | .fake/ 301 | 302 | # CodeRush personal settings 303 | .cr/personal 304 | 305 | # Python Tools for Visual Studio (PTVS) 306 | __pycache__/ 307 | *.pyc 308 | 309 | # Cake - Uncomment if you are using it 310 | # tools/** 311 | # !tools/packages.config 312 | 313 | # Tabs Studio 314 | *.tss 315 | 316 | # Telerik's JustMock configuration file 317 | *.jmconfig 318 | 319 | # BizTalk build output 320 | *.btp.cs 321 | *.btm.cs 322 | *.odx.cs 323 | *.xsd.cs 324 | 325 | # OpenCover UI analysis results 326 | OpenCover/ 327 | 328 | # Azure Stream Analytics local run output 329 | ASALocalRun/ 330 | 331 | # MSBuild Binary and Structured Log 332 | *.binlog 333 | 334 | # NVidia Nsight GPU debugger configuration file 335 | *.nvuser 336 | 337 | # MFractors (Xamarin productivity tool) working folder 338 | .mfractor/ 339 | 340 | # Local History for Visual Studio 341 | .localhistory/ 342 | 343 | # BeatPulse healthcheck temp database 344 | healthchecksdb 345 | 346 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 347 | MigrationBackup/ 348 | 349 | # Ionide (cross platform F# VS Code tools) working folder 350 | .ionide/ 351 | -------------------------------------------------------------------------------- /Route2Netch/Form1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | using System.Windows.Forms; 10 | using System.IO; 11 | using System.Net; 12 | 13 | namespace Route2Netch 14 | { 15 | public partial class Form1 : Form 16 | { 17 | public Form1() 18 | { 19 | InitializeComponent(); 20 | } 21 | 22 | private void button1_Click(object sender, EventArgs e) 23 | { 24 | if (textBox1.Text == string.Empty) return; 25 | if (!IsFileNameValid(textBox1.Text)) 26 | { 27 | MessageBox.Show("游戏名存在不合法文件名,请修改"); 28 | return; 29 | } 30 | var gameName = textBox1.Text; 31 | label2.Text = "正在抓取路由表,可能需要较长时间"; 32 | CatchRoute(); 33 | label2.Text = "正在创建模式文件"; 34 | var rule= Route2Rule(Path.Combine(Environment.CurrentDirectory, "route.txt")); 35 | if (!Directory.Exists(Path.Combine(Environment.CurrentDirectory, "mode"))) 36 | Directory.CreateDirectory(Path.Combine(Environment.CurrentDirectory, "mode")); 37 | string firstLine = "# " + gameName + " (TUN/TAP)" + ", 1, 0\r\n"; 38 | File.WriteAllText(Path.Combine(Environment.CurrentDirectory, "mode", gameName + " (TUN-TAP).txt"), 39 | firstLine + rule); 40 | File.Delete(Path.Combine(Environment.CurrentDirectory, "route.txt")); 41 | label2.Text = "抓取完成"; 42 | } 43 | private void button2_Click(object sender, EventArgs e) 44 | { 45 | if (textBox1.Text == string.Empty) return; 46 | if (!IsFileNameValid(textBox1.Text)) 47 | { 48 | MessageBox.Show("游戏名存在不合法文件名,请修改"); 49 | return; 50 | } 51 | var gameName = textBox1.Text; 52 | label2.Text = "正在抓取路由表,可能需要较长时间"; 53 | CatchRoute(); 54 | label2.Text = "正在创建模式文件"; 55 | var rule = Route2Rule(Path.Combine(Environment.CurrentDirectory, "route.txt")); 56 | if (!Directory.Exists(Path.Combine(Environment.CurrentDirectory, "rules"))) 57 | Directory.CreateDirectory(Path.Combine(Environment.CurrentDirectory, "rules")); 58 | string firstLine = "#" + gameName + "," + gameName + ",0,0,1,0,1,0,By-Route2Netch" + Environment.NewLine; 59 | File.WriteAllText(Path.Combine(Environment.CurrentDirectory, "rules", gameName + ".rules"), 60 | firstLine + rule); 61 | File.Delete(Path.Combine(Environment.CurrentDirectory, "route.txt")); 62 | label2.Text = "抓取完成"; 63 | } 64 | private void button3_Click(object sender, EventArgs e) 65 | { 66 | if (textBox1.Text == string.Empty) return; 67 | if (!IsFileNameValid(textBox1.Text)) 68 | { 69 | MessageBox.Show("游戏名存在不合法文件名,请修改"); 70 | return; 71 | } 72 | var gameName = textBox1.Text; 73 | label2.Text = "正在抓取路由表,可能需要较长时间"; 74 | CatchRoute(); 75 | label2.Text = "正在创建模式文件"; 76 | var rule = Route2Rule(Path.Combine(Environment.CurrentDirectory, "route.txt")); 77 | if (!Directory.Exists(Path.Combine(Environment.CurrentDirectory, "mode"))) 78 | Directory.CreateDirectory(Path.Combine(Environment.CurrentDirectory, "mode")); 79 | string firstLine = "# " + gameName + " (TUN/TAP)" + ", 1, 0\r\n"; 80 | File.WriteAllText(Path.Combine(Environment.CurrentDirectory, "mode", gameName + " (TUN-TAP).txt"), 81 | firstLine + rule); 82 | rule = Route2Rule(Path.Combine(Environment.CurrentDirectory, "route.txt")); 83 | if (!Directory.Exists(Path.Combine(Environment.CurrentDirectory, "rules"))) 84 | Directory.CreateDirectory(Path.Combine(Environment.CurrentDirectory, "rules")); 85 | firstLine = "#" + gameName + "," + gameName + ",0,0,1,0,1,0,By-Route2Netch" + Environment.NewLine; 86 | File.WriteAllText(Path.Combine(Environment.CurrentDirectory, "rules", gameName + ".rules"), 87 | firstLine + rule); 88 | File.Delete(Path.Combine(Environment.CurrentDirectory, "route.txt")); 89 | label2.Text = "抓取完成"; 90 | } 91 | private bool IsFileNameValid(string name) 92 | { 93 | bool isFilename = true; 94 | string[] errorStr = new string[] { "/", "\\", ":", ",", "*", "?", "\"", "<", ">", "|" }; 95 | 96 | if (string.IsNullOrEmpty(name)) 97 | { 98 | isFilename = false; 99 | } 100 | else 101 | { 102 | for (int i = 0; i < errorStr.Length; i++) 103 | { 104 | if (name.Contains(errorStr[i])) 105 | { 106 | isFilename = false; 107 | break; 108 | } 109 | } 110 | } 111 | return isFilename; 112 | } 113 | void CatchRoute() 114 | { 115 | System.Diagnostics.Process p = new System.Diagnostics.Process(); 116 | p.StartInfo.FileName = "cmd.exe"; 117 | p.StartInfo.UseShellExecute = false; //是否使用操作系统shell启动 118 | p.StartInfo.RedirectStandardInput = true;//接受来自调用程序的输入信息 119 | p.StartInfo.RedirectStandardOutput = true;//由调用程序获取输出信息 120 | p.StartInfo.RedirectStandardError = true;//重定向标准错误输出 121 | p.StartInfo.CreateNoWindow = true;//不显示程序窗口 122 | p.Start();//启动程序 123 | p.StandardInput.WriteLine("route print -4 >> " + Path.Combine(Environment.CurrentDirectory, "route.txt")); 124 | p.StandardInput.AutoFlush = true; 125 | p.StandardInput.WriteLine("exit"); 126 | p.WaitForExit(); 127 | p.Close(); 128 | } 129 | string Route2Rule(string routePath) 130 | { 131 | var routeLines = File.ReadAllLines(routePath); 132 | int partFlag = 0; 133 | bool startFlag = false; 134 | string metric = string.Empty; 135 | var sb = new StringBuilder(); 136 | for(int i=0; i < routeLines.Length; i++) 137 | { 138 | if (routeLines[i].StartsWith("=")) 139 | { 140 | partFlag++; 141 | continue; 142 | } 143 | if (partFlag == 3 && !startFlag) 144 | { 145 | i += 1; 146 | startFlag = true; 147 | continue; 148 | } 149 | if (startFlag && partFlag == 3) 150 | { 151 | List avaArr = new List(); 152 | var splitParts = routeLines[i].Split(' '); 153 | foreach(var str in splitParts) 154 | { 155 | if (str != "") 156 | { 157 | avaArr.Add(str); 158 | } 159 | } 160 | if (avaArr[0].Split('.')[0] == "10") continue; 161 | if (avaArr[0].Split('.')[0] == "172" && 162 | (int.Parse(avaArr[0].Split('.')[1]) >= 16 && int.Parse(avaArr[0].Split('.')[1]) < 32)) 163 | continue; 164 | if (avaArr[0].Split('.')[0] == "192"&& avaArr[0].Split('.')[1] == "168") continue; 165 | if (avaArr[0] == "0.0.0.0") continue; 166 | if (avaArr[0].StartsWith("127.0.0.")) continue; 167 | if (avaArr[0].StartsWith("224.0.0.")) continue; 168 | if (avaArr[0]=="255.255.255.255") continue; 169 | sb.Append(avaArr[0]); 170 | int netmask = 0; 171 | var nm = avaArr[1].Split('.'); 172 | for(int k = 0; k < 4; k++) 173 | { 174 | int t = int.Parse(nm[k]); 175 | if (t != 0) 176 | { 177 | var dexstr = Convert.ToString(t, 2); 178 | netmask += dexstr.Length; 179 | } 180 | } 181 | sb.Append("/" + netmask.ToString());sb.Append(Environment.NewLine); 182 | } 183 | if (partFlag > 3) 184 | { 185 | break; 186 | } 187 | } 188 | return sb.ToString(); 189 | } 190 | 191 | } 192 | } 193 | --------------------------------------------------------------------------------