Code Monkey home page Code Monkey logo

logic.net's Introduction

Introduction

LoGiC.NET is a free and open-source .NET obfuscator using dnlib. It is currently under a rewrite.

Dependencies

dnlib v3.6.0

logic.net's People

Contributors

anerruption avatar mrdevbot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

logic.net's Issues

Error while obfucation

Unhandled Exception: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\Mrgato\Desktop\TokenJuaker_protected.exe'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.File.InternalWriteAllBytes(String path, Byte[] bytes, Boolean checkHost)
at LoGiC.NET.Program.Main(String[] args)

i think because the obfucator tryes to make the file in desktop when thath is not my path i realy prefere to save the obfuscated file creating a directory named confused and then saving it inside

Usage Example

Can you please add an example on how to use this Obfuscator to encrypt a N-tier .net Core MVC application?
Or any example would be good.

[IDEA] Nested methods.

Ofc this won't work because nested methods bad but here's an idea I've always had for c# obfuscation:

void Main(string[] args) {
    Console.WriteLine("Hello, World!");
}
Main(args);

Now you may think "oh that's not that bad", but link multiple nested methods together and combine them with other existing obfuscation techniques and everything is chaos. Another idea (ofc its probably implemented) is to abuse interpolated strings, eg:

string iliilllli = $"{$"{$"{$"Hello, World!"}"}"}";

Now you see how insane this can get? Once again combine this with the current obfuscation to get an insane mess.

LoGiC.NET v2 module loading error

Hi. After compilation trying to run:

[Loading module]
Unhandled exception. System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at Program.<Main>$(String[] args) in C:\Users\admin\Desktop\LoGiC.NET.v2\Program.cs:line 4

UPD.
Solved (forgot path). But i can't find output file.
How to use? Thanks.

Error & SharpConfigParser missing

Hello,

Thank you for this project,

I have the following error with my file:

Preparing obfuscation...
Renaming...
  Renamed 1560 methods.
  Renamed 1508 parameters.
  Renamed 883 properties.
  Renamed 580 fields.
  Renamed 0 events.
Adding junk methods...
  Added 3666 junk methods.
Adding proxy calls...
  Added 2059 proxy calls.
Encoding ints...

Unhandled Exception: System.OverflowException: Arithmetic operation resulted in an overflow.
   at LoGiC.NET.Utils.Randomizer.GenerateRandomString(Int32 size)
   at LoGiC.NET.Protections.IntEncoding.Execute()
   at LoGiC.NET.Program.Main(String[] _)

Moreover, it seems SharpConfigParser is missing.

Thank you in advance for your help,

Member declaration renames, but usage (call) remains the same!

LoGiC.NET obfuscator looks good, but I have found some issues with renaming...

My Changes in LoGiC.NET

I had to made some cosmetic changes in LoGiC.NET for my needs.

  1. I have excluded InvalidMetadata protection, because IIS server does not support such protected libraries with invalid metadata.
    Protection[] protections = new Protection[]
         {
                 new Renamer(),
                 new AntiTamper(),
                 new JunkDefs(),
                 new StringEncryption(),
                 new AntiDe4dot(),
                 new ControlFlow(),
                 new IntEncoding(),
                 new ProxyAdder(),
                 // new InvalidMetadata()
         };
  2. Renamer: I have commented out renaming of namespaces and data types (classes, interfaces, structs, delegates, enums,...)
    //if (CanRename(type))
    //{
    //    // Hide namespace
    //    type.Namespace = string.Empty;
    //    type.Name = Randomizer.String(MemberRenamer.StringLength());
    //}
  3. Renamer: I have commented out renaming of instance fields, because it did not work - it renamed some fields and then called the original name...
    public static bool CanRename(object obj)
    {
        DefAnalyzer analyze;
        if (obj is MethodDef method) analyze = new MethodDefAnalyzer();
        else if (obj is PropertyDef prop) analyze = new PropertyDefAnalyzer();
        else if (obj is EventDef) analyze = new EventDefAnalyzer();
        else if (obj is FieldDef) return false;
        else if (obj is Parameter) analyze = new ParameterAnalyzer();
        else if (obj is TypeDef) return false;
        else return false;
    
        return analyze.Execute(obj);
    }
  4. Configuration: I had to exclude ProxyCallsIntensity due to stack overflowing...
    ProxyCallsIntensity: 0
    

My Project Issue

In my project, I came to an exception of calling an internal method with the original name in the same class's public constructor, but the declaration of the method was renamed after the obfuscation!!! :-(

  • I think it could be caused by not supported version of .NET (.NET 6).
  • ...or there must be some issue with the privacy: The constructor's public modifier, where it is called, is not the privacy modifier of the called method. I think, that program attaches wrong metadata of privacy to this method in some code branch, and it assumes it is public, so it does not rename it when calling it.
public MyService(IDependency dependency) : base(dependency)
{
    InitData();
}
...
// original InitData()
internal void rgrehrehrehzhwefwegweh()
{
}

Unfortunately, I could not reproduce this issue creating a new sample project (TestAppToObfuse), but I have found a similar one...

Sample Project Issue 1

  • I have created a new sample project to reproduce the renaming issue and I have explored another issue.
  • Reproduction of the issue was not successful: similar case of the declaration and the call was renamed correctly, but it calls a property setter helper method called set_PreviousResult(), which does not exist in the original neither obfuscated code.
  • PreviousResult property only exists and I have used the old syntax of getter and setter (if it matters).

Steps to Reproduce

  1. You can download the github project TestAppToObfuse.
  2. Obfuscate the libraries TestAppToObfuse.Services and TestAppToObfuse.Services.Impl
  3. Copy the result libraries' DLLs into the Libs folder...
  4. ...and run TestAppToObfuse.exe, you will get the exception:
    Method not found: 'Void TestAppToObfuse.Services.SomeServiceBase.set_PreviousResult(System.String)`
    

Sample Project Small Issue 2

As you can see after disassembling, protected non-internal method DoItInner(string what) of SomeService is renamed - it should be not in my opinion, because it is visible outside the assembly as it is protected method in a public class. I know, that it is not a public well known interface, but some class could count with the original name as it would like to inherit it.

Many thanks for any help to solve these issues! (Specially My Project Issue or Sample Project Issue 1).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.