├── .github
└── workflows
│ └── codeql.yml
├── .gitignore
├── LICENSE
├── NetShield Protector.sln
├── NetShield Protector
├── App.config
├── Classes.cs
├── Encryption.cs
├── Helper.cs
├── Main.Designer.cs
├── Main.cs
├── Main.resx
├── NetShield Protector.csproj
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── Resource1.Designer.cs
├── Resource1.resx
├── Resources
│ ├── LicensePacker.cs
│ ├── PackStub.cs
│ ├── Program.cs
│ ├── USBPacker.cs
│ └── dnlib.dll
└── icons81_system_task.ico
└── README.md
/.github/workflows/codeql.yml:
--------------------------------------------------------------------------------
1 | # For most projects, this workflow file will not need changing; you simply need
2 | # to commit it to your repository.
3 | #
4 | # You may wish to alter this file to override the set of languages analyzed,
5 | # or to provide custom queries or build logic.
6 | #
7 | # ******** NOTE ********
8 | # We have attempted to detect the languages in your repository. Please check
9 | # the `language` matrix defined below to confirm you have the correct set of
10 | # supported CodeQL languages.
11 | #
12 | name: "CodeQL"
13 |
14 | on:
15 | push:
16 | branches: [ "main" ]
17 | pull_request:
18 | # The branches below must be a subset of the branches above
19 | branches: [ "main" ]
20 | schedule:
21 | - cron: '29 6 * * 1'
22 |
23 | jobs:
24 | analyze:
25 | name: Analyze
26 | runs-on: ubuntu-latest
27 | permissions:
28 | actions: read
29 | contents: read
30 | security-events: write
31 |
32 | strategy:
33 | fail-fast: false
34 | matrix:
35 | language: [ 'csharp' ]
36 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37 | # Use only 'java' to analyze code written in Java, Kotlin or both
38 | # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
39 | # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
40 |
41 | steps:
42 | - name: Checkout repository
43 | uses: actions/checkout@v3
44 |
45 | # Initializes the CodeQL tools for scanning.
46 | - name: Initialize CodeQL
47 | uses: github/codeql-action/init@v2
48 | with:
49 | languages: ${{ matrix.language }}
50 | # If you wish to specify custom queries, you can do so here or in a config file.
51 | # By default, queries listed here will override any specified in a config file.
52 | # Prefix the list here with "+" to use these queries and those in the config file.
53 |
54 | # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
55 | # queries: security-extended,security-and-quality
56 |
57 |
58 | # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
59 | # If this step fails, then you should remove it and run the build manually (see below)
60 | - name: Autobuild
61 | uses: github/codeql-action/autobuild@v2
62 |
63 | # ℹ️ Command-line programs to run using the OS shell.
64 | # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
65 |
66 | # If the Autobuild fails above, remove it and uncomment the following three lines.
67 | # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
68 |
69 | # - run: |
70 | # echo "Run, Build Application using script"
71 | # ./location_of_script_within_repo/buildscript.sh
72 |
73 | - name: Perform CodeQL Analysis
74 | uses: github/codeql-action/analyze@v2
75 | with:
76 | category: "/language:${{matrix.language}}"
77 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # The following command works for downloading when using Git for Windows:
2 | # curl -LOf http://gist.githubusercontent.com/kmorcinek/2710267/raw/.gitignore
3 | #
4 | # Download this file using PowerShell v3 under Windows with the following comand:
5 | # Invoke-WebRequest https://gist.githubusercontent.com/kmorcinek/2710267/raw/ -OutFile .gitignore
6 | #
7 | # or wget:
8 | # wget --no-check-certificate http://gist.githubusercontent.com/kmorcinek/2710267/raw/.gitignore
9 |
10 | # User-specific files
11 | *.suo
12 | *.user
13 | *.sln.docstates
14 |
15 | # Build results
16 | [Dd]ebug/
17 | [Rr]elease/
18 | x64/
19 | [Bb]in/
20 | [Oo]bj/
21 | # build folder is nowadays used for build scripts and should not be ignored
22 | #build/
23 |
24 | # NuGet Packages
25 | *.nupkg
26 | # The packages folder can be ignored because of Package Restore
27 | **/packages/*
28 | # except build/, which is used as an MSBuild target.
29 | !**/packages/build/
30 | # Uncomment if necessary however generally it will be regenerated when needed
31 | #!**/packages/repositories.config
32 |
33 | # MSTest test Results
34 | [Tt]est[Rr]esult*/
35 | [Bb]uild[Ll]og.*
36 |
37 | *_i.c
38 | *_p.c
39 | *.ilk
40 | *.meta
41 | *.obj
42 | *.pch
43 | *.pdb
44 | *.pgc
45 | *.pgd
46 | *.rsp
47 | *.sbr
48 | *.tlb
49 | *.tli
50 | *.tlh
51 | *.tmp
52 | *.tmp_proj
53 | *.log
54 | *.vspscc
55 | *.vssscc
56 | .builds
57 | *.pidb
58 | *.log
59 | *.scc
60 |
61 | # OS generated files #
62 | .DS_Store*
63 | Icon?
64 |
65 | # Visual C++ cache files
66 | ipch/
67 | *.aps
68 | *.ncb
69 | *.opensdf
70 | *.sdf
71 | *.cachefile
72 |
73 | # Visual Studio profiler
74 | *.psess
75 | *.vsp
76 | *.vspx
77 |
78 | # Guidance Automation Toolkit
79 | *.gpState
80 |
81 | # ReSharper is a .NET coding add-in
82 | _ReSharper*/
83 | *.[Rr]e[Ss]harper
84 |
85 | # TeamCity is a build add-in
86 | _TeamCity*
87 |
88 | # DotCover is a Code Coverage Tool
89 | *.dotCover
90 |
91 | # NCrunch
92 | *.ncrunch*
93 | .*crunch*.local.xml
94 |
95 | # Installshield output folder
96 | [Ee]xpress/
97 |
98 | # DocProject is a documentation generator add-in
99 | DocProject/buildhelp/
100 | DocProject/Help/*.HxT
101 | DocProject/Help/*.HxC
102 | DocProject/Help/*.hhc
103 | DocProject/Help/*.hhk
104 | DocProject/Help/*.hhp
105 | DocProject/Help/Html2
106 | DocProject/Help/html
107 |
108 | # Click-Once directory
109 | publish/
110 |
111 | # Publish Web Output
112 | *.Publish.xml
113 |
114 | # Windows Azure Build Output
115 | csx
116 | *.build.csdef
117 |
118 | # Windows Store app package directory
119 | AppPackages/
120 |
121 | # Others
122 | *.Cache
123 | ClientBin/
124 | [Ss]tyle[Cc]op.*
125 | ~$*
126 | *~
127 | *.dbmdl
128 | *.[Pp]ublish.xml
129 | *.pfx
130 | *.publishsettings
131 | modulesbin/
132 | tempbin/
133 |
134 | # EPiServer Site file (VPP)
135 | AppData/
136 |
137 | # RIA/Silverlight projects
138 | Generated_Code/
139 |
140 | # Backup & report files from converting an old project file to a newer
141 | # Visual Studio version. Backup files are not needed, because we have git ;-)
142 | _UpgradeReport_Files/
143 | Backup*/
144 | UpgradeLog*.XML
145 | UpgradeLog*.htm
146 |
147 | # vim
148 | *.txt~
149 | *.swp
150 | *.swo
151 |
152 | # Temp files when opening LibreOffice on ubuntu
153 | .~lock.*
154 |
155 | # svn
156 | .svn
157 |
158 | # CVS - Source Control
159 | **/CVS/
160 |
161 | # Remainings from resolving conflicts in Source Control
162 | *.orig
163 |
164 | # SQL Server files
165 | **/App_Data/*.mdf
166 | **/App_Data/*.ldf
167 | **/App_Data/*.sdf
168 |
169 |
170 | #LightSwitch generated files
171 | GeneratedArtifacts/
172 | _Pvt_Extensions/
173 | ModelManifest.xml
174 |
175 | # =========================
176 | # Windows detritus
177 | # =========================
178 |
179 | # Windows image file caches
180 | Thumbs.db
181 | ehthumbs.db
182 |
183 | # Folder config file
184 | Desktop.ini
185 |
186 | # Recycle Bin used on file shares
187 | $RECYCLE.BIN/
188 |
189 | # Mac desktop service store files
190 | .DS_Store
191 |
192 | # SASS Compiler cache
193 | .sass-cache
194 |
195 | # Visual Studio 2014 CTP
196 | **/*.sln.ide
197 |
198 | # Visual Studio temp something
199 | .vs/
200 |
201 | # dotnet stuff
202 | project.lock.json
203 |
204 | # VS 2015+
205 | *.vc.vc.opendb
206 | *.vc.db
207 |
208 | # Rider
209 | .idea/
210 |
211 | # Visual Studio Code
212 | .vscode/
213 |
214 | # Output folder used by Webpack or other FE stuff
215 | **/node_modules/*
216 | **/wwwroot/*
217 |
218 | # SpecFlow specific
219 | *.feature.cs
220 | *.feature.xlsx.*
221 | *.Specs_*.html
222 |
223 | #####
224 | # End of core ignore list, below put you custom 'per project' settings (patterns or path)
225 | #####
226 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 AdvDebug
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 |
--------------------------------------------------------------------------------
/NetShield Protector.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.31624.102
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetShield Protector", "NetShield Protector\NetShield Protector.csproj", "{F796DDDD-9133-4A59-B511-6A0950690C4C}"
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 | {F796DDDD-9133-4A59-B511-6A0950690C4C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {F796DDDD-9133-4A59-B511-6A0950690C4C}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {F796DDDD-9133-4A59-B511-6A0950690C4C}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {F796DDDD-9133-4A59-B511-6A0950690C4C}.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 = {EEA0E6CF-94B1-4AB2-8844-25009C6D2847}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/NetShield Protector/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/NetShield Protector/Classes.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Management;
6 | using System.Runtime.InteropServices;
7 | using System.Text;
8 | using System.Threading;
9 | using System.Threading.Tasks;
10 |
11 | namespace NetShield_Protector
12 | {
13 | internal class Classes
14 | {
15 | internal class AntiDebug
16 | {
17 | [DllImport("kernel32.dll", SetLastError = true)]
18 | private static extern bool IsDebuggerPresent();
19 |
20 | [DllImport("kernel32.dll", SetLastError = true)]
21 | private static extern bool CloseHandle(IntPtr Handle);
22 |
23 | [DllImport("kernel32.dll", SetLastError = true)]
24 | private static extern bool CheckRemoteDebuggerPresent(IntPtr Handle, ref bool IsPresent);
25 | public static void AntiDebugCheck()
26 | {
27 | bool IsPresent = false;
28 | CheckRemoteDebuggerPresent(Process.GetCurrentProcess().Handle, ref IsPresent);
29 | if (IsDebuggerPresent() || Debugger.IsAttached || IsPresent)
30 | {
31 | Environment.Exit(0);
32 | }
33 | try
34 | {
35 | CloseHandle((IntPtr)0x1231);
36 | }
37 | catch
38 | {
39 | Environment.Exit(0);
40 | }
41 | }
42 | }
43 |
44 | internal class AntiVM
45 | {
46 | [DllImport("kernel32.dll", SetLastError = true)]
47 | private static extern IntPtr GetModuleHandle(string lib);
48 |
49 | public static bool IsEmulated()
50 | {
51 | long Tick = Environment.TickCount;
52 | Thread.Sleep(500);
53 | long Tick2 = Environment.TickCount;
54 | if (((Tick2 - Tick) < 500L))
55 | {
56 | return true;
57 | }
58 | return false;
59 | }
60 |
61 | public static bool IsModulePresent(string lib)
62 | {
63 | if (GetModuleHandle(lib) != IntPtr.Zero )
64 | return true;
65 | return false;
66 | }
67 |
68 | public static bool CheckForVMwareAndVirtualBox()
69 | {
70 | using (ManagementObjectSearcher ObjectSearcher = new ManagementObjectSearcher("Select * from Win32_ComputerSystem"))
71 | {
72 | using (ManagementObjectCollection ObjectItems = ObjectSearcher.Get())
73 | {
74 | foreach (ManagementBaseObject Item in ObjectItems)
75 | {
76 | string ManufacturerString = Item["Manufacturer"].ToString().ToLower();
77 | string ModelName = Item["Model"].ToString();
78 | if ((ManufacturerString == "microsoft corporation" && ModelName.ToUpperInvariant().Contains("VIRTUAL") || ManufacturerString.Contains("vmware")))
79 | {
80 | return true;
81 | }
82 | }
83 | }
84 | }
85 | return false;
86 | }
87 |
88 | public static void AntiVMCheck()
89 | {
90 | string[] BlacklistModules = { "SbieDll.dll", "cmdvrt32.dll", "SxIn.dll", "cuckoomon.dll" };
91 | for (int i = 0; i < BlacklistModules.Length; i++)
92 | {
93 | if (IsModulePresent(BlacklistModules[i]))
94 | {
95 | Environment.Exit(0);
96 | }
97 | }
98 | if (CheckForVMwareAndVirtualBox() || IsEmulated())
99 | {
100 | Environment.Exit(0);
101 | }
102 | }
103 | }
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/NetShield Protector/Encryption.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Security.Cryptography;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace NetShield_Protector
9 | {
10 | public class Encryption
11 | {
12 | public static string AesTextEncryption(string DataToEncrypt, string KeyToEncryptWith, string IVKey)
13 | {
14 | byte[] data = UTF8Encoding.UTF8.GetBytes(DataToEncrypt);
15 | using (SHA256CryptoServiceProvider SHA256 = new SHA256CryptoServiceProvider())
16 | {
17 | string initVector = IVKey;
18 | byte[] initVectorBytes = Encoding.ASCII.GetBytes(initVector);
19 | byte[] keys = SHA256.ComputeHash(UTF8Encoding.UTF8.GetBytes(KeyToEncryptWith));
20 | using (AesCryptoServiceProvider AES = new AesCryptoServiceProvider() { Key = keys, Mode = CipherMode.CBC, Padding = PaddingMode.PKCS7 })
21 | {
22 | AES.IV = initVectorBytes;
23 | ICryptoTransform transform = AES.CreateEncryptor();
24 | byte[] results = transform.TransformFinalBlock(data, 0, data.Length);
25 | string Result = Convert.ToBase64String(results, 0, results.Length);
26 | return Result;
27 | }
28 | }
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/NetShield Protector/Helper.cs:
--------------------------------------------------------------------------------
1 | using dnlib.DotNet;
2 | using dnlib.DotNet.Emit;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 |
6 | namespace NetShield_Protector
7 | {
8 | public static class InjectHelper
9 | {
10 | private static TypeDefUser Clone(TypeDef origin)
11 | {
12 | var ret = new TypeDefUser(origin.Namespace, origin.Name)
13 | {
14 | Attributes = origin.Attributes
15 | };
16 |
17 | if (origin.ClassLayout != null)
18 | ret.ClassLayout = new ClassLayoutUser(origin.ClassLayout.PackingSize, origin.ClassSize);
19 |
20 | foreach (var genericParam in origin.GenericParameters)
21 | ret.GenericParameters.Add(new GenericParamUser(genericParam.Number, genericParam.Flags, "-"));
22 |
23 | return ret;
24 | }
25 |
26 | private static MethodDefUser Clone(MethodDef origin)
27 | {
28 | var ret = new MethodDefUser(origin.Name, null, origin.ImplAttributes, origin.Attributes);
29 |
30 | foreach (var genericParam in origin.GenericParameters)
31 | ret.GenericParameters.Add(new GenericParamUser(genericParam.Number, genericParam.Flags, "-"));
32 |
33 | return ret;
34 | }
35 |
36 | private static FieldDefUser Clone(FieldDef origin)
37 | {
38 | var ret = new FieldDefUser(origin.Name, null, origin.Attributes);
39 | return ret;
40 | }
41 |
42 | private static TypeDef PopulateContext(TypeDef typeDef, InjectContext ctx)
43 | {
44 | TypeDef ret;
45 | if (!ctx.Mep.TryGetValue(typeDef, out var existing))
46 | {
47 | ret = Clone(typeDef);
48 | ctx.Mep[typeDef] = ret;
49 | }
50 | else
51 | ret = (TypeDef)existing;
52 |
53 | foreach (var nestedType in typeDef.NestedTypes)
54 | ret.NestedTypes.Add(PopulateContext(nestedType, ctx));
55 |
56 | foreach (var method in typeDef.Methods)
57 | ret.Methods.Add((MethodDef)(ctx.Mep[method] = Clone(method)));
58 |
59 | foreach (var field in typeDef.Fields)
60 | ret.Fields.Add((FieldDef)(ctx.Mep[field] = Clone(field)));
61 |
62 | return ret;
63 | }
64 |
65 | private static void CopyTypeDef(TypeDef typeDef, InjectContext ctx)
66 | {
67 | var newTypeDef = (TypeDef)ctx.Mep[typeDef];
68 |
69 | newTypeDef.BaseType = ctx.Importer.Import(typeDef.BaseType);
70 |
71 | foreach (var iface in typeDef.Interfaces)
72 | newTypeDef.Interfaces.Add(new InterfaceImplUser(ctx.Importer.Import(iface.Interface)));
73 | }
74 |
75 | private static void CopyMethodDef(MethodDef methodDef, InjectContext ctx)
76 | {
77 | var newMethodDef = (MethodDef)ctx.Mep[methodDef];
78 |
79 | newMethodDef.Signature = ctx.Importer.Import(methodDef.Signature);
80 | newMethodDef.Parameters.UpdateParameterTypes();
81 |
82 | if (methodDef.ImplMap != null)
83 | newMethodDef.ImplMap = new ImplMapUser(new ModuleRefUser(ctx.TargetModule, methodDef.ImplMap.Module.Name), methodDef.ImplMap.Name, methodDef.ImplMap.Attributes);
84 |
85 | foreach (var ca in methodDef.CustomAttributes)
86 | newMethodDef.CustomAttributes.Add(new CustomAttribute((ICustomAttributeType)ctx.Importer.Import(ca.Constructor)));
87 |
88 | if (!methodDef.HasBody)
89 | return;
90 | newMethodDef.Body = new CilBody(methodDef.Body.InitLocals, new List(),
91 | new List(), new List())
92 | { MaxStack = methodDef.Body.MaxStack };
93 |
94 | var bodyMap = new Dictionary