11using System ;
22using System . IO ;
33using dnlib . DotNet ;
4- using dnlib . DotNet . Writer ;
54using LoGiC . NET . Protections ;
65using SharpConfigParser ;
76using LoGiC . NET . Utils ;
@@ -20,10 +19,12 @@ class Program
2019
2120 public static string FilePath { get ; set ; }
2221
22+ public static MemoryStream Stream = new MemoryStream ( ) ;
23+
2324 static void Main ( string [ ] args )
2425 {
2526 Console . WriteLine ( "Drag & drop your file : " ) ;
26- string path = Console . ReadLine ( ) ;
27+ string path = Console . ReadLine ( ) . Replace ( " \" " , string . Empty ) ;
2728
2829 Console . WriteLine ( "Preparing obfuscation..." ) ;
2930 if ( ! File . Exists ( "config.txt" ) )
@@ -35,6 +36,8 @@ static void Main(string[] args)
3536 ForceWinForms = bool . Parse ( p . Read ( "ForceWinFormsCompatibility" ) . ReadResponse ( ) . ReplaceSpaces ( ) ) ;
3637 DontRename = bool . Parse ( p . Read ( "DontRename" ) . ReadResponse ( ) . ReplaceSpaces ( ) ) ;
3738
39+ Randomizer . Initialize ( ) ;
40+
3841 obfuscation :
3942 Module = ModuleDefMD . Load ( path ) ;
4043 FileExtension = Path . GetExtension ( path ) ;
@@ -48,25 +51,35 @@ static void Main(string[] args)
4851 Console . WriteLine ( "Adding proxy calls..." ) ;
4952 ProxyAdder . Execute ( ) ;
5053
51- Console . WriteLine ( "Encoding ints..." ) ;
52- IntEncoding . Execute ( ) ;
53-
5454 Console . WriteLine ( "Encrypting strings..." ) ;
5555 StringEncryption . Execute ( ) ;
5656
5757 Console . WriteLine ( "Injecting Anti-Tamper..." ) ;
5858 AntiTamper . Execute ( ) ;
5959
60+ Console . WriteLine ( "Executing Anti-De4dot..." ) ;
61+ AntiDe4dot . Execute ( ) ;
62+
63+ Console . WriteLine ( "Executing Control Flow..." ) ;
64+ ControlFlow . Execute ( ) ;
65+
66+ Console . WriteLine ( "Encoding ints..." ) ;
67+ IntEncoding . Execute ( ) ;
68+
6069 Console . WriteLine ( "Watermarking..." ) ;
6170 Watermark . AddAttribute ( ) ;
6271
6372 Console . WriteLine ( "Saving file..." ) ;
64- FilePath = @"C:\Users\" + Environment . UserName + @"\Desktop\" + Path . GetFileNameWithoutExtension ( path ) + "_protected" +
65- FileExtension ;
66- ModuleWriterOptions opts = new ModuleWriterOptions ( Module ) { Logger = DummyLogger . NoThrowInstance } ;
67- Module . Write ( FilePath , opts ) ;
73+ FilePath = @"C:\Users\" + Environment . UserName + @"\Desktop\" + Path . GetFileNameWithoutExtension ( path ) + "_protected" + FileExtension ;
74+ Module . Write ( Stream , new dnlib . DotNet . Writer . ModuleWriterOptions ( Module ) { Logger = DummyLogger . NoThrowInstance } ) ;
75+
76+ StripDOSHeader . Execute ( ) ;
77+
78+ // Save stream to file
79+ File . WriteAllBytes ( FilePath , Stream . ToArray ( ) ) ;
6880
69- if ( AntiTamper . HasBeenTampered ) AntiTamper . InjectMd5 ( FilePath ) ;
81+ if ( AntiTamper . Tampered )
82+ AntiTamper . Inject ( FilePath ) ;
7083
7184 Console . WriteLine ( "Done! Press any key to exit..." ) ;
7285 Console . ReadKey ( ) ;
0 commit comments