Class: BytesCode
- Inherits:
-
Object
- Object
- BytesCode
- Defined in:
- lib/BytesCode.rb
Class Method Summary collapse
Class Method Details
.countdown(shellcode) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/BytesCode.rb', line 7 def self.countdown(shellcode) shellcode_array = shellcode.split('\x') = ["00", "FF", "0D", "0A", "ff", "0d", "0a"] final_rez = [] shellcode_array.each do |bytes| .each do |no_auth| if bytes == no_auth shellcode_array.delete(bytes) end end end shellcode_array.each do |octet| if octet != "" final_rez << "\\x#{octet}" end end return final_rez.join end |
.to_opcode(file, countdown = false) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/BytesCode.rb', line 30 def self.to_opcode(file, countdown=false) if(File.file?(file) == false) raise FileError, "#{file} => File not found" end cmd = `objdump -d #{file} | grep "^ "|cut -f2` cmd_to_a = cmd.split(/\n/) testt = cmd_to_a.join("").split(" ") final_res = [] testt.each do |data| final_res << "\\x#{data}" end if(countdown == false) return final_res.join else return self.countdown(final_res.join) end end |