Last active
August 29, 2015 14:04
-
-
Save hsinjungwu/d2cc60cf703664705afd to your computer and use it in GitHub Desktop.
example of obfuscate application
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version='1.0'?> | |
<Obfuscator> | |
<Var name="InPath" value=".\Obfuscator_Input" /> | |
<Var name="OutPath" value=".\Obfuscator_Output" /> | |
<Var name="HidePrivateApi" value="true" /> | |
<Module file="$(InPath)\ftpTest.exe" /> | |
<!--Module file="$(InPath)\ftpTest.dll" /--> | |
</Obfuscator> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.ComponentModel; | |
using System.Drawing; | |
using System.Net; | |
using System.Runtime.CompilerServices; | |
using System.Windows.Forms; | |
namespace ftpTEST | |
{ | |
public class Form1 : Form | |
{ | |
private IContainer a = null; | |
private Button b; | |
[CompilerGenerated] | |
private static EventHandler c; | |
public Form1() | |
{ | |
this.a(); | |
Control arg_3B_0 = this.b; | |
if (Form1.c == null) | |
{ | |
Form1.c = new EventHandler(Form1.a); | |
} | |
arg_3B_0.Click += Form1.c; | |
} | |
public static void DownloadFile(string server, int port, string username, string password, string remoteFilePath, string localFilePath) | |
{ | |
using (WebClient webClient = new WebClient()) | |
{ | |
webClient.Credentials = new NetworkCredential(username, password); | |
webClient.DownloadFile(string.Format("ftp://{0}:{1}/{2}", server, port, remoteFilePath), localFilePath); | |
} | |
MessageBox.Show("done"); | |
} | |
protected override void Dispose(bool disposing) | |
{ | |
if (disposing && this.a != null) | |
{ | |
this.a.Dispose(); | |
} | |
base.Dispose(disposing); | |
} | |
private void a() | |
{ | |
this.b = new Button(); | |
base.SuspendLayout(); | |
this.b.Location = new Point(12, 22); | |
this.b.Name = "btnDownload"; | |
this.b.Size = new Size(131, 35); | |
this.b.TabIndex = 11; | |
this.b.Text = "下載"; | |
this.b.UseVisualStyleBackColor = true; | |
base.AutoScaleDimensions = new SizeF(6f, 12f); | |
base.AutoScaleMode = AutoScaleMode.Font; | |
base.ClientSize = new Size(161, 76); | |
base.Controls.Add(this.b); | |
base.Name = "Form1"; | |
this.Text = "Form1"; | |
base.ResumeLayout(false); | |
} | |
[CompilerGenerated] | |
private static void a(object A_0, EventArgs A_1) | |
{ | |
Form1.DownloadFile("SERVER", 21, "username", "password", "remoteFile", "localSavedPath"); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using <PrivateImplementationDetails>{24232FCF-358C-4534-BF21-45F921EA8161}; | |
using System; | |
using System.ComponentModel; | |
using System.Drawing; | |
using System.Net; | |
using System.Runtime.CompilerServices; | |
using System.Windows.Forms; | |
namespace A | |
{ | |
public class A : Form | |
{ | |
private IContainer A = null; | |
private Button A; | |
[CompilerGenerated] | |
private static EventHandler A; | |
public A() | |
{ | |
this.A(); | |
Control arg_3B_0 = this.A; | |
if (global::A.A.A == null) | |
{ | |
global::A.A.A = new EventHandler(global::A.A.A); | |
} | |
arg_3B_0.Click += global::A.A.A; | |
} | |
public static void A(string arg, int num, string userName, string password, string arg2, string fileName) | |
{ | |
using (WebClient webClient = new WebClient()) | |
{ | |
webClient.Credentials = new NetworkCredential(userName, password); | |
webClient.DownloadFile(string.Format(.A(), arg, num, arg2), fileName); | |
} | |
MessageBox.Show(.a()); | |
} | |
protected override void Dispose(bool flag) | |
{ | |
if (flag && this.A != null) | |
{ | |
this.A.Dispose(); | |
} | |
base.Dispose(flag); | |
} | |
private void A() | |
{ | |
this.A = new Button(); | |
base.SuspendLayout(); | |
this.A.Location = new Point(12, 22); | |
this.A.Name = .B(); | |
this.A.Size = new Size(131, 35); | |
this.A.TabIndex = 11; | |
this.A.Text = .b(); | |
this.A.UseVisualStyleBackColor = true; | |
base.AutoScaleDimensions = new SizeF(6f, 12f); | |
base.AutoScaleMode = AutoScaleMode.Font; | |
base.ClientSize = new Size(161, 76); | |
base.Controls.Add(this.A); | |
base.Name = .C(); | |
this.Text = .C(); | |
base.ResumeLayout(false); | |
} | |
[CompilerGenerated] | |
private static void A(object obj, EventArgs eventArgs) | |
{ | |
global::A.A.A(.c(), 21, .D(), .d(), .E(), .e()); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<Project DefaultTargets="BuildAll" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<!-- | |
Release.proj: | |
Builds and obfuscates a release. | |
You can make msbuild build the release by running the following command: | |
msbuild Release.proj | |
--> | |
<!-- default to release build --> | |
<PropertyGroup Condition="!Exists('$(Configuration)')"> | |
<Configuration>Release</Configuration> | |
</PropertyGroup> | |
<!-- paths for finding bits --> | |
<PropertyGroup> | |
<BasePath>$(MSBuildProjectDirectory)</BasePath> | |
<ExePath>$(BasePath)</ExePath> | |
<!--DllPath>$(BasePath)</DllPath--> | |
</PropertyGroup> | |
<!-- obfuscator bits --> | |
<PropertyGroup> | |
<ObfuscatorExe>$(BasePath)\obfuscar.Console.exe</ObfuscatorExe> | |
<ObfuscatorProject>$(BasePath)\obfuscar.xml</ObfuscatorProject> | |
<ObfuscatorInput>$(BasePath)\Obfuscator_Input</ObfuscatorInput> | |
<ObfuscatorOutput>$(BasePath)\Obfuscator_Output</ObfuscatorOutput> | |
</PropertyGroup> | |
<ItemGroup> | |
<!-- main exes --> | |
<ObfuscatedFile Include="$(ExePath)\ftpTest.exe" /> | |
<!--ObfuscatedFile Include="$(DllPath)\ftpTest.dll" /--> | |
</ItemGroup> | |
<ItemGroup> | |
<!--CompileSolution Include="$(BasePath)\ftpTest.sln" /--> | |
</ItemGroup> | |
<!-- clean, compile and package! --> | |
<Target Name="BuildAll" DependsOnTargets="Prepare;Clean;Compile;Obfuscate" /> | |
<!-- clean outputs and temp obfuscation files --> | |
<Target Name="Clean"> | |
<MSBuild Projects="@(CompileProject);@(CompileSolution)" | |
Properties="Configuration=$(Configuration)" | |
Targets="Clean" /> | |
<RemoveDir Directories="Final" /> | |
<RemoveDir Directories="$(ObfuscatorInput)" /> | |
<RemoveDir Directories="$(ObfuscatorOutput)" /> | |
</Target> | |
<!-- prepare --> | |
<Target Name="Prepare"> | |
<MSBuild Projects="@(CompileObfuscar)" | |
Properties="Configuration=$(Configuration);BuildType=$(BuildType)" /> | |
</Target> | |
<!-- compile --> | |
<Target Name="Compile"> | |
<MSBuild Projects="@(CompileSolution)" | |
Properties="Configuration=$(Configuration);BuildType=$(BuildType)" /> | |
</Target> | |
<!-- copies files that are to be obfuscated --> | |
<Target Name="CopyObfuscatedFiles" | |
DependsOnTargets="Compile"> | |
<MakeDir Directories="$(ObfuscatorInput)" /> | |
<!-- copy files that will be obfuscated to obfuscator input --> | |
<Copy SourceFiles="@(ObfuscatedFile)" | |
DestinationFolder="$(ObfuscatorInput)" /> | |
</Target> | |
<!-- obfuscate --> | |
<Target Name="Obfuscate" | |
DependsOnTargets="CopyObfuscatedFiles"> | |
<MakeDir Directories="$(ObfuscatorOutput)" /> | |
<Exec Command='"$(ObfuscatorExe)" "$(ObfuscatorProject)"' /> | |
<Copy SourceFiles="@(ObfuscatedFile->'$(ObfuscatorOutput)\%(filename)%(extension)')" | |
DestinationFolder="Final" /> | |
<Copy SourceFiles="$(ObfuscatorOutput)\Mapping.txt" | |
DestinationFolder="Final" /> | |
</Target> | |
</Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.ComponentModel; | |
using System.Drawing; | |
using System.Net; | |
using System.Windows.Forms; | |
namespace ftpTEST | |
{ | |
public class Form1 : Form | |
{ | |
private IContainer components = null; | |
private Button btnDownloadRltn; | |
public Form1() | |
{ | |
this.InitializeComponent(); | |
this.btnDownloadRltn.Click += delegate(object s, EventArgs e) | |
{ | |
Form1.DownloadFile("SERVER", 21, "username", "password", "remoteFile", "localSavedPath"); | |
}; | |
} | |
public static void DownloadFile(string server, int port, string username, string password, string remoteFilePath, string localFilePath) | |
{ | |
using (WebClient webClient = new WebClient()) | |
{ | |
webClient.Credentials = new NetworkCredential(username, password); | |
webClient.DownloadFile(string.Format("ftp://{0}:{1}/{2}", server, port, remoteFilePath), localFilePath); | |
} | |
MessageBox.Show("done"); | |
} | |
protected override void Dispose(bool disposing) | |
{ | |
if (disposing && this.components != null) | |
{ | |
this.components.Dispose(); | |
} | |
base.Dispose(disposing); | |
} | |
private void InitializeComponent() | |
{ | |
this.btnDownloadRltn = new Button(); | |
base.SuspendLayout(); | |
this.btnDownloadRltn.Location = new Point(12, 22); | |
this.btnDownloadRltn.Name = "btnDownload"; | |
this.btnDownloadRltn.Size = new Size(131, 35); | |
this.btnDownloadRltn.TabIndex = 11; | |
this.btnDownloadRltn.Text = "下載"; | |
this.btnDownloadRltn.UseVisualStyleBackColor = true; | |
base.AutoScaleDimensions = new SizeF(6f, 12f); | |
base.AutoScaleMode = AutoScaleMode.Font; | |
base.ClientSize = new Size(161, 76); | |
base.Controls.Add(this.btnDownloadRltn); | |
base.Name = "Form1"; | |
this.Text = "Form1"; | |
base.ResumeLayout(false); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment