In my upcoming assignment (the one that made me canceled my leave), I was asked to "verify" that a set of assemblies are indeed the compiled product of a set of source codes. *Gee! I'm a walking assembler or what?*
Anyway, here's how it can be done. You will need two tools - fc.exe (to diff files) and ildasm.exe (to disassemble a .NET assembly). You will also need the original source codes.
First, compile the source codes to produce the assembly (.dll or .exe). We will call this our source assembly. The target assembly will be the one already present. Next, use ildasm.exe to disassemble both assemblies and output the result to a file. Example:
ildasm /out=source.txt c:\source\MyAssembly.exe
ildasm /out=target.txt c:\target\MyAssembly.exe
To compare both files, use the fc.exe tool. Example:
fc source.txt target.txt
In the event where both assemblies are indeed produced by the same source codes, the comparison result will only show a minor difference on a comment line. It will be something like:
***** source.txt
.corflags 0x00000001 // ILONLY
// Image base: 0x00250000
***** target.txt
.corflags 0x00000001 // ILONLY
// Image base: 0x009F0000
Take note that the base address will be different on your machine. If no other changes are reported, then it is quite likely that both assemblies come from the same source code.
To compare the differences (i.e line-by-line) at a programming language level, I recommend Reflector and the Reflector.Diff add-in.
Why Not Do A Binary Comparison?
The fc.exe tool has a /b flag to perform binary comparisons. The reason why this will not work is because .NET assemblies are always different whenever they are being recompiled. Therefore, while a binary comparison on an assembly that was originally produced by the same compilation would yield no differences, a binary comparison on an assembly that was compiled on different compilations will reveal differences.
I would like to thank Tom Hollander for bringing up the disassemble and compare idea.
Popular Post
-
V12 / 5.576 cc / 385 PS / 406 ft/lb (550 Nm) @ 4.000 / 0 - 62 mph (100 km/h): 6,6 s / Vmax: 155 mph (250 km/h) (click images for a larger ...
-
This car sent in by Jake Stichler This is a 92 F150, currently residing in Lebanon, PA with nearly a quarter million miles that I picked up ...
-
Nissan will start taking orders for the upcoming all-electric LEAF next Spring. And they are building to meet expected initial orders for 20...
-
2009 Barnard Racer Prototype (South Africa) It's been over 50 years since South Africa has produced a home-bred supercar. This is exclu...
-
Mosler MT900R Gulf Livery - 1/32 Analog RTR NSR1085SW Ford P68 Shell #8 Livery This car features : 3 Different Available Drivetrain Configur...
-
Went to check-out my phone line today because a few days back, TM had sent someone to connect my line but somehow the wall socket in my hous...
-
Photo: Diane Edwardson, September 3, 2011. Equipment for the gas main construction is quiet today on Corralitas Drive. (Click on photo to ...
-
Congratulations to this week's PaveParker of the Week! The driver of Aberdeen Car Vauxhall Zafira Estate 1.8i Elite (oooh!) reg. YC08GYO...
-
Global warming to go into reverse? The BBC reports today on a new scientific study that purports to show that changes in the Sun's outp...
-
In January 2007 it was reported from Davos that Shimon Peres was in talks to bring an electric car factory to Israel. I wrote : It's abo...
No comments:
Post a Comment