Package vivisect :: Package symboliks :: Module common
[hide private]
[frames] | no frames]

Module common

source code

Classes [hide private]
  ExpressionHelper
  SymbolikBase
  cnot
Mostly used to wrap the reverse of a contraint which is based on a variable.
  Call
This represents the return value of an instance of a call to a function.
  Mem
This is effectivly a cop-out for symbolic states read in from memory which has not been initialized yet.
  Var
  Arg
An "Arg" is a special kind of variable used to facilitate cross function boundary solving.
  Const
  Operator
A class representing an algebraic operator being carried out on two symboliks.
  o_add
  o_sub
  o_xor
  o_and
  o_or
  o_mul
  o_div
  o_mod
  o_lshift
  o_rshift
  o_pow
  o_sextend
Functions [hide private]
 
evalSymbolik(reprstr)
Take a previously repr'd symboliks object and eval it back into objecthood.
source code
 
exprSymbolik(expr) source code
 
frobSymbol(thing, width)
Translate native python types to symbolik types if we know how...
source code
 
getSymbolikImport(vw, impname)
Resolve (hopefully) and return a symbolik import emulation function for the given import by name.
source code
 
handle_zero_in_leaf(self, v1, v1val, v2, v2val)
if one of the kids is 0 for an add operation, we can ignore the value.
source code
 
handle_zero_in_leaf_from_parent(self, v1, v1val, v2, v2val)
this handles the situation described above where v1val is the value that is zero in a subtraction operation.
source code
 
handle_const_on_left(self, v2)
if constant is on the left for a subtraction operation, perform a replacement so it's on the right since thats how our rules work.
source code
 
op_reduce_addsub(self, v1, v1val, v2, v2val, emu) source code
Variables [hide private]
  t = ExpressionHelper()
  addsub_table = {(o_add, o_add, Const):(o_add, None, o_add, Fal...
Function Details [hide private]

evalSymbolik(reprstr)

source code 

Take a previously repr'd symboliks object and eval it
back into objecthood.

Example:
    x = "o_add(Var('eax', 4), 3)"
    symobj = evalSymbolik(x)

handle_zero_in_leaf(self, v1, v1val, v2, v2val)

source code 

if one of the kids is 0 for an add operation, we can ignore the value. if one of the kids is 0 for a sub operation, we can ignore the value only if v2val is the one that is 0 since it does not affect the add/sub operation. fex, 0 - bar != bar, but bar - 0 = bar.

handle_zero_in_leaf_from_parent(self, v1, v1val, v2, v2val)

source code 

this handles the situation described above where v1val is the value that is zero in a subtraction operation. if we have a 0 +/- x term combined with anything, the 0 can be dropped. it MUST be combined with something, because otherwise you get into the same situation as the previous comment. (0-bar != bar) (foo - (0 - bar)) => foo + bar (foo + (0 - bar)) => foo - bar

we do NOT reduce if the (0 - foo) term is on the left side of a subtraction, ie: (0 - foo) - bar (0 - foo) +/- (0 - bar)

handle_const_on_left(self, v2)

source code 

if constant is on the left for a subtraction operation, perform a replacement so it's on the right since thats how our rules work. (255 - foo) => (0 - foo) + 255


Variables Details [hide private]

addsub_table

Value:
{(o_add, o_add, Const):(o_add, None, o_add, False, False), (o_add, Con\
st, o_add):(o_add, None, o_add, False, False), (o_add, o_sub, Const):(\
o_add, None, o_sub, True, False), (o_add, Const, o_sub):(o_add, None, \
o_sub, False, False), (o_sub, o_add, Const):(o_add, None, o_sub, False\
, False), (o_sub, Const, o_add):(o_sub, None, o_sub, False, True), (o_\
sub, o_sub, Const):(o_sub, None, o_add, False, False), (o_sub, Const, \
o_sub):(o_sub, None, o_add, False, True), (o_add, o_add, o_add):(o_add\
, o_add, o_add, False, False), (o_add, o_sub, o_add):(o_add, o_add, o_\
...