code
stringlengths
1
1.73M
language
stringclasses
1 value
require 'sinatra/activerecord/rake' require './main'
Ruby
source :gemcutter gem 'sinatra', :require => 'sinatra/base' gem 'thin', '~> 1.3' gem 'pg' gem 'sinatra-activerecord' gem 'google-api-client', '>= 0.4.4', :require => 'google/api_client' group :development do gem 'rake' gem 'sqlite3-ruby' end
Ruby
class CreateUsers < ActiveRecord::Migration def up create_table :users do |t| t.string :profile_id t.string :email t.string :refresh_token end add_index :users, :profile_id end def down drop_table :users end end
Ruby
# Copyright (C) 2012 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Ruby
require 'sinatra.rb' # Sinatra defines #set at the top level as a way to set application configuration set :run, false set :env, (ENV['RACK_ENV'] ? ENV['RACK_ENV'].to_sym : :development) require './main' run Sinatra::Application
Ruby
$LOAD_PATH.unshift File.join(File.dirname(__FILE__),'../..','ext_pr1/lib') require 'ext_pr1_v4' ##################################################################### #Typen 1d-Objekte # def range1d?(o) o.int_range? end def shape1d?(o) range1d?(o) or o.union1d? end # Union1d :: (left,right) # Shape1d x Shape1d def_cla...
Ruby
$LOAD_PATH.unshift File.join(File.dirname(__FILE__),'../..','ext_pr1/lib') require 'ext_pr1_v4' #Konstanten MIN_IN_SEC = 60 HOUR_IN_MIN = 60 HOURS_OF_DAY = 24 HOURS_OF_HALF_DAY = HOURS_OF_DAY/2 HOUR_IN_SEC = MIN_IN_SEC * HOUR_IN_MIN DAY_IN_SEC = HOUR_IN_SEC * HOURS_OF_DAY #Typ-Prädikate def hour24?(value) (val...
Ruby
# To change this template, choose Tools | Templates # and open the template in the editor. $:.unshift File.join(File.dirname(__FILE__),'..','lib') require 'test/unit' require 'graphics' class Test_Graphics < Test::Unit::TestCase ##################################################################### #Typen 1d-Objekte ...
Ruby
$LOAD_PATH.unshift File.join(File.dirname(__FILE__),'../..','ext_pr1/lib') require 'ext_pr1_v4' # Volumenberechnung für Zylinder # v_Zylinder ::= (r, h) :: # float x float =>? float::::(r>=0.0 and h>=0.0) # Formel: g * h # g = r * pi ^ 2 # Testfälle # r h v # 0,0 0,0 0,0 # 0,0 1,0 0,0 # 1,0 0,...
Ruby
$LOAD_PATH.unshift File.join(File.dirname(__FILE__),'../..','ext_pr1/lib') require 'ext_pr1_v4' # Clock # Digitalclock with options to update the min, sec and hours # The clock returns a array and shows in 12 or 24 hours mode # # add_clock ::= (act_clock, delta, mode) :: # set of array [int,int,int] x [int,int,int] x ...
Ruby
$LOAD_PATH.unshift File.join(File.dirname(__FILE__),'../..','ext_pr1/lib') require 'ext_pr1_v4' # Fläche eines Pentagondodekaeders # plain_pentagondodecahedron ::= (length) :: # float => float # Testfälle # {2.0 => 82.58291522, 3 => 185.8115592, 78 = > 125608.6140} CONST=3.0*Math.sqrt(25.0+(Math.sqrt(5.0)*10.0)) d...
Ruby
$LOAD_PATH.unshift File.join(File.dirname(__FILE__),'../..','ext_pr1/lib') require 'ext_pr1_v4' #Erweiterung für Hyperwürfel # nCube ::= (value, dimension) :: # nat x nat =>? nat # Testfälle # { 0,0=>1, 2,1=>2, 2,2=>4, 2,3=>8, 2,4=>16 # -1,-1=>err, 'a',2=>err, 2,'a'=>err } def nCube(v, d) check_pre(( (v.nat?...
Ruby
# Aufgabe 1 # Beispiel Template für eine Spezifikation # Funktionsname ::= (Wert,Wert,Wert,...) :: # nat x nat => nat (Eingangs Typ, Eingangs Typ => return Typ) :::: Einschränkung # Beispiele{ # #### Immer alle Beispiele angeben #} # Differenz zweier Würfel # hollow_cube_volume ::= (l_outer, l_inner) :: # ...
Ruby
$LOAD_PATH.unshift File.join(File.dirname(__FILE__),'../..','ext_pr1/lib') require 'ext_pr1_v4' class Object def range1d?() false end def range2d?() false end def int?() false end def point?() false end def shape?() false end def union?() false end def graphicobj?() fal...
Ruby
$LOAD_PATH.unshift File.join(File.dirname(__FILE__),'../..','ext_pr1/lib') require 'ext_pr1_v4' class Object def clock?() false end def clock_sec?() false end def clock_12?() false end def clock_24?() false end def clock_am?() false end def clock_pm?() false end def sec_day?() false end ...
Ruby
$:.unshift File.join(File.dirname(__FILE__),'..','lib') require 'test/unit' require 'graphics_oop' class Test_Graphics < Test::Unit::TestCase def test_point() assert_equal(Point2d[0,0],Point2d[0,0]) assert_equal(2,Point2d[2,1].first) assert_equal(1,Point2d[2,1].last) assert_equal(true,Point...
Ruby
# EXTENSIONS FOR PR1 Jan. 2012 # ============================ # Michael Böhm 19.01.12 require "ext_checks_v1" require "ext_elems_v2" require "ext_modules_v2" require "ext_lists_v2" # INSTALLING THE EXTENSIONS # ========================= # create a new project with name 'ext_pr1' # copy the extension files to the sour...
Ruby
# EXTENSIONS FOR LINKED LISTS V1 # ============================== # Michael Boehm, 19.01.12 require 'set' require 'singleton' class Array def to_l() List[*self] end end class Set def to_l() List[*(self.to_a)] end def set?; true end end # DEFINITION OF LINKED LISTS # these are immutable lists # Li...
Ruby
# EXTENSIONS FOR ELEMENTARY TYPES V1 # ================================== # Michael Boehm, 19.01.12 #require 'Set' # EXTENSIONS TO OBJECT # # COMPACT DEFINITION OF HOOK-METHODS IN OBJECT FOR TYPE-PREDICATES # type predicates should be compact and defined for all objects (total on Object) # this requires a la...
Ruby
# GLOBAL FUNCTIONS FOR ASSERTION CHECKING V1 # ========================================== # Michael Boehm, 24.10.11 # ASSERTION CHECKING # ================== # All functions for assertion checking are based on this principle: # they consume # # a value expression (or|and) # a logical expression and # ...
Ruby
# EXTENSIONS TO STRUCTURE AND TO MODULE # ===================================== # Michael Boehm, 29.11.11 #EXTENSIONS TO STRUCTURE #======================= # # a method to define a class (e.g. Range2d), which does all what a structure definition does, plus # # definition of a standard type predicate total on O...
Ruby
# EXTENSIONS TO STRUCTURE AND TO MODULE # ===================================== # Michael Boehm, 24.10.11 #EXTENSIONS TO STRUCTURE #======================= # # a method to define a class, which does all what a structure definition does, plus # # definition of a standard type predicate total on Object # # de...
Ruby
$LOAD_PATH.unshift File.join(File.dirname(__FILE__),'../..','ext_pr1/lib') require 'ext_pr1_v4' ##################################################################### # Summe # # Summiert alle zahlen von 1 bis n # sum :: (LetzterSummand) :::: # INT -> INT # Beispiele # 1 => 1, 2 => 3, 3 => 6 def sum(n) ch...
Ruby
$LOAD_PATH.unshift File.join(File.dirname(__FILE__),'../..','ext_pr1/lib') require 'ext_pr1_v4' # function returning the min-value of a pair of two int-Values # min_int :: (val1,val2) :: # INT X INT => INT :::: # # Examples # min_int(10,20) => 10 # min_int(20,10) => 10 # min_int(20,20) => 20 # min_int(-1,10) => -...
Ruby
$LOAD_PATH.unshift File.join(File.dirname(__FILE__),'../..','ext_pr1/lib') require 'ext_pr1_v4' require 'Aufgabe_2' # Konstante Funktionen def square(v) v*v end # Funktion zum ermitteln der Summe der Quadrate der beiden größten Werte aus 3 # larger_sum_square :: (val1, val2, val3) # INT x INT x INT =>? NAT # # Test...
Ruby
$LOAD_PATH.unshift File.join(File.dirname(__FILE__),'../..','ext_pr1/lib') require 'ext_pr1_v4' require 'Aufgabe_2' # Konstanten def untere_temperatur_schwelle() 18 end def obere_temperatur_schwelle() 25 end # Function checks if temperature is too low # zu_kalt? :: (temp) # INT => BOOL # # Examples # zu_kalt?(17)...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory module Metasm # root directory for metasm files # used by some scripts, eg to find samples/dasm-plugin directory Metasmdir = File.dirname(...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory # This sample creates the dynldr.so ruby shared object that allows interaction with # native libraries # x86 only for now module Metasm class...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/main' require 'metasm/preprocessor' module Metasm class Data # keywords for data definition (used to recognize label names)...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory module Metasm # this class implements a high-level debugging API (abstract superclass) class Debugger class Breakpoint attr_accessor :addre...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/main' module Metasm # A source text preprocessor (C-like) # defines the methods nexttok, readtok and unreadtok # they spits...
Ruby
backend = ENV['METASM_GUI'] || ( if RUBY_PLATFORM =~ /(i.86|x(86_)?64)-(mswin|mingw|cygwin)/i 'win32' else begin require 'gtk2' 'gtk' rescue LoadError raise LoadError, 'No GUI ruby binding installed - please install libgtk2-ruby' end end ) require "metasm/gui/#{backend}"
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory module Metasm VERSION = 0x0001 # major major minor minor # superclass for all metasm exceptions class Exception < RuntimeError ; end # pars...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory # this file compliments disassemble.rb, adding misc user-friendly methods module Metasm class InstructionBlock # adds an address to the from...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/main' require 'metasm/decode' require 'metasm/parse_c' module Metasm class C::Variable; attr_accessor :stackoff; end class C...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'gtk2' module Metasm module Gui module Protect @@lasterror = Time.now def protect yield rescue Object puts $!.message, $!.ba...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory module Metasm module Gui class CStructWidget < DrawableWidget attr_accessor :dasm, :view_x, :view_y def initialize_widget(dasm, parent_widg...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/gui/dasm_main' module Metasm module Gui # TODO invalidate dbg.disassembler on selfmodifying code class DbgWidget < Container...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'Qt4' module Metasm module Gui module Protect @@lasterror = Time.now def protect yield rescue Object puts $!.message, $!.bac...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory module Metasm module Gui class HexWidget < DrawableWidget # data_size = size of data in bytes (1 => chars, 4 => dwords..) # line_size = nr o...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory module Metasm module Gui class AsmOpcodeWidget < DrawableWidget attr_accessor :dasm # nr of raw data bytes to display next to decoded instru...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory module Metasm module Gui class CoverageWidget < DrawableWidget attr_accessor :dasm, :sections, :pixel_w, :pixel_h # TODO wheel -> zoom, dra...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/dynldr' module Metasm module Gui class Win32Gui < DynLdr new_api_c <<EOS #line #{__LINE__} typedef char CHAR; typedef unsign...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/dynldr' module Metasm module Gui class XGui < DynLdr new_api_c <<EOS, 'libX11.so' #define KeyPressMask (1...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory module Metasm module Gui class Graph # one box, has a text, an id, and a list of other boxes to/from class Box attr_accessor :id, :x, :y, ...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/gui/dasm_graph' module Metasm module Gui class FuncGraphViewWidget < GraphViewWidget # :full / :from / :to / :both # :from ...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory module Metasm module Gui class AsmListingWidget < DrawableWidget attr_accessor :dasm, :arrow_zone_w # nr of raw bytes to display next to eac...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/gui/dasm_hex' require 'metasm/gui/dasm_listing' require 'metasm/gui/dasm_opcodes' require 'metasm/gui/dasm_coverage' require ...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory module Metasm module Gui class CdecompListingWidget < DrawableWidget attr_accessor :dasm, :curaddr, :tabwidth def initialize_widget(dasm, p...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/main' require 'metasm/preprocessor' module Metasm # c parser # inspired from http://www.math.grin.edu/~stone/courses/languag...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/main' module Metasm class ExeFormat # encodes an Array of source (Label/Data/Instruction etc) to an EncodedData # resolves...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/main' require 'metasm/parse_c' module Metasm module C class Parser def precompile @toplevel.precompile(Compiler.new(se...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/main' require 'metasm/cpu/cy16/decode' require 'metasm/cpu/cy16/render'
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/ia32/opcodes' require 'metasm/cpu/ia32/encode' require 'metasm/parse' module Metasm class Ia32 class ModRM # may return...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/ia32/opcodes' module Metasm class Ia32 def dbg_register_pc @dbg_register_pc ||= :eip end def dbg_register_sp @dbg...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/main' module Metasm # The ia32 aka x86 CPU # currently limited to 16 and 32bit modes class Ia32 < CPU # some ruby magic t...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/ia32/main' module Metasm class Ia32 # temporarily setup dasm.address_binding so that backtracking # stack-related offs...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/ia32/opcodes' require 'metasm/encode' module Metasm class Ia32 class InvalidModRM < Exception ; end class ModRM # re...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/ia32/parse' require 'metasm/compile_c' module Metasm class Ia32 class CCompiler < C::Compiler # holds compiler state in...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/ia32/main' module Metasm class Ia32 def init_cpu_constants @opcode_list ||= [] @fields_mask.update :w => 1, :s => 1...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/ia32/opcodes' require 'metasm/render' # XXX move context in another file ? module Metasm class Ia32 class Argument in...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/ia32/opcodes' require 'metasm/decode' module Metasm class Ia32 class ModRM def self.decode(edata, byte, endianness, a...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/x86_64/opcodes' require 'metasm/cpu/x86_64/encode' require 'metasm/parse' module Metasm class X86_64 def parse_parser_i...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/x86_64/opcodes' module Metasm class X86_64 def dbg_register_pc @dbg_register_pc ||= :rip end def dbg_register_flags...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/main' require 'metasm/cpu/ia32' module Metasm # The x86_64, 64-bit extension of the x86 CPU (x64, em64t, amd64...) class X8...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/x86_64/opcodes' require 'metasm/encode' module Metasm class X86_64 class ModRM def self.encode_reg(reg, mregval = 0) ...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/x86_64/parse' require 'metasm/compile_c' module Metasm class X86_64 class CCompiler < C::Compiler # holds compiler stat...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/x86_64/main' require 'metasm/cpu/ia32/opcodes' module Metasm class X86_64 def init_cpu_constants super() [:i32, :u3...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/x86_64/opcodes' require 'metasm/render' module Metasm class X86_64 def gui_hilight_word_regexp_init ret = {} %w[a ...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/x86_64/opcodes' require 'metasm/decode' module Metasm class X86_64 class ModRM def self.decode(edata, byte, endiannes...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2010 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/main' module Metasm class Sh4 < CPU def initialize(e = :little, transfersz = 0, fpprecision = 0) super() @endianness = ...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2010 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/sh4/main' module Metasm class Sh4 def addop(name, bin, *args) o = Opcode.new name, bin args.each { |a| o.args <<...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2010 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/sh4/opcodes' require 'metasm/decode' module Metasm class Sh4 def build_opcode_bin_mask(op) op.bin_mask = 0 op.args.e...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory class Metasm::Dalvik < Metasm::CPU end require 'metasm/main' require 'metasm/cpu/dalvik/decode'
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/main' module Metasm class CY16 < CPU class Reg class << self attr_accessor :s_to_i, :i_to_s end @i_to_s = (0..14)....
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/cy16/main' module Metasm class CY16 def addop(name, bin, *args) o = Opcode.new name, bin args.each { |a| o.args ...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/cy16/opcodes' require 'metasm/render' module Metasm class CY16 class Reg include Renderable def render ; [self.clas...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/cy16/opcodes' require 'metasm/decode' module Metasm class CY16 def build_opcode_bin_mask(op) # bit = 0 if can be muta...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory # fix autorequire warning class Metasm::Ia32 < Metasm::CPU end require 'metasm/main' require 'metasm/cpu/ia32/parse' require 'metasm/cpu/ia32...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2010 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/main' module Metasm class Python < CPU def initialize(prog = nil) super() @program = prog @endianness = (prog.respond_...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2010 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/python/main' module Metasm class Python CMP_OP = %w[< <= == != > >= in not_in is is_not exch] def addop(name, bin, *ar...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2010 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/python/opcodes' require 'metasm/decode' module Metasm class Python def build_bin_lookaside opcode_list.inject({}) { |l...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/main' module Metasm class Pic16c < CPU def initialize(endianness = :big) super() @endianness = endianness init end e...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/pic16c/main' module Metasm class Pic16c def addop(name, bin, *l) o = Opcode.new name, bin l.each { |ll| if @prop...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/pic16c/opcodes' require 'metasm/decode' module Metasm class Pic16c def build_opcode_bin_mask(op) # bit = 0 if can be ...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/ppc/opcodes' require 'metasm/parse' module Metasm class PowerPC # TODO def parse_arg_valid?(op, sym, arg) # special c...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/main' require 'metasm/render' module Metasm class PowerPC < CPU class Reg include Renderable def ==(o) o.class == s...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/ppc/main' module Metasm class PowerPC # temporarily setup dasm.address_binding so that backtracking # stack-related of...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/ppc/opcodes' require 'metasm/encode' module Metasm class PowerPC private def encode_instr_op(exe, instr, op) base = ...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/ppc/main' module Metasm class PowerPC def addop(name, bin, *argprops) o = Opcode.new name, bin argprops.each { |a|...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/ppc/opcodes' require 'metasm/decode' module Metasm class PowerPC def build_opcode_bin_mask(op) # bit = 0 if can be mu...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory class Metasm::ARM < Metasm::CPU end require 'metasm/main' require 'metasm/cpu/arm/parse' require 'metasm/cpu/arm/encode' require 'metasm/cpu/...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2010 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/main' require 'metasm/cpu/arc/decode'
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/arm/opcodes' require 'metasm/parse' module Metasm class ARM def opcode_list_byname @opcode_list_byname ||= opcode_lis...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/arm/opcodes' module Metasm class ARM def dbg_register_pc @dbg_register_pc ||= :pc end def dbg_register_flags @dbg...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/main' module Metasm class ARM < CPU class Reg class << self attr_accessor :s_to_i, :i_to_s end @i_to_s = %w[r0 r1 ...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/arm/opcodes' require 'metasm/encode' module Metasm class ARM def encode_instr_op(program, instr, op) base = op.bin ...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/arm/main' module Metasm class ARM private # ARM MODE def addop(name, bin, *args) args << :cond if not args.delete...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/render' require 'metasm/cpu/arm/opcodes' module Metasm class ARM class Reg include Renderable def render r = self.cla...
Ruby
# This file is part of Metasm, the Ruby assembly manipulation suite # Copyright (C) 2006-2009 Yoann GUILLOT # # Licence is LGPL, see LICENCE in the top-level directory require 'metasm/cpu/arm/opcodes' require 'metasm/decode' module Metasm class ARM # create the bin_mask for a given opcode def build_opcode_...
Ruby