Code cleanups
git-svn-id: file:///home/svn/framework3/trunk@5773 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
+1
-1
@@ -19,4 +19,4 @@ require 'bindata/struct'
|
|||||||
#
|
#
|
||||||
module BinData
|
module BinData
|
||||||
VERSION = "0.9.2-eofpatch" # Temporary fork for PacketFu.
|
VERSION = "0.9.2-eofpatch" # Temporary fork for PacketFu.
|
||||||
end
|
end
|
||||||
@@ -327,4 +327,4 @@ module BinData
|
|||||||
element
|
element
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
+1
-1
@@ -377,4 +377,4 @@ module BinData
|
|||||||
# End To be implemented by subclasses
|
# End To be implemented by subclasses
|
||||||
###########################################################################
|
###########################################################################
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
+1
-1
@@ -804,4 +804,4 @@ module BinData
|
|||||||
register(self.name, self)
|
register(self.name, self)
|
||||||
BitField.create_methods(self, 63, :little)
|
BitField.create_methods(self, 63, :little)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -160,4 +160,4 @@ module BinData
|
|||||||
obj
|
obj
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -85,4 +85,4 @@ module BinData
|
|||||||
register(self.name, self)
|
register(self.name, self)
|
||||||
Float.create_float_methods(self, false, :big)
|
Float.create_float_methods(self, false, :big)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
+1
-1
@@ -182,4 +182,4 @@ module BinData
|
|||||||
register(self.name, self)
|
register(self.name, self)
|
||||||
Integer.create_int_methods(self, 64, :big)
|
Integer.create_int_methods(self, 64, :big)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
+1
-1
@@ -189,4 +189,4 @@ module BinData
|
|||||||
alias_method :flush, :flushbits
|
alias_method :flush, :flushbits
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
+1
-1
@@ -108,4 +108,4 @@ module BinData
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -131,4 +131,4 @@ module BinData
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -338,4 +338,4 @@ module BinData
|
|||||||
@element_list.pop
|
@element_list.pop
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -39,4 +39,4 @@ module BinData
|
|||||||
@registry[name.to_s]
|
@registry[name.to_s]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
+1
-1
@@ -38,4 +38,4 @@ module BinData
|
|||||||
""
|
""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -117,5 +117,4 @@ module BinData
|
|||||||
|
|
||||||
def_delegators :@hash, :[], :has_key?, :include?, :keys
|
def_delegators :@hash, :[], :has_key?, :include?, :keys
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -174,4 +174,4 @@ module BinData
|
|||||||
# To be implemented by subclasses
|
# To be implemented by subclasses
|
||||||
###########################################################################
|
###########################################################################
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -191,4 +191,4 @@ module BinData
|
|||||||
# To be implemented by subclasses
|
# To be implemented by subclasses
|
||||||
###########################################################################
|
###########################################################################
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -112,4 +112,4 @@ module BinData
|
|||||||
""
|
""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -95,4 +95,4 @@ module BinData
|
|||||||
result
|
result
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -380,4 +380,4 @@ module BinData
|
|||||||
hash
|
hash
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
require 'metasm/metasm'
|
require 'metasm/metasm'
|
||||||
@@ -67,4 +67,4 @@ end
|
|||||||
|
|
||||||
if __FILE__ == $0
|
if __FILE__ == $0
|
||||||
asm
|
asm
|
||||||
end
|
end
|
||||||
@@ -33,4 +33,4 @@ require 'metasm/parse_c'
|
|||||||
require 'metasm/compile_c'
|
require 'metasm/compile_c'
|
||||||
|
|
||||||
# cleanup include path
|
# cleanup include path
|
||||||
$:.delete metasmdir if metasmdir
|
$:.delete metasmdir if metasmdir
|
||||||
@@ -37,4 +37,4 @@ class MIPS
|
|||||||
Expression[base, :+, [[val, :&, mask], :<<, shift]].encode(:u32, @endianness)
|
Expression[base, :+, [[val, :&, mask], :<<, shift]].encode(:u32, @endianness)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -35,5 +35,4 @@ class ARM < CPU
|
|||||||
init
|
init
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -416,4 +416,4 @@ end
|
|||||||
init_mips32
|
init_mips32
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -37,4 +37,4 @@ class ARM
|
|||||||
arg
|
arg
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1415,4 +1415,4 @@ module C
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1917,4 +1917,4 @@ puts " backtrace_indirection for #{ind.target} failed: #{ev}" if debug_backtra
|
|||||||
edata.ptr
|
edata.ptr
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -307,4 +307,4 @@ class CPU
|
|||||||
oplist.map { |op| encode_instr_op(program, i, op) }.flatten.each { |ed| ed.reloc.each_value { |v| v.backtrace = i.backtrace } }
|
oplist.map { |op| encode_instr_op(program, i, op) }.flatten.each { |ed| ed.reloc.each_value { |v| v.backtrace = i.backtrace } }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -284,4 +284,4 @@ class AOut < ExeFormat
|
|||||||
yield @data, tva + @text.virtsize
|
yield @data, tva + @text.virtsize
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -35,4 +35,4 @@ def self.orshellcode(cpu=Ia32.new)
|
|||||||
c
|
c
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -341,4 +341,4 @@ puts "String table: 0x%.8x .. 0x%.8x" % [offset, endoffset]
|
|||||||
offset += 1
|
offset += 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -750,4 +750,4 @@ class COFFArchive
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1030,4 +1030,4 @@ class COFF
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -597,5 +597,4 @@ typedef struct {
|
|||||||
#define SYMINFO_CURRENT 1
|
#define SYMINFO_CURRENT 1
|
||||||
#define SYMINFO_NUM 2
|
#define SYMINFO_NUM 2
|
||||||
|
|
||||||
P
|
P
|
||||||
|
|
||||||
@@ -722,4 +722,4 @@ class LoadedELF < ELF
|
|||||||
decode_program_header(@header.phoff+off)
|
decode_program_header(@header.phoff+off)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1227,4 +1227,4 @@ foo:
|
|||||||
call bla_plt
|
call bla_plt
|
||||||
ret
|
ret
|
||||||
foo_end:
|
foo_end:
|
||||||
EOS
|
EOS
|
||||||
@@ -169,4 +169,4 @@ class ExeFormat
|
|||||||
(val.kind_of?(Integer) ? (hash.find_all { |k, v| val & k == k and val &= ~k }.map { |k, v| v } << val) : val.kind_of?(Array) ? val.map { |e| int_to_hash(e, hash) } : [int_to_hash(val, hash)]) - [0]
|
(val.kind_of?(Integer) ? (hash.find_all { |k, v| val & k == k and val &= ~k }.map { |k, v| v } << val) : val.kind_of?(Array) ? val.map { |e| int_to_hash(e, hash) } : [int_to_hash(val, hash)]) - [0]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -182,4 +182,4 @@ class MZ < ExeFormat
|
|||||||
yield @body, 0
|
yield @body, 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -350,4 +350,4 @@ class LoadedPE < PE
|
|||||||
} if @imports
|
} if @imports
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -93,4 +93,4 @@ class Shellcode < ExeFormat
|
|||||||
c
|
c
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -269,4 +269,4 @@ class XCoff < ExeFormat
|
|||||||
@encoded.data
|
@encoded.data
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -369,4 +369,4 @@ class MainWindow < Gtk::Window
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1016,4 +1016,4 @@ class GraphViewWidget < Gtk::HBox
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -518,4 +518,4 @@ class AsmListingWidget < Gtk::HBox
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1274,4 +1274,4 @@ end
|
|||||||
CCompiler.new(parser, exe)
|
CCompiler.new(parser, exe)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -785,4 +785,4 @@ class Ia32
|
|||||||
f
|
f
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -294,4 +294,4 @@ class Ia32
|
|||||||
ret
|
ret
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -151,4 +151,4 @@ class Ia32 < CPU
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -784,4 +784,4 @@ class Ia32
|
|||||||
@opcode_list << op
|
@opcode_list << op
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -298,4 +298,4 @@ end
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -90,4 +90,4 @@ class Ia32
|
|||||||
h
|
h
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -943,4 +943,4 @@ class EncodedData
|
|||||||
self[from, content.length] = content
|
self[from, content.length] = content
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -4,4 +4,4 @@
|
|||||||
# Licence is LGPL, see LICENCE in the top-level directory
|
# Licence is LGPL, see LICENCE in the top-level directory
|
||||||
|
|
||||||
require 'metasm/mips/parse'
|
require 'metasm/mips/parse'
|
||||||
require 'metasm/compile_c'
|
require 'metasm/compile_c'
|
||||||
@@ -220,4 +220,4 @@ class MIPS
|
|||||||
df
|
df
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -47,4 +47,4 @@ class MIPS
|
|||||||
Expression[base, :+, [[val, :&, mask], :<<, shift]].encode(:u32, @endianness) << postdata
|
Expression[base, :+, [[val, :&, mask], :<<, shift]].encode(:u32, @endianness) << postdata
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -63,5 +63,4 @@ class MIPS < CPU
|
|||||||
send "init_#{family}"
|
send "init_#{family}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -435,4 +435,4 @@ end
|
|||||||
init_mips32
|
init_mips32
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -48,4 +48,4 @@ class MIPS
|
|||||||
arg
|
arg
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -40,4 +40,4 @@ class MIPS
|
|||||||
r
|
r
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -476,4 +476,4 @@ EOL
|
|||||||
list.each { |export| EXPORT[export] = curlibname }
|
list.each { |export| EXPORT[export] = curlibname }
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -225,4 +225,4 @@ class VirtualFile < VirtualString
|
|||||||
@fd.read(@length)
|
@fd.read(@length)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1067,5 +1067,4 @@ EOL
|
|||||||
list.each { |export| EXPORT[export] = curlibname }
|
list.each { |export| EXPORT[export] = curlibname }
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -745,4 +745,4 @@ class Expression
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -2970,4 +2970,4 @@ EOH
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -39,4 +39,4 @@ class Pic16c
|
|||||||
lookaside
|
lookaside
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -14,4 +14,4 @@ class Pic16c < CPU
|
|||||||
init
|
init
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -66,4 +66,4 @@ class Pic16c
|
|||||||
addop 'xorlw', 0b11_1010_0000_0000, :k
|
addop 'xorlw', 0b11_1010_0000_0000, :k
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1172,4 +1172,4 @@ class Preprocessor
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -74,4 +74,4 @@ class Expression
|
|||||||
[l, op, r].compact
|
[l, op, r].compact
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -55,4 +55,4 @@ def parse(root=false)
|
|||||||
end
|
end
|
||||||
|
|
||||||
$srch = ARGV.shift
|
$srch = ARGV.shift
|
||||||
puts parse
|
puts parse
|
||||||
@@ -71,4 +71,4 @@ loop do
|
|||||||
raise 'nomatch..'
|
raise 'nomatch..'
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -33,4 +33,4 @@ end
|
|||||||
|
|
||||||
if $0 == __FILE__
|
if $0 == __FILE__
|
||||||
File.open(ARGV.first, 'rb') { |fd| fd.read }.hexdump
|
File.open(ARGV.first, 'rb') { |fd| fd.read }.hexdump
|
||||||
end
|
end
|
||||||
@@ -7,4 +7,4 @@
|
|||||||
require 'metasm'
|
require 'metasm'
|
||||||
require 'metasm-shell'
|
require 'metasm-shell'
|
||||||
require 'pp'
|
require 'pp'
|
||||||
include Metasm
|
include Metasm
|
||||||
@@ -44,4 +44,4 @@ def Object.diff(o1, o2)
|
|||||||
else
|
else
|
||||||
[o1, o2]
|
[o1, o2]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -30,4 +30,4 @@ class Object
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -28,4 +28,4 @@ mov eax, 1
|
|||||||
mov ebx, 42
|
mov ebx, 42
|
||||||
int 80h // linux sys_exit
|
int 80h // linux sys_exit
|
||||||
ret
|
ret
|
||||||
EOS
|
EOS
|
||||||
@@ -46,4 +46,4 @@ edata.patch 'pre_pad', 'post_pad', newdata # replace the (beginning of the) seg
|
|||||||
|
|
||||||
edata.fixup 'kikoo' => 8, 'lol' => 42 # fixup the immediate values
|
edata.fixup 'kikoo' => 8, 'lol' => 42 # fixup the immediate values
|
||||||
|
|
||||||
p edata.data # show the resulting raw string
|
p edata.data # show the resulting raw string
|
||||||
@@ -18,4 +18,4 @@ puts cp, '', ' ----', ''
|
|||||||
cp = Metasm::C::Parser.parse src
|
cp = Metasm::C::Parser.parse src
|
||||||
cpu = Metasm::Ia32.new
|
cpu = Metasm::Ia32.new
|
||||||
cpu.generate_PIC = false
|
cpu.generate_PIC = false
|
||||||
puts cpu.new_ccompiler(cp).compile
|
puts cpu.new_ccompiler(cp).compile
|
||||||
@@ -52,4 +52,4 @@ puts 'end'
|
|||||||
else
|
else
|
||||||
# dump the full parsed header
|
# dump the full parsed header
|
||||||
puts cp.lexer.dump_macros(cp.lexer.definition.keys, false), '', '', cp
|
puts cp.lexer.dump_macros(cp.lexer.definition.keys, false), '', '', cp
|
||||||
end
|
end
|
||||||
@@ -32,4 +32,4 @@ db 0e9h
|
|||||||
toto:
|
toto:
|
||||||
mov eax, 28h
|
mov eax, 28h
|
||||||
|
|
||||||
EOS
|
EOS
|
||||||
@@ -315,4 +315,4 @@ end
|
|||||||
|
|
||||||
if $0 == __FILE__ and not ARGV.delete '--reload'
|
if $0 == __FILE__ and not ARGV.delete '--reload'
|
||||||
Viewer.new(ARGF.read).main_loop
|
Viewer.new(ARGF.read).main_loop
|
||||||
end
|
end
|
||||||
@@ -51,4 +51,4 @@ ep = ARGV.map { |arg| (?0..?9).include?(arg[0]) ? Integer(arg) : arg }
|
|||||||
w = Metasm::GtkGui::MainWindow.new("#{exename} - metasm disassembler").display(dasm, ep)
|
w = Metasm::GtkGui::MainWindow.new("#{exename} - metasm disassembler").display(dasm, ep)
|
||||||
w.dasm_widget.focus_addr ep.first if not ep.empty?
|
w.dasm_widget.focus_addr ep.first if not ep.empty?
|
||||||
w.signal_connect('destroy') { Gtk.main_quit }
|
w.signal_connect('destroy') { Gtk.main_quit }
|
||||||
Gtk.main
|
Gtk.main
|
||||||
@@ -88,4 +88,4 @@ todate = proc { |f|
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
puts "durations\n load #{todate[t1-t0]}\n dasm #{todate[t2-t1]}\n output #{todate[t3-t2]}\n total #{todate[t3-t0]}" if opts[:benchmark]
|
puts "durations\n load #{todate[t1-t0]}\n dasm #{todate[t2-t1]}\n output #{todate[t3-t2]}\n total #{todate[t3-t0]}" if opts[:benchmark]
|
||||||
@@ -87,4 +87,4 @@ end
|
|||||||
|
|
||||||
if __FILE__ == $0
|
if __FILE__ == $0
|
||||||
UPXUnpacker.new(ARGV.shift, ARGV.shift)
|
UPXUnpacker.new(ARGV.shift, ARGV.shift)
|
||||||
end
|
end
|
||||||
@@ -43,4 +43,4 @@ while src = todo.shift
|
|||||||
todo << File.join(path, dep)
|
todo << File.join(path, dep)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@@ -26,4 +26,4 @@ ARGV.each { |f|
|
|||||||
line << s
|
line << s
|
||||||
}
|
}
|
||||||
puts line if not line.empty?
|
puts line if not line.empty?
|
||||||
}
|
}
|
||||||
@@ -18,5 +18,4 @@ int main(void)
|
|||||||
{
|
{
|
||||||
printf("Hello, %s !\n", "world");
|
printf("Hello, %s !\n", "world");
|
||||||
exit(0x28);
|
exit(0x28);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,5 +40,4 @@ metasm_intern_geteip:
|
|||||||
1:
|
1:
|
||||||
pop eax
|
pop eax
|
||||||
add eax, metasm_intern_geteip - 1b
|
add eax, metasm_intern_geteip - 1b
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@@ -85,4 +85,4 @@ parser.parse 'void *fnptr[] = { ' + funcnames.map { |f| '&'+f }.join(', ') + ' }
|
|||||||
|
|
||||||
outfd = (opts[:outfile] ? File.open(opts[:outfile], 'w') : $stdout)
|
outfd = (opts[:outfile] ? File.open(opts[:outfile], 'w') : $stdout)
|
||||||
outfd.puts parser.factorize_final
|
outfd.puts parser.factorize_final
|
||||||
outfd.close
|
outfd.close
|
||||||
@@ -38,5 +38,4 @@ end
|
|||||||
|
|
||||||
# to trace only pp macros (using eg an asm source), use Preprocessor#factorize instead
|
# to trace only pp macros (using eg an asm source), use Preprocessor#factorize instead
|
||||||
|
|
||||||
puts Ia32.new.new_cparser.factorize(stub + File.read(file))
|
puts Ia32.new.new_cparser.factorize(stub + File.read(file))
|
||||||
|
|
||||||
@@ -784,4 +784,4 @@ if $0 == __FILE__
|
|||||||
end
|
end
|
||||||
|
|
||||||
LinDebug.new(Rubstop.new(ARGV.join(' '))).main_loop
|
LinDebug.new(Rubstop.new(ARGV.join(' '))).main_loop
|
||||||
end
|
end
|
||||||
@@ -64,4 +64,4 @@ end
|
|||||||
|
|
||||||
if $0 == __FILE__
|
if $0 == __FILE__
|
||||||
SyscallHooker.new(ARGV.shift.to_i).inject('write', 2, "testic\n", 7)
|
SyscallHooker.new(ARGV.shift.to_i).inject('write', 2, "testic\n", 7)
|
||||||
end
|
end
|
||||||
@@ -66,4 +66,4 @@ pe.sections << s
|
|||||||
pe.optheader.entrypoint = 'hook_entrypoint'
|
pe.optheader.entrypoint = 'hook_entrypoint'
|
||||||
|
|
||||||
# save
|
# save
|
||||||
pe.encode_file(target.sub(/\.exe$/i, '-patch.exe'))
|
pe.encode_file(target.sub(/\.exe$/i, '-patch.exe'))
|
||||||
@@ -200,4 +200,4 @@ int main(void)
|
|||||||
printf("\n brandstring: \"%.48s\"\n", brandstring);
|
printf("\n brandstring: \"%.48s\"\n", brandstring);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -31,5 +31,4 @@ nop
|
|||||||
.import 'foobar' 'baz'
|
.import 'foobar' 'baz'
|
||||||
EOS
|
EOS
|
||||||
prog.header.machine='R4000'
|
prog.header.machine='R4000'
|
||||||
data = prog.encode_file 'mipspe.exe'
|
data = prog.encode_file 'mipspe.exe'
|
||||||
|
|
||||||
@@ -75,4 +75,4 @@ struct _TOKEN_PRIVILEGES {
|
|||||||
};
|
};
|
||||||
typedef struct _TOKEN_PRIVILEGES *PTOKEN_PRIVILEGES;
|
typedef struct _TOKEN_PRIVILEGES *PTOKEN_PRIVILEGES;
|
||||||
typedef struct _TOKEN_PRIVILEGES TOKEN_PRIVILEGES;
|
typedef struct _TOKEN_PRIVILEGES TOKEN_PRIVILEGES;
|
||||||
BOOL AdjustTokenPrivileges __attribute__((dllimport)) __attribute__((stdcall))(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength);
|
BOOL AdjustTokenPrivileges __attribute__((dllimport)) __attribute__((stdcall))(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength);
|
||||||
@@ -48,4 +48,4 @@ title db 'bar', 0
|
|||||||
.export foobar
|
.export foobar
|
||||||
.libname 'pe-foolib'
|
.libname 'pe-foolib'
|
||||||
EOS
|
EOS
|
||||||
dll.encode_file('pe-foolib.dll', 'dll')
|
dll.encode_file('pe-foolib.dll', 'dll')
|
||||||
@@ -21,4 +21,4 @@ EOS
|
|||||||
rsrc = { 1 => { 1 => { 2 => 'xxx' }, 'toto' => { 12 => 'tata' } } }
|
rsrc = { 1 => { 1 => { 2 => 'xxx' }, 'toto' => { 12 => 'tata' } } }
|
||||||
pe.resource = Metasm::COFF::ResourceDirectory.from_hash rsrc
|
pe.resource = Metasm::COFF::ResourceDirectory.from_hash rsrc
|
||||||
|
|
||||||
pe.encode_file('pe-testrsrc.exe')
|
pe.encode_file('pe-testrsrc.exe')
|
||||||
@@ -28,4 +28,4 @@ ARGV.each { |f|
|
|||||||
line << e
|
line << e
|
||||||
}
|
}
|
||||||
puts line if not line.empty?
|
puts line if not line.empty?
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user