furnace-avm2 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +2 -2
- data/bin/furnace-avm2 +10 -4
- data/lib/furnace-avm2/abc/metadata/exception_info.rb +6 -6
- data/lib/furnace-avm2/abc/metadata/instance_info.rb +4 -0
- data/lib/furnace-avm2/abc/metadata/klass_info.rb +4 -0
- data/lib/furnace-avm2/abc/metadata/trait_slot.rb +2 -2
- data/lib/furnace-avm2/abc/primitives/opcode_sequence.rb +11 -1
- data/lib/furnace-avm2/version.rb +1 -1
- metadata +6 -6
data/Gemfile.lock
CHANGED
data/bin/furnace-avm2
CHANGED
@@ -24,6 +24,8 @@ EOS
|
|
24
24
|
opt :output, "Output file", :type => :string
|
25
25
|
opt :verbose, "Be verbose", :default => false
|
26
26
|
|
27
|
+
opt :threads, "Use <i> threads for processing", :default => 1
|
28
|
+
|
27
29
|
opt :only, "Only operate on methods <i+>", :type => :ints, :short => '-O'
|
28
30
|
opt :except, "Operate on all methods except <i+>", :type => :ints, :short => '-E'
|
29
31
|
opt :grep, "Search <s> in method names", :type => :string, :short => '-G'
|
@@ -104,7 +106,7 @@ threads = []
|
|
104
106
|
bodies = abc.method_bodies.dup
|
105
107
|
mutex = Mutex.new
|
106
108
|
|
107
|
-
|
109
|
+
opts[:threads].times do
|
108
110
|
threads << Thread.new do
|
109
111
|
loop do
|
110
112
|
body = mutex.synchronize { bodies.pop }
|
@@ -129,8 +131,10 @@ mutex = Mutex.new
|
|
129
131
|
end
|
130
132
|
|
131
133
|
if opts[:ast]
|
132
|
-
ast, = body.
|
134
|
+
ast, = body.code_to_ast
|
135
|
+
puts "Method #{body.method_idx}"
|
133
136
|
puts ast.to_sexp
|
137
|
+
puts
|
134
138
|
end
|
135
139
|
|
136
140
|
if opts[:cfg]
|
@@ -143,7 +147,7 @@ mutex = Mutex.new
|
|
143
147
|
disasm[body, true] if opts[:disasm_after]
|
144
148
|
rescue Exception => e
|
145
149
|
if opts[:collect]
|
146
|
-
|
150
|
+
puts "Failure at method body idx=#{body.method_idx}: #{e.class} (#{e.message}) at #{e.backtrace.first}."
|
147
151
|
failed << body.method_idx
|
148
152
|
else
|
149
153
|
raise e
|
@@ -169,7 +173,9 @@ end
|
|
169
173
|
if opts[:collect] && failed.any?
|
170
174
|
puts "To skip #{failed.count} failed methods, append this command-line argument:"
|
171
175
|
puts " --except #{failed.join " "}"
|
172
|
-
|
176
|
+
end
|
177
|
+
|
178
|
+
if opts[:output]
|
173
179
|
File.open(opts[:output], "w") do |file|
|
174
180
|
abc.write(file)
|
175
181
|
end
|
@@ -15,15 +15,15 @@ module Furnace::AVM2::ABC
|
|
15
15
|
def resolve!
|
16
16
|
sequence = @parent.code
|
17
17
|
|
18
|
-
@from = sequence.opcode_at(
|
19
|
-
@to = sequence.opcode_at(
|
20
|
-
@target = sequence.opcode_at(
|
18
|
+
@from = sequence.opcode_at(from_offset)
|
19
|
+
@to = sequence.opcode_at(to_offset)
|
20
|
+
@target = sequence.opcode_at(target_offset)
|
21
21
|
end
|
22
22
|
|
23
23
|
def lookup!
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
self.from_offset = @from.offset
|
25
|
+
self.to_offset = @to.offset
|
26
|
+
self.target_offset = @target.offset
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -28,6 +28,10 @@ module Furnace::AVM2::ABC
|
|
28
28
|
root.klasses[root.instances.index(self)]
|
29
29
|
end
|
30
30
|
|
31
|
+
def initializer_body
|
32
|
+
root.method_bodies.find { |body| body.method_idx == initializer_idx }
|
33
|
+
end
|
34
|
+
|
31
35
|
def to_astlet
|
32
36
|
if interface?
|
33
37
|
root = AST::Node.new(:interface)
|
@@ -38,9 +38,9 @@ module Furnace::AVM2::ABC
|
|
38
38
|
when :UInt
|
39
39
|
AST::Node.new(:integer, [ root.constant_pool.uints[value_idx - 1] ])
|
40
40
|
when :Double
|
41
|
-
AST::Node.new(:
|
41
|
+
AST::Node.new(:double, [ root.constant_pool.doubles[value_idx - 1] ])
|
42
42
|
when :Utf8
|
43
|
-
AST::Node.new(:
|
43
|
+
AST::Node.new(:string, [ root.constant_pool.strings[value_idx - 1] ])
|
44
44
|
when :True
|
45
45
|
AST::Node.new(:true)
|
46
46
|
when :False
|
@@ -26,7 +26,13 @@ module Furnace::AVM2::ABC
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
def each
|
29
|
+
def each
|
30
|
+
parse if @raw_code
|
31
|
+
|
32
|
+
super
|
33
|
+
end
|
34
|
+
|
35
|
+
def map
|
30
36
|
parse if @raw_code
|
31
37
|
|
32
38
|
super
|
@@ -176,6 +182,10 @@ module Furnace::AVM2::ABC
|
|
176
182
|
each do |element|
|
177
183
|
element.resolve! if element.respond_to? :resolve!
|
178
184
|
end
|
185
|
+
|
186
|
+
exceptions.each do |exception|
|
187
|
+
exception.resolve!
|
188
|
+
end
|
179
189
|
end
|
180
190
|
|
181
191
|
def lookup!
|
data/lib/furnace-avm2/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: furnace-avm2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-02-
|
12
|
+
date: 2012-02-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: furnace
|
16
|
-
requirement: &
|
16
|
+
requirement: &79381650 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.0.5
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *79381650
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: trollop
|
27
|
-
requirement: &
|
27
|
+
requirement: &79380920 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *79380920
|
36
36
|
description: furnace-avm2 allows one to load, modify and write back Flash ActionScript3
|
37
37
|
bytecode. It can also decompile it.
|
38
38
|
email:
|