Code cleanups

git-svn-id: file:///home/svn/framework3/trunk@5773 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
Ramon de C Valle
2008-10-19 21:03:39 +00:00
parent 4c847e0d44
commit f124597a56
1264 changed files with 1264 additions and 2079 deletions
+1 -1
View File
@@ -19,4 +19,4 @@ require 'bindata/struct'
#
module BinData
VERSION = "0.9.2-eofpatch" # Temporary fork for PacketFu.
end
end
+1 -1
View File
@@ -327,4 +327,4 @@ module BinData
element
end
end
end
end
+1 -1
View File
@@ -377,4 +377,4 @@ module BinData
# End To be implemented by subclasses
###########################################################################
end
end
end
+1 -1
View File
@@ -804,4 +804,4 @@ module BinData
register(self.name, self)
BitField.create_methods(self, 63, :little)
end
end
end
+1 -1
View File
@@ -160,4 +160,4 @@ module BinData
obj
end
end
end
end
+1 -1
View File
@@ -85,4 +85,4 @@ module BinData
register(self.name, self)
Float.create_float_methods(self, false, :big)
end
end
end
+1 -1
View File
@@ -182,4 +182,4 @@ module BinData
register(self.name, self)
Integer.create_int_methods(self, 64, :big)
end
end
end
+1 -1
View File
@@ -189,4 +189,4 @@ module BinData
alias_method :flush, :flushbits
end
end
end
+1 -1
View File
@@ -108,4 +108,4 @@ module BinData
end
end
end
end
end
+1 -1
View File
@@ -131,4 +131,4 @@ module BinData
end
end
end
end
end
+1 -1
View File
@@ -338,4 +338,4 @@ module BinData
@element_list.pop
end
end
end
end
+1 -1
View File
@@ -39,4 +39,4 @@ module BinData
@registry[name.to_s]
end
end
end
end
+1 -1
View File
@@ -38,4 +38,4 @@ module BinData
""
end
end
end
end
+1 -2
View File
@@ -117,5 +117,4 @@ module BinData
def_delegators :@hash, :[], :has_key?, :include?, :keys
end
end
end
+1 -1
View File
@@ -174,4 +174,4 @@ module BinData
# To be implemented by subclasses
###########################################################################
end
end
end
+1 -1
View File
@@ -191,4 +191,4 @@ module BinData
# To be implemented by subclasses
###########################################################################
end
end
end
+1 -1
View File
@@ -112,4 +112,4 @@ module BinData
""
end
end
end
end
+1 -1
View File
@@ -95,4 +95,4 @@ module BinData
result
end
end
end
end
+1 -1
View File
@@ -380,4 +380,4 @@ module BinData
hash
end
end
end
end
+1 -1
View File
@@ -1 +1 @@
require 'metasm/metasm'
require 'metasm/metasm'
+1 -1
View File
@@ -67,4 +67,4 @@ end
if __FILE__ == $0
asm
end
end
+1 -1
View File
@@ -33,4 +33,4 @@ require 'metasm/parse_c'
require 'metasm/compile_c'
# cleanup include path
$:.delete metasmdir if metasmdir
$:.delete metasmdir if metasmdir
+1 -1
View File
@@ -37,4 +37,4 @@ class MIPS
Expression[base, :+, [[val, :&, mask], :<<, shift]].encode(:u32, @endianness)
end
end
end
end
+1 -2
View File
@@ -35,5 +35,4 @@ class ARM < CPU
init
end
end
end
end
+1 -1
View File
@@ -416,4 +416,4 @@ end
init_mips32
end
end
end
+1 -1
View File
@@ -37,4 +37,4 @@ class ARM
arg
end
end
end
end
+1 -1
View File
@@ -1415,4 +1415,4 @@ module C
end
end
end
end
end
+1 -1
View File
@@ -1917,4 +1917,4 @@ puts " backtrace_indirection for #{ind.target} failed: #{ev}" if debug_backtra
edata.ptr
end
end
end
end
+1 -1
View File
@@ -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 } }
end
end
end
end
+1 -1
View File
@@ -284,4 +284,4 @@ class AOut < ExeFormat
yield @data, tva + @text.virtsize
end
end
end
end
+1 -1
View File
@@ -35,4 +35,4 @@ def self.orshellcode(cpu=Ia32.new)
c
end
end
end
end
+1 -1
View File
@@ -341,4 +341,4 @@ puts "String table: 0x%.8x .. 0x%.8x" % [offset, endoffset]
offset += 1
end
end
end
end
+1 -1
View File
@@ -750,4 +750,4 @@ class COFFArchive
}
end
end
end
end
+1 -1
View File
@@ -1030,4 +1030,4 @@ class COFF
}
end
end
end
end
+1 -2
View File
@@ -597,5 +597,4 @@ typedef struct {
#define SYMINFO_CURRENT 1
#define SYMINFO_NUM 2
P
P
+1 -1
View File
@@ -722,4 +722,4 @@ class LoadedELF < ELF
decode_program_header(@header.phoff+off)
end
end
end
end
+1 -1
View File
@@ -1227,4 +1227,4 @@ foo:
call bla_plt
ret
foo_end:
EOS
EOS
+1 -1
View File
@@ -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]
end
end
end
end
+1 -1
View File
@@ -182,4 +182,4 @@ class MZ < ExeFormat
yield @body, 0
end
end
end
end
+1 -1
View File
@@ -350,4 +350,4 @@ class LoadedPE < PE
} if @imports
end
end
end
end
+1 -1
View File
@@ -93,4 +93,4 @@ class Shellcode < ExeFormat
c
end
end
end
end
+1 -1
View File
@@ -269,4 +269,4 @@ class XCoff < ExeFormat
@encoded.data
end
end
end
end
+1 -1
View File
@@ -369,4 +369,4 @@ class MainWindow < Gtk::Window
end
end
end
end
+1 -1
View File
@@ -1016,4 +1016,4 @@ class GraphViewWidget < Gtk::HBox
end
end
end
end
end
+1 -1
View File
@@ -518,4 +518,4 @@ class AsmListingWidget < Gtk::HBox
end
end
end
end
end
+1 -1
View File
@@ -1274,4 +1274,4 @@ end
CCompiler.new(parser, exe)
end
end
end
end
+1 -1
View File
@@ -785,4 +785,4 @@ class Ia32
f
end
end
end
end
+1 -1
View File
@@ -294,4 +294,4 @@ class Ia32
ret
end
end
end
end
+1 -1
View File
@@ -151,4 +151,4 @@ class Ia32 < CPU
end
end
end
end
+1 -1
View File
@@ -784,4 +784,4 @@ class Ia32
@opcode_list << op
end
end
end
end
+1 -1
View File
@@ -298,4 +298,4 @@ end
end
end
end
end
end
+1 -1
View File
@@ -90,4 +90,4 @@ class Ia32
h
end
end
end
end
+1 -1
View File
@@ -943,4 +943,4 @@ class EncodedData
self[from, content.length] = content
end
end
end
end
+1 -1
View File
@@ -4,4 +4,4 @@
# Licence is LGPL, see LICENCE in the top-level directory
require 'metasm/mips/parse'
require 'metasm/compile_c'
require 'metasm/compile_c'
+1 -1
View File
@@ -220,4 +220,4 @@ class MIPS
df
end
end
end
end
+1 -1
View File
@@ -47,4 +47,4 @@ class MIPS
Expression[base, :+, [[val, :&, mask], :<<, shift]].encode(:u32, @endianness) << postdata
end
end
end
end
+1 -2
View File
@@ -63,5 +63,4 @@ class MIPS < CPU
send "init_#{family}"
end
end
end
end
+1 -1
View File
@@ -435,4 +435,4 @@ end
init_mips32
end
end
end
+1 -1
View File
@@ -48,4 +48,4 @@ class MIPS
arg
end
end
end
end
+1 -1
View File
@@ -40,4 +40,4 @@ class MIPS
r
end
end
end
end
+1 -1
View File
@@ -476,4 +476,4 @@ EOL
list.each { |export| EXPORT[export] = curlibname }
}
end
end
end
+1 -1
View File
@@ -225,4 +225,4 @@ class VirtualFile < VirtualString
@fd.read(@length)
end
end
end
end
+1 -2
View File
@@ -1067,5 +1067,4 @@ EOL
list.each { |export| EXPORT[export] = curlibname }
}
end
end
end
+1 -1
View File
@@ -745,4 +745,4 @@ class Expression
end
end
end
end
end
+1 -1
View File
@@ -2970,4 +2970,4 @@ EOH
end
end
end
end
end
+1 -1
View File
@@ -39,4 +39,4 @@ class Pic16c
lookaside
end
end
end
end
+1 -1
View File
@@ -14,4 +14,4 @@ class Pic16c < CPU
init
end
end
end
end
+1 -1
View File
@@ -66,4 +66,4 @@ class Pic16c
addop 'xorlw', 0b11_1010_0000_0000, :k
end
end
end
end
+1 -1
View File
@@ -1172,4 +1172,4 @@ class Preprocessor
end
end
end
end
end
+1 -1
View File
@@ -74,4 +74,4 @@ class Expression
[l, op, r].compact
end
end
end
end
+1 -1
View File
@@ -55,4 +55,4 @@ def parse(root=false)
end
$srch = ARGV.shift
puts parse
puts parse
+1 -1
View File
@@ -71,4 +71,4 @@ loop do
raise 'nomatch..'
}
end
end
end
+1 -1
View File
@@ -33,4 +33,4 @@ end
if $0 == __FILE__
File.open(ARGV.first, 'rb') { |fd| fd.read }.hexdump
end
end
+1 -1
View File
@@ -7,4 +7,4 @@
require 'metasm'
require 'metasm-shell'
require 'pp'
include Metasm
include Metasm
+1 -1
View File
@@ -44,4 +44,4 @@ def Object.diff(o1, o2)
else
[o1, o2]
end
end
end
+1 -1
View File
@@ -30,4 +30,4 @@ class Object
end
}
end
end
end
+1 -1
View File
@@ -28,4 +28,4 @@ mov eax, 1
mov ebx, 42
int 80h // linux sys_exit
ret
EOS
EOS
+1 -1
View File
@@ -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
p edata.data # show the resulting raw string
p edata.data # show the resulting raw string
+1 -1
View File
@@ -18,4 +18,4 @@ puts cp, '', ' ----', ''
cp = Metasm::C::Parser.parse src
cpu = Metasm::Ia32.new
cpu.generate_PIC = false
puts cpu.new_ccompiler(cp).compile
puts cpu.new_ccompiler(cp).compile
@@ -52,4 +52,4 @@ puts 'end'
else
# dump the full parsed header
puts cp.lexer.dump_macros(cp.lexer.definition.keys, false), '', '', cp
end
end
+1 -1
View File
@@ -32,4 +32,4 @@ db 0e9h
toto:
mov eax, 28h
EOS
EOS
+1 -1
View File
@@ -315,4 +315,4 @@ end
if $0 == __FILE__ and not ARGV.delete '--reload'
Viewer.new(ARGF.read).main_loop
end
end
+1 -1
View File
@@ -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.dasm_widget.focus_addr ep.first if not ep.empty?
w.signal_connect('destroy') { Gtk.main_quit }
Gtk.main
Gtk.main
+1 -1
View File
@@ -88,4 +88,4 @@ todate = proc { |f|
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]
+1 -1
View File
@@ -87,4 +87,4 @@ end
if __FILE__ == $0
UPXUnpacker.new(ARGV.shift, ARGV.shift)
end
end
+1 -1
View File
@@ -43,4 +43,4 @@ while src = todo.shift
todo << File.join(path, dep)
end
}
end
end
+1 -1
View File
@@ -26,4 +26,4 @@ ARGV.each { |f|
line << s
}
puts line if not line.empty?
}
}
+1 -2
View File
@@ -18,5 +18,4 @@ int main(void)
{
printf("Hello, %s !\n", "world");
exit(0x28);
}
}
+1 -2
View File
@@ -40,5 +40,4 @@ metasm_intern_geteip:
1:
pop eax
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.puts parser.factorize_final
outfd.close
outfd.close
+1 -2
View File
@@ -38,5 +38,4 @@ end
# 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))
+1 -1
View File
@@ -784,4 +784,4 @@ if $0 == __FILE__
end
LinDebug.new(Rubstop.new(ARGV.join(' '))).main_loop
end
end
+1 -1
View File
@@ -64,4 +64,4 @@ end
if $0 == __FILE__
SyscallHooker.new(ARGV.shift.to_i).inject('write', 2, "testic\n", 7)
end
end
+1 -1
View File
@@ -66,4 +66,4 @@ pe.sections << s
pe.optheader.entrypoint = 'hook_entrypoint'
# save
pe.encode_file(target.sub(/\.exe$/i, '-patch.exe'))
pe.encode_file(target.sub(/\.exe$/i, '-patch.exe'))
+1 -1
View File
@@ -200,4 +200,4 @@ int main(void)
printf("\n brandstring: \"%.48s\"\n", brandstring);
return 0;
}
}
+1 -2
View File
@@ -31,5 +31,4 @@ nop
.import 'foobar' 'baz'
EOS
prog.header.machine='R4000'
data = prog.encode_file 'mipspe.exe'
data = prog.encode_file 'mipspe.exe'
+1 -1
View File
@@ -75,4 +75,4 @@ struct _TOKEN_PRIVILEGES {
};
typedef struct _TOKEN_PRIVILEGES *PTOKEN_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);
+1 -1
View File
@@ -48,4 +48,4 @@ title db 'bar', 0
.export foobar
.libname 'pe-foolib'
EOS
dll.encode_file('pe-foolib.dll', 'dll')
dll.encode_file('pe-foolib.dll', 'dll')
+1 -1
View File
@@ -21,4 +21,4 @@ EOS
rsrc = { 1 => { 1 => { 2 => 'xxx' }, 'toto' => { 12 => 'tata' } } }
pe.resource = Metasm::COFF::ResourceDirectory.from_hash rsrc
pe.encode_file('pe-testrsrc.exe')
pe.encode_file('pe-testrsrc.exe')
+1 -1
View File
@@ -28,4 +28,4 @@ ARGV.each { |f|
line << e
}
puts line if not line.empty?
}
}

Some files were not shown because too many files have changed in this diff Show More