Bytehide.ToolBox
2.0.0.6
See the version list below for details.
dotnet add package Bytehide.ToolBox --version 2.0.0.6
NuGet\Install-Package Bytehide.ToolBox -Version 2.0.0.6
<PackageReference Include="Bytehide.ToolBox" Version="2.0.0.6" />
paket add Bytehide.ToolBox --version 2.0.0.6
#r "nuget: Bytehide.ToolBox, 2.0.0.6"
// Install Bytehide.ToolBox as a Cake Addin #addin nuget:?package=Bytehide.ToolBox&version=2.0.0.6 // Install Bytehide.ToolBox as a Cake Tool #tool nuget:?package=Bytehide.ToolBox&version=2.0.0.6
_______ _
|__ __| | |
| | ___ ___ | | ___
| |/ _ \ / _ \| | / __|
| | (_) | (_) | |_\__ \
|_|\___/ \___/ \__|___/
ByteHide.ToolBox SDK
The ByteHide.ToolBox SDK provides tools for automatic StackTrace deobfuscation and facilitates the execution of various operations using a single entry point.
Installation
The ByteHide.ToolBox SDK is available as a NuGet package. You can install it using the NuGet Package Manager in Visual Studio or via the command line with the following command:
dotnet add package ByteHide.ToolBox
Usage
Once the package is installed, you can use the ByteHide.ToolBox SDK in your application as follows:
Example
namespace Sample;
internal class Program
{
internal static void Main()
{
try
{
var toolbox = Bytehide.ToolBox.Products.Shield;
toolbox.SubscribeToExceptionEvents();
throw new Exception("This is a test exception");
}
catch (Exception ex)
{
Console.WriteLine("Caught Exception [Message]: " + ex.Message);
Console.WriteLine("Caught Exception [StackTrace]: " + ex.StackTrace);
Console.ReadLine();
}
}
}
In the example above, you only need to call SubscribeToExceptionEvents
once in the application for the ByteHide.ToolBox SDK to automatically deobfuscate the StackTrace of all exceptions thrown in the application.
Additionally, you can use the ByteHide.ToolBox SDK to manually execute the operations you need.
Example
using Bytehide.ToolBox.Shield.Core;
namespace Sample;
internal class Program
{
internal static void Main()
{
try
{
throw new Exception("This is a test exception");
}
catch (Exception ex)
{
ex = ex.Deobfuscate();
Console.WriteLine("Caught Exception [Message]: " + ex.Message);
Console.WriteLine("Caught Exception [StackTrace]: " + ex.StackTrace);
Console.ReadLine();
}
}
}
But remember, in this mode, you have to call Deobfuscate()
method in each catch block.
Remember to place your magic file in the assembly directory (next to the assembly) to use the ByteHide.ToolBox SDK.
Additionally, you can find detailed logs of the protection process in the logs
folder located in your assembly directory.
JavaScript Obfuscation in ASP.NET Projects
The ByteHide.ToolBox SDK provides powerful tools not only for exception deobfuscation but also for JavaScript obfuscation in ASP.NET projects. Obfuscating JavaScript helps to protect client-side code from being easily understood or tampered with, which adds an additional layer of security to your web applications.
Why Obfuscate JavaScript?
JavaScript obfuscation is a technique used to make JavaScript code difficult to read and understand, while still being executable by the browser. This is useful for:
- Protecting Intellectual Property: If your JavaScript code contains proprietary algorithms or logic, obfuscation helps to safeguard your intellectual property by making it harder to reverse engineer.
- Preventing Code Tampering: By obfuscating your JavaScript, you reduce the risk of malicious actors modifying your code for nefarious purposes, such as introducing vulnerabilities or altering functionality.
- Enhancing Security: Obfuscation can deter automated tools from analyzing and exploiting your JavaScript, providing a first line of defense against some types of attacks.
How to Use JavaScript Obfuscation in ASP.NET
The ByteHide.ToolBox SDK offers flexible ways to apply JavaScript obfuscation in both ASP.NET Framework and ASP.NET Core applications. Depending on your needs, you can apply obfuscation globally for all pages or on a per-page basis.
Using JavaScript Obfuscation in ASP.NET Framework
Global Obfuscation Using
Global.asax
: To apply JavaScript obfuscation globally to all pages, you can use theGlobal.asax
file to hook into the application's lifecycle.protected void Application_BeginRequest(object sender, EventArgs e) { // Apply obfuscation logic to all pages var context = HttpContext.Current; // Check if the context is valid and if the response is HTML if (context != null && context.Response.ContentType == "text/html") { var shield = Bytehide.ToolBox.Products.Shield; shield.UseJavaScriptObfuscation(context); } }
Per-Page Obfuscation: You can also apply obfuscation on a per-page basis by adding the logic to individual page load events. This approach allows more granular control over which pages to obfuscate.
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // Create an instance of Actions var shield = Bytehide.ToolBox.Products.Shield; // Use the function to apply JavaScript obfuscation shield.UseJavaScriptObfuscation(HttpContext.Current); } }
Using JavaScript Obfuscation in ASP.NET Core
In ASP.NET Core, you can leverage the middleware pipeline to apply JavaScript obfuscation to all responses. This method is both powerful and flexible, as it integrates directly into the request processing pipeline.
Register the Middleware: In the
Startup.cs
file, you can register the JavaScript obfuscation middleware during application startup.public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); // Apply JavaScript obfuscation globally using middleware var shield = Bytehide.ToolBox.Products.Shield; shield.UseJavaScriptObfuscation(app); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); }); }
Summary
- Global or Per-Page: Depending on your requirements, you can apply JavaScript obfuscation globally using
Global.asax
or middleware, or you can target specific pages. - Easy Integration: The ByteHide.ToolBox SDK simplifies the process of integrating JavaScript obfuscation into your ASP.NET projects, ensuring your client-side code remains secure and protected.
- Flexible and Powerful: Whether you're working with ASP.NET Framework or ASP.NET Core, the SDK provides the tools you need to effectively obfuscate JavaScript, reducing the risk of code tampering and enhancing the overall security of your application.
By following these steps, you can ensure that your JavaScript code is protected across your entire ASP.NET application, helping to safeguard your application's logic and functionality.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 is compatible. net471 is compatible. net472 is compatible. net48 is compatible. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Serilog (>= 3.1.1)
- Serilog.Enrichers.Environment (>= 2.3.0)
- Serilog.Formatting.Compact (>= 2.0.0)
- Serilog.Formatting.Compact.Reader (>= 3.0.0)
- Serilog.Sinks.File (>= 5.0.0)
- System.Configuration.ConfigurationManager (>= 8.0.0)
- System.Text.Json (>= 8.0.2)
-
.NETFramework 4.7
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Serilog (>= 3.1.1)
- Serilog.Enrichers.Environment (>= 2.3.0)
- Serilog.Formatting.Compact (>= 2.0.0)
- Serilog.Formatting.Compact.Reader (>= 3.0.0)
- Serilog.Sinks.File (>= 5.0.0)
- System.Configuration.ConfigurationManager (>= 8.0.0)
- System.Text.Json (>= 8.0.2)
-
.NETFramework 4.7.1
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Serilog (>= 3.1.1)
- Serilog.Enrichers.Environment (>= 2.3.0)
- Serilog.Formatting.Compact (>= 2.0.0)
- Serilog.Formatting.Compact.Reader (>= 3.0.0)
- Serilog.Sinks.File (>= 5.0.0)
- System.Configuration.ConfigurationManager (>= 8.0.0)
- System.Text.Json (>= 8.0.2)
-
.NETFramework 4.7.2
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Serilog (>= 3.1.1)
- Serilog.Enrichers.Environment (>= 2.3.0)
- Serilog.Formatting.Compact (>= 2.0.0)
- Serilog.Formatting.Compact.Reader (>= 3.0.0)
- Serilog.Sinks.File (>= 5.0.0)
- System.Configuration.ConfigurationManager (>= 8.0.0)
- System.Text.Json (>= 8.0.2)
-
.NETFramework 4.8
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Serilog (>= 3.1.1)
- Serilog.Enrichers.Environment (>= 2.3.0)
- Serilog.Formatting.Compact (>= 2.0.0)
- Serilog.Formatting.Compact.Reader (>= 3.0.0)
- Serilog.Sinks.File (>= 5.0.0)
- System.Configuration.ConfigurationManager (>= 8.0.0)
- System.Text.Json (>= 8.0.2)
-
.NETStandard 2.0
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Serilog (>= 3.1.1)
- Serilog.Enrichers.Environment (>= 2.3.0)
- Serilog.Formatting.Compact (>= 2.0.0)
- Serilog.Formatting.Compact.Reader (>= 3.0.0)
- Serilog.Sinks.File (>= 5.0.0)
- System.Configuration.ConfigurationManager (>= 8.0.0)
- System.Text.Json (>= 8.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.