mirror of
https://github.com/Colton1skees/Dna
synced 2026-06-21 13:42:09 +00:00
Merge branch 'master' into feat/intermediate-language
This commit is contained in:
@@ -11,4 +11,8 @@
|
||||
<ProjectReference Include="..\Dna\Dna.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommandLineParser" Version="2.9.0-preview1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
+37
-7
@@ -1,10 +1,40 @@
|
||||
using Dna.Binary;
|
||||
using CommandLine;
|
||||
using Dna.Binary;
|
||||
using Dna.Binary.Windows;
|
||||
using Dna.ControlFlow;
|
||||
|
||||
var bytes = File.ReadAllBytes(@"C:\Users\colton\Downloads\driver.sys");
|
||||
IBinary binary = new WindowsBinary(64, bytes, 0x140000000);
|
||||
var dna = new Dna.Dna(binary);
|
||||
var cfg = dna.RecursiveDescent.ReconstructCfg(0x14034E74A);
|
||||
Console.WriteLine(GraphFormatter.FormatGraph(cfg));
|
||||
Console.ReadLine();
|
||||
class Program
|
||||
{
|
||||
public class Options
|
||||
{
|
||||
[Option("binary", Required = true, HelpText = "Filepath to binary")]
|
||||
public string Binary { get; set; }
|
||||
|
||||
[Option("base", Required = true, HelpText = "Base address")]
|
||||
public ulong Base { get; set; }
|
||||
|
||||
[Option("start", Required = true, HelpText = "Address to begin analysis from")]
|
||||
public ulong Start { get; set; }
|
||||
}
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
var binaryFilepath = "";
|
||||
ulong baseAddr = 0x0;
|
||||
ulong startAddr = 0x0;
|
||||
|
||||
Parser.Default.ParseArguments<Options>(args).WithParsed<Options>(options =>
|
||||
{
|
||||
binaryFilepath = options.Binary;
|
||||
baseAddr = options.Base;
|
||||
startAddr = options.Start;
|
||||
});
|
||||
|
||||
var bytes = File.ReadAllBytes(binaryFilepath);
|
||||
IBinary binary = new WindowsBinary(64, bytes, baseAddr);
|
||||
var dna = new Dna.Dna(binary);
|
||||
var cfg = dna.RecursiveDescent.ReconstructCfg(startAddr);
|
||||
Console.WriteLine(GraphFormatter.FormatGraph(cfg));
|
||||
Console.ReadLine();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user