/usr/share/cli-common/ildasm-monodis is in cli-common-dev 0.9+nmu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | #!/usr/bin/perl
#
# Setup
#
# Directives
use strict;
use warnings;
# Modules
use Getopt::Long;
#
# Variables
#
# Filenames
my $assemblyref;
# Get the mode
GetOptions(
"assemblyref!" => \$assemblyref,
);
# Get the filenames
my $dll_filename = shift;
usage() if (!defined $dll_filename);
# Figure out what to do
if ($assemblyref)
{
parse_assemblyref($dll_filename);
}
else
{
# As per meeby, do assemblyref
parse_assemblyref($dll_filename);
}
#
# Create a pipe to the 'ildasm' program and give it the given
# DLL. Then, take the results, parse them, and write it out to stdout.
#
sub parse_assemblyref
{
# Get the parameters
my $dll_filename = shift;
# Open the pipe
open PIPE, "/usr/bin/ildasm $dll_filename |"
or die "Cannot open /usr/bin/ildasm $dll_filename ($!)";
# Print out the header
print "AssemblyRef Table\n";
# Go through the results
my $count = 0;
while (<PIPE>)
{
# Clean up the line
chomp;
# Check for assembly ref
if (/^\.assembly extern (.*?)$/)
{
# We have an assembly reference
my $name = $1;
my $version = undef;
my $key = "\tZero sized public key";
$count++;
# On occasion, the name has quotes around it, but monodis
# doesn't.
$name =~ s/\'//g;
$name =~ s/\"//g;
# Go through and parse the rest of the variables until we
# get to a } which signals the end of the block.
while (<PIPE>)
{
# Stop if we get a }
last if /^\}/;
s/^\s+//;
# Check for the keys
if (/\.ver (\d+):(\d+):(\d+):(\d+)/)
{
# Make it look like mono
$version = "$1.$2.$3.$4";
next;
}
# Check for public key
if (/\.publickeytoken = \((.*?)\)/)
{
# Monodis adds a space at the end of this next line
$key = "\tPublic Key:\n0x00000000: $1 ";
}
}
# Emit it
print join("\n",
"$count: Version=$version",
"\tName=$name",
$key,
), "\n";
}
}
# Mono also has an extra space at the end
print "\n";
# Close the pipe
close PIPE;
}
#
# Usage. Just your typical complain function that automatically exits
# out of perl after complaining.
#
sub usage
{
print STDERR join("\n",
"USAGE: $0 [options] /path/to/something.dll",
"",
"Options:",
sprintf("%-20.20s %s",
"--assemblyref",
"Dumps output like 'monodis --assemblyref'"),
), "\n";
exit 1;
}
|