CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/lib/msf/util/dot_net_deserialization/assemblies.rb
Views: 11784
1
module Msf
2
module Util
3
module DotNetDeserialization
4
module Assemblies
5
6
# see:
7
# * https://docs.microsoft.com/en-us/dotnet/standard/assembly/
8
# * https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/versions-and-dependencies
9
# * https://docs.microsoft.com/en-us/dotnet/standard/assembly/reference-strong-named
10
class StrongName
11
def initialize(name, version, public_key_token, culture: 'neutral')
12
@name = name
13
@version = version
14
@public_key_token = public_key_token
15
@culture = culture
16
end
17
18
attr_reader :name, :version, :public_key_token, :culture
19
20
def to_s
21
"#{name}, Version=#{version}, Culture=#{culture}, PublicKeyToken=#{public_key_token}"
22
end
23
24
def [](type_name)
25
QualifiedName.new(type_name, self)
26
end
27
end
28
29
# see: https://docs.microsoft.com/en-us/dotnet/api/system.type.assemblyqualifiedname
30
class QualifiedName
31
def initialize(name, assembly)
32
@name = name
33
@assembly = assembly
34
end
35
36
attr_reader :name, :assembly
37
38
def to_s
39
"#{name}, #{assembly}"
40
end
41
end
42
43
VERSIONS = {
44
'4.0.0.0' => {
45
'mscorlib' => StrongName.new('mscorlib', '4.0.0.0', 'b77a5c561934e089'),
46
'System' => StrongName.new('System', '4.0.0.0', 'b77a5c561934e089'),
47
'System.Configuration.Install' => StrongName.new('System.Configuration.Install', '4.0.0.0', 'b03f5f7f11d50a3a'),
48
'System.Data' => StrongName.new('System.Data', '4.0.0.0', 'b77a5c561934e089')
49
}
50
}
51
52
end
53
end
54
end
55
end
56
57