Skip to content

Commit

Permalink
Initial upload
Browse files Browse the repository at this point in the history
Uploaded initial solution
  • Loading branch information
dennisbabkin authored Apr 25, 2021
1 parent 3d0836a commit d1d78bd
Show file tree
Hide file tree
Showing 14 changed files with 1,462 additions and 0 deletions.
25 changes: 25 additions & 0 deletions SigRemFuzzer/SigRemFuzzer.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30907.101
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SigRemFuzzer", "SigRemFuzzer\SigRemFuzzer.csproj", "{A5F5ACCA-B67B-4430-A6EC-5764D1166FFC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A5F5ACCA-B67B-4430-A6EC-5764D1166FFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A5F5ACCA-B67B-4430-A6EC-5764D1166FFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A5F5ACCA-B67B-4430-A6EC-5764D1166FFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A5F5ACCA-B67B-4430-A6EC-5764D1166FFC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2619F3CD-F7BF-4DBC-80F0-D8D4CF8BC1DA}
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions SigRemFuzzer/SigRemFuzzer/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
132 changes: 132 additions & 0 deletions SigRemFuzzer/SigRemFuzzer/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SigRemFuzzer
{
class Program
{
static void Main(string[] args)
{
RemSigCountStats stats = new RemSigCountStats();

EnumerateFolder(@"C:\", ref stats);
}



static void EnumerateFolder(string strFldrPath, ref RemSigCountStats stats)
{
if(!strFldrPath.EndsWith(@"\"))
strFldrPath += @"\";

string[] strFiles = null;
try
{
strFiles = Directory.GetFiles(strFldrPath);
}
catch(UnauthorizedAccessException)
{
//Skip it
}

if (strFiles != null)
{
foreach (string strFile in strFiles)
{
Console.CursorTop = 0;
Console.WriteLine(strFile + "\t\t\t\t\t\t\t\t\t");

//Do the fuzzing of the file
FuzzFile(strFile, ref stats);

//Output stats
Console.CursorTop = 10;
Console.Write(
$"Success: {stats.nCount_Success}\n" +
$"Not PE: {stats.nCount_NotPE}\n" +
$"Failed Open: {stats.nCount_FailedToOpen}\n" +
$"No signature: {stats.nCount_NoSig}\n"
);
}

foreach (string strFldr in Directory.GetDirectories(strFldrPath))
{
EnumerateFolder(strFldr, ref stats);

}
}
}


enum EXIT_CODES {
XC_Success = 0,
XC_BinaryHasNoSignature = 1,

XC_GEN_FAILURE = -1,
XC_FailedToOpen = -2,
XC_Not_PE_File = -3,
XC_BadSignature = -4,
XC_FailedChecksum = -5,
XC_FailedFileWrite = -6,
};

class RemSigCountStats
{
public int nCount_Success { get; set; }
public int nCount_NotPE { get; set; }
public int nCount_FailedToOpen { get; set; }
public int nCount_NoSig { get; set; }
}

static void FuzzFile(string strFilePath, ref RemSigCountStats stats)
{
try
{
Process proc = new Process();
proc.StartInfo.FileName = @"..\..\..\..\Debug\SigRemover.exe";
proc.StartInfo.Arguments = $"-i \"{ strFilePath }\"";
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

proc.Start();

proc.WaitForExit();

EXIT_CODES exitCode = (EXIT_CODES)proc.ExitCode;

//Check exit codes
if(exitCode == EXIT_CODES.XC_BinaryHasNoSignature)
{
stats.nCount_NoSig++;
}
else if(exitCode == EXIT_CODES.XC_FailedToOpen)
{
stats.nCount_FailedToOpen++;
}
else if(exitCode == EXIT_CODES.XC_Not_PE_File)
{
stats.nCount_NotPE++;
}
else if(exitCode == EXIT_CODES.XC_Success)
{
stats.nCount_Success++;
}
else
{
//This needs our attention!
Console.WriteLine($"Failed exit code: { exitCode } in file: { strFilePath}");
}
}
catch(Exception ex)
{
Console.WriteLine($"Exception: { ex.ToString() }");
}
}


}
}
36 changes: 36 additions & 0 deletions SigRemFuzzer/SigRemFuzzer/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SigRemFuzzer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SigRemFuzzer")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a5f5acca-b67b-4430-a6ec-5764d1166ffc")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
53 changes: 53 additions & 0 deletions SigRemFuzzer/SigRemFuzzer/SigRemFuzzer.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A5F5ACCA-B67B-4430-A6EC-5764D1166FFC}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>SigRemFuzzer</RootNamespace>
<AssemblyName>SigRemFuzzer</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</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|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
31 changes: 31 additions & 0 deletions SigRemover.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30907.101
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SigRemover", "SigRemover\SigRemover.vcxproj", "{88795CD3-4600-4A74-846C-0AFF5588C0E6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{88795CD3-4600-4A74-846C-0AFF5588C0E6}.Debug|x64.ActiveCfg = Debug|x64
{88795CD3-4600-4A74-846C-0AFF5588C0E6}.Debug|x64.Build.0 = Debug|x64
{88795CD3-4600-4A74-846C-0AFF5588C0E6}.Debug|x86.ActiveCfg = Debug|Win32
{88795CD3-4600-4A74-846C-0AFF5588C0E6}.Debug|x86.Build.0 = Debug|Win32
{88795CD3-4600-4A74-846C-0AFF5588C0E6}.Release|x64.ActiveCfg = Release|x64
{88795CD3-4600-4A74-846C-0AFF5588C0E6}.Release|x64.Build.0 = Release|x64
{88795CD3-4600-4A74-846C-0AFF5588C0E6}.Release|x86.ActiveCfg = Release|Win32
{88795CD3-4600-4A74-846C-0AFF5588C0E6}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9095612A-70DC-48BC-9C89-04BF3B814994}
EndGlobalSection
EndGlobal
Loading

0 comments on commit d1d78bd

Please sign in to comment.