Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
examples for obfuscation. readme
- Loading branch information
Ciprian Lucaci
committed
Aug 1, 2016
1 parent
61a3008
commit 1f6373d
Showing
125 changed files
with
40,880 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 14 | ||
VisualStudioVersion = 14.0.22823.1 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeVirtualization-Console", "CodeVirtualization-Console\CodeVirtualization-Console.csproj", "{29BC5F29-5C47-4975-A676-5318535DCDB7}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|x86 = Debug|x86 | ||
Release|x86 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{29BC5F29-5C47-4975-A676-5318535DCDB7}.Debug|x86.ActiveCfg = Debug|x86 | ||
{29BC5F29-5C47-4975-A676-5318535DCDB7}.Debug|x86.Build.0 = Debug|x86 | ||
{29BC5F29-5C47-4975-A676-5318535DCDB7}.Release|x86.ActiveCfg = Release|x86 | ||
{29BC5F29-5C47-4975-A676-5318535DCDB7}.Release|x86.Build.0 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
19 changes: 19 additions & 0 deletions
19
CodeVirtualization-Console/CodeVirtualization-Console/App.config
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<appSettings> | ||
<add key="CODE_IDENTIFIER" value="virtualCode" /> | ||
<add key="DATA_IDENTIFIER" value="virtualData" /> | ||
<add key="DEFAULT_MOST_FREQUENT_OPERATION" value="true" /> | ||
<add key="INSTRUCTION_SIZE_POSTFIX" value="30" /> | ||
<add key="INSTRUCTION_SIZE_PREFIX" value="30" /> | ||
<add key="INSTRUCTION_SIZE_OFFSET" value="20" /> | ||
<add key="MAX_INVOCATIONS" value="1" /> | ||
<add key="MAX_OPERANDS" value="2" /> | ||
<add key="MAX_JUNK_CODE" value="10" /> | ||
<add key="MAX_DATA_KEY" value="3999" /> | ||
<add key="MAX_CODE_KEY" value="99999" /> | ||
<add key="MIN_SWITCH_KEY" value="1000" /> | ||
<add key="MAX_SWITCH_KEY" value="9999" /> | ||
<add key="VPC_IDENTIFIER" value="virtualVpc" /> | ||
</appSettings> | ||
</configuration> |
19 changes: 19 additions & 0 deletions
19
CodeVirtualization-Console/CodeVirtualization-Console/App2.config
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<appSettings> | ||
<add key="CODE_IDENTIFIER" value="virtualCode2" /> | ||
<add key="DATA_IDENTIFIER" value="virtualData2" /> | ||
<add key="DEFAULT_MOST_FREQUENT_OPERATION" value="true" /> | ||
<add key="INSTRUCTION_SIZE_POSTFIX" value="30" /> | ||
<add key="INSTRUCTION_SIZE_PREFIX" value="30" /> | ||
<add key="INSTRUCTION_SIZE_OFFSET" value="20" /> | ||
<add key="MAX_INVOCATIONS" value="1" /> | ||
<add key="MAX_OPERANDS" value="2" /> | ||
<add key="MAX_JUNK_CODE" value="10" /> | ||
<add key="MAX_DATA_KEY" value="3999" /> | ||
<add key="MAX_CODE_KEY" value="99999" /> | ||
<add key="MIN_SWITCH_KEY" value="1000" /> | ||
<add key="MAX_SWITCH_KEY" value="9999" /> | ||
<add key="VPC_IDENTIFIER" value="virtualVpc" /> | ||
</appSettings> | ||
</configuration> |
173 changes: 173 additions & 0 deletions
173
CodeVirtualization-Console/CodeVirtualization-Console/CodeVirtualization-Console.csproj
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform> | ||
<ProductVersion>8.0.30703</ProductVersion> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>{29BC5F29-5C47-4975-A676-5318535DCDB7}</ProjectGuid> | ||
<OutputType>Exe</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>CodeVirtualization_Console</RootNamespace> | ||
<AssemblyName>CodeVirtualization-Console</AssemblyName> | ||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> | ||
<PlatformTarget>x86</PlatformTarget> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> | ||
<PlatformTarget>x86</PlatformTarget> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="Microsoft.CodeAnalysis, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="Microsoft.CodeAnalysis.CSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Microsoft.CodeAnalysis.CSharp.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.CSharp.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="Microsoft.CodeAnalysis.CSharp.Desktop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Microsoft.CodeAnalysis.CSharp.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.CSharp.Desktop.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="Microsoft.CodeAnalysis.CSharp.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Microsoft.CodeAnalysis.CSharp.Workspaces.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.CSharp.Workspaces.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="Microsoft.CodeAnalysis.CSharp.Workspaces.Desktop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Microsoft.CodeAnalysis.CSharp.Workspaces.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.CSharp.Workspaces.Desktop.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="Microsoft.CodeAnalysis.Desktop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Workspaces.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="Microsoft.CodeAnalysis.Workspaces.Desktop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Workspaces.Desktop.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Collections.Immutable, Version=1.1.33.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\System.Collections.Immutable.1.1.33-beta\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="System.Composition.AttributedModel, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.AttributedModel.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="System.Composition.Convention, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Convention.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="System.Composition.Hosting, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Hosting.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="System.Composition.Runtime, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.Runtime.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="System.Composition.TypedParts, Version=1.0.27.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\Microsoft.Composition.1.0.27\lib\portable-net45+win8+wp8+wpa81\System.Composition.TypedParts.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="System.Configuration" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="System.Reflection.Metadata, Version=1.0.18.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\System.Reflection.Metadata.1.0.18-beta\lib\portable-net45+win8\System.Reflection.Metadata.dll</HintPath> | ||
<Private>True</Private> | ||
</Reference> | ||
<Reference Include="System.Xml" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Context\VirtualOperation.cs" /> | ||
<Compile Include="Program.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="RefactoringVisitors\LoopRefactoring\DoWhileConditionRefactoringVisitor.cs" /> | ||
<Compile Include="RefactoringVisitors\LoopRefactoring\ForEachConditionRefactoringVisitor.cs" /> | ||
<Compile Include="RefactoringVisitors\OperationSimplifiers\ComparisonSignSimplifierVisitor.cs" /> | ||
<Compile Include="RefactoringVisitors\SwitchRefactoring\SwitchBreakRefactoring.cs" /> | ||
<Compile Include="RefactoringVisitors\SwitchRefactoring\SwitchStatementRefactoring.cs" /> | ||
<Compile Include="RefactoringVisitors\SwitchRefactoring\SwitchSectionRefactoring.cs" /> | ||
<Compile Include="RefactoringVisitors\SwitchRefactoring\SwitchConditionRefactoring.cs" /> | ||
<Compile Include="RefactoringVisitors\IfRefactoring\IfBranchesRefactoringVisitor.cs" /> | ||
<Compile Include="RefactoringVisitors\LoopRefactoring\ForConditionRefactoringVisitor.cs" /> | ||
<Compile Include="RefactoringVisitors\OperationSimplifiers\AdditiveOperationSimplifierVisitor.cs" /> | ||
<Compile Include="RefactoringVisitors\OperationSimplifiers\MemberAccessExpressionSimplifier.cs" /> | ||
<Compile Include="RefactoringVisitors\OperationSimplifiers\InvocationExpressionSimplifier.cs" /> | ||
<Compile Include="RefactoringVisitors\LocalDeclarationConstantForceType.cs" /> | ||
<Compile Include="RefactoringVisitors\OperationSimplifiers\ParenthesisOperationSimplifierVisitor.cs" /> | ||
<Compile Include="RefactoringVisitors\OperationSimplifiers\MultiplicativeOperationSimplifierVisitor.cs" /> | ||
<Compile Include="RefactoringVisitors\RenameVisitor.cs" /> | ||
<Compile Include="RefactoringVisitors\LoopRefactoring\WhileConditionRefactoringVisitor.cs" /> | ||
<Compile Include="RefactoringVisitors\IfRefactoring\IfConditionRefactoringVisitor.cs" /> | ||
<Compile Include="RefactoringVisitors\LoopRefactoring\LoopBodyRefactoringVisitor.cs" /> | ||
<Compile Include="RefactoringVisitors\MethodRefactoringVisitor.cs" /> | ||
<Compile Include="RefactoringVisitors\TryCatch\TryCatchRefactoringVisitor.cs" /> | ||
<Compile Include="TypingVisitors\MethodExplicitTypeVisitor.cs" /> | ||
<Compile Include="TypingVisitors\VarTypeReplaceVisitor.cs" /> | ||
<Compile Include="Utils\ListExtensions.cs" /> | ||
<Compile Include="Utils\SyntaxFactoryExtensions.cs" /> | ||
<Compile Include="Context\VirtualData.cs" /> | ||
<Compile Include="Context\VirtualizationContext.cs" /> | ||
<Compile Include="Utils\VirtualizationAttribute.cs" /> | ||
<Compile Include="VirtualizationHandler.cs" /> | ||
<Compile Include="VirtualizationVisitors\AssignmentDataVirtualizationVisitor.cs" /> | ||
<Compile Include="RefactoringVisitors\ComposedAssignmentVisitor.cs" /> | ||
<Compile Include="RefactoringVisitors\FormatInsertTabRightVisitor.cs" /> | ||
<Compile Include="RefactoringVisitors\ConditionalExpressionVisitor.cs" /> | ||
<Compile Include="VirtualizationVisitors\ClassVirtualizationVisitor.cs" /> | ||
<Compile Include="VirtualizationVisitors\MethodParamsExtractorVisitor.cs" /> | ||
<Compile Include="VirtualizationVisitors\LocalDeclarationExtractorVisitor.cs" /> | ||
<Compile Include="VirtualizationVisitors\LocalVariableUsageDataVirtVisitor.cs" /> | ||
<Compile Include="VirtualizationVisitors\MethodVirtualizationVisitor.cs" /> | ||
<Compile Include="VirtualizationVisitors\ConstantValueVisitor.cs" /> | ||
<Compile Include="RefactoringVisitors\OperationSimplifiers\PrePostOperationVisitor.cs" /> | ||
<Compile Include="VirtualizationVisitors\StatementsExtractorVisitor.cs" /> | ||
<Compile Include="RefactoringVisitors\TriviaRemovalVisitor.cs" /> | ||
<Compile Include="VisualStudioSolutionHandler.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="App2.config" /> | ||
<None Include="App.config" /> | ||
<None Include="packages.config" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Analyzer Include="..\packages\Microsoft.CodeAnalysis.Analyzers.1.0.0-rc2\tools\analyzers\C#\Microsoft.CodeAnalysis.Analyzers.dll" /> | ||
<Analyzer Include="..\packages\Microsoft.CodeAnalysis.Analyzers.1.0.0-rc2\tools\analyzers\C#\Microsoft.CodeAnalysis.CSharp.Analyzers.dll" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<WCFMetadata Include="Service References\" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
6 changes: 6 additions & 0 deletions
6
CodeVirtualization-Console/CodeVirtualization-Console/CodeVirtualization-Console.csproj.user
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> | ||
<StartArguments>C:\_DEV_\thesis2015-SVN\source\virtualization_obfuscation_tool\\CodeVirtualization-Console\CodeVirtualization-Console\App2.config C:\_DEV_\thesis2015-SVN\source\virtualization_obfuscation_tool\\ConsoleCalculator\ConsoleCalculator.sln</StartArguments> | ||
</PropertyGroup> | ||
</Project> |
58 changes: 58 additions & 0 deletions
58
CodeVirtualization-Console/CodeVirtualization-Console/Context/VirtualData.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Microsoft.CodeAnalysis; | ||
using Microsoft.CodeAnalysis.CSharp; | ||
using Microsoft.CodeAnalysis.CSharp.Syntax; | ||
|
||
namespace CodeVirtualization_Console | ||
{ | ||
class VirtualData | ||
{ | ||
|
||
public readonly List<SyntaxAnnotation> Annotations = new List<SyntaxAnnotation>(); | ||
|
||
public int Index { get; set; } | ||
|
||
public string Name { get; set; } | ||
|
||
public string Type { get; set; } | ||
|
||
public SyntaxNode Node { get; set; } | ||
|
||
public StatementSyntax Statement { get; set; } | ||
|
||
private ExpressionSyntax _defaultValue; | ||
public ExpressionSyntax DefaultValue | ||
{ | ||
get | ||
{ | ||
if (_defaultValue == null) | ||
DefaultValue = null; | ||
return _defaultValue; | ||
} | ||
set | ||
{ | ||
if (value == null) | ||
_defaultValue = SyntaxFactoryExtensions.DefaultRandomValue(Type); | ||
else | ||
_defaultValue = value; | ||
} | ||
} | ||
|
||
public bool IsConstant | ||
{ | ||
get | ||
{ | ||
var found = Annotations.Where(a => a.Kind.Equals("type")).FirstOrDefault(a => a.Data.Equals("constant")); | ||
if (found == null) | ||
return false; | ||
return true; | ||
} | ||
} | ||
|
||
|
||
} | ||
} |
Oops, something went wrong.