示例#1
0
 def get_annotation(self, xdata):
     (xtags, xargs, xprs) = xdata.get_xprdata()
     if len(xprs) == 7:
         lhs = str(xprs[0])
         rhsx = str(xprs[3])
         rrhsx = str(xprs[4])
         rhsx = X.simplify_result(xargs[3], xargs[4], rhsx, rrhsx)
         rhsx1 = str(xprs[5])
         rrhsx1 = str(xprs[6])
         rhsx1 = X.simplify_result(xargs[5], xargs[6], rhsx1, rrhsx1)
         return (lhs + ' = ' + rhsx + ' or ' + rhsx1)
     else:
         return self.tags[0] + ':????'
示例#2
0
 def get_annotation(self, xdata):
     if len(xprs) == 8:
         (xtags, xargs, xprs) = xdata.get_xprdata()
         lhs1 = str(xprs[0])
         lhs2 = str(xprs[1])
         quot = str(xprs[4])
         rquot = str(xprs[5])
         rem = str(xprs[6])
         rrem = str(xprs[7])
         quot = X.simplify_result(xargs[4], xargs[5], quot, rquot)
         rem = X.simplify_result(xargs[6], xargs[7], rem, rrem)
         return lhs1 + ' = ' + quot + '; ' + lhs2 + ' = ' + rem
     else:
         return self.tags[0] + ':????'
示例#3
0
 def get_annotation(self, xdata):
     (xtags, xargs, xprs) = xdata.get_xprdata()
     if len(xargs) == 2:
         eax = str(xprs[0])
         reax = str(xprs[1])
         eax = X.simplify_result(xargs[0], xargs[1], eax, reax)
         return 'return (' + eax + ')'
     elif len(xargs) == 3:
         eax = str(xprs[0])
         reax = str(xprs[1])
         eax = X.simplify_result(xargs[0], xargs[1], eax, reax)
         popped = str(xargs[2])
         return 'return (' + eax + ') (adj: ' + popped + ')'
     else:
         return 'ret:????'
示例#4
0
 def get_annotation(self, xdata):
     (xtags, xargs, xprs) = xdata.get_xprdata()
     lhs = str(xprs[0])
     rhs = str(xprs[3])
     rrhs = str(xprs[4])
     rhs = X.simplify_result(xargs[3], xargs[4], rhs, rrhs)
     srcptrrhs = str(xprs[5])
     rsrcptrrhs = str(xprs[6])
     srcptrrhs = X.simplify_result(xargs[5], xargs[6], srcptrrhs,
                                   rsrcptrrhs)
     dstptrrhs = str(xprs[7])
     rdstptrrhs = str(xprs[8])
     dstptrrhs = X.simplify_result(xargs[7], xargs[8], dstptrrhs,
                                   rdstptrrhs)
     return (lhs + ' = ' + rhs + '; esi = ' + srcptrrhs + '; edi = ' +
             dstptrrhs)
示例#5
0
 def get_annotation(self,xdata):
     (xtags,xargs,xprs) = xdata.get_xprdata()
     lhs = str(xprs[0])
     rhs = str(xprs[3])
     rrhs = str(xprs[4])
     rhs = X.simplify_result(xargs[3],xargs[4],rhs,rrhs)
     return lhs + ' = ' + rhs
示例#6
0
 def get_annotation(self, xdata):
     (xtags, xargs, xprs) = xdata.get_xprdata()
     lhs = str(xprs[0])
     rhs = str(xprs[1])
     rrhs = str(xprs[2])
     rhs = X.simplify_result(xargs[1], xargs[2], rhs, rrhs)
     return lhs + ' = sign-extend ' + rhs
示例#7
0
 def get_annotation(self, xdata):
     (xtags, xargs, xprs) = xdata.get_xprdata()
     if len(xprs) == 5:
         lhs = str(xprs[0])
         rhs = str(xprs[3])
         rrhs = str(xprs[4])
         rrhs = X.simplify_result(xargs[3], xargs[4], rhs, rrhs)
         return lhs + ' = ' + rrhs
     else:
         return (self.tags[0] + ':????')
示例#8
0
 def get_annotation(self, xdata):
     (xtags, xargs, xprs) = xdata.get_xprdata()
     if len(xprs) == 3:
         lhs = str(xprs[0])
         rhs = str(xprs[1])
         rrhs = str(xprs[2])
         rhs = X.simplify_result(xargs[1], xargs[2], rhs, rrhs)
         return lhs + ' = ' + rhs
     else:
         return 'movzx:????'
示例#9
0
 def get_annotation(self, xdata):
     (xtags, xargs, xprs) = xdata.get_xprdata()
     if len(xprs) == 5:
         lhs = str(xprs[0])
         rdiff = xprs[3]
         rrdiff = xprs[4]
         rdiff = X.simplify_result(xargs[3], xargs[4], rdiff, rrdiff)
         return lhs + ' := ' + rdiff
     else:
         return 'sub:????'
示例#10
0
 def get_annotation(self, xdata):
     (xtags, xargs, xprs) = xdata.get_xprdata()
     srclhs = str(xprs[0])
     dstlhs = str(xprs[1])
     srcrhs = str(xprs[2])
     dstrhs = str(xprs[3])
     result = str(xprs[4])
     rresult = str(xprs[5])
     result = X.simplify_result(xargs[4], xargs[5], result, rresult)
     return dstlhs + ' = ' + result + '; ' + srclhs + ' = ' + dstrhs
示例#11
0
 def get_annotation(self, xdata):
     (xtags, xargs, xprs) = xdata.get_xprdata()
     if len(xprs) > 3:
         lhs = str(xprs[0])
         rsum = xprs[3]
         rrsum = xprs[4]
         rsum = X.simplify_result(xargs[3], xargs[4], rsum, rrsum)
         addxpr = lhs + ' := ' + rsum
         return addxpr
     else:
         return 'add:????'
示例#12
0
 def get_annotation(self, xdata):
     (xtags, xargs, xprs) = xdata.get_xprdata()
     if len(xtags) == 1:
         return 'restore ' + str(xprs[0])
     else:
         lhs = str(xprs[0])
         rhs = str(xprs[1])
         esp = str(xprs[2])
         resp = str(xprs[3])
         resp = X.simplify_result(xargs[2], xargs[3], esp, resp)
         return lhs + ' = ' + rhs + '; esp = ' + resp
示例#13
0
 def get_annotation(self, xdata):
     (xtags, xargs, xprs) = xdata.get_xprdata()
     if len(xprs) == 1:  # src, dst are the same, result is zero
         lhs = str(xprs[0])
         return lhs + ' = 0'
     elif len(xprs) == 5:
         lhs = str(xprs[0])
         result = str(xprs[3])
         rresult = str(xprs[4])
         result = X.simplify_result(xargs[3], xargs[4], result, rresult)
         return lhs + ' = ' + result
     else:
         return 'xor:????'
示例#14
0
 def get_annotation(self,xdata):
     (xtags,xargs,xprs) = xdata.get_xprdata()
     if len(xprs) == 1:
         lhs = str(xprs[0])
         return lhs + ' = -1'
     elif len(xprs) == 5:
         lhs = str(xprs[0])
         result = str(xprs[3])
         rresult = str(xprs[4])
         result = X.simplify_result(xargs[3],xargs[4],result,rresult)
         return lhs + ' = ' + result
     else:
         return 'or:????'
示例#15
0
def get_opcode(tag, args):
    if tag in [
            'jo', 'jno', 'jc', 'jnc', 'jz', 'jnz', 'jbe', 'ja', 'js', 'jns',
            'jpe', 'jpo', 'jl', 'jge', 'jle', 'jg'
    ]:
        return X86Jcc(*args)
    if tag in [
            'seto', 'setna', 'setc', 'setnc', 'setz', 'setnz', 'setbe', 'seta',
            'sets', 'setns', 'setpe', 'setpo', 'setl', 'setge', 'setle', 'setg'
    ]:
        return X86Setcc(*args)
    if tag in x86_opcode_constructors:
        return x86_opcode_constructors[tag](args)
    else:
        return X.X86OpcodeBase(*args)
示例#16
0
 def get_annotation(self, xdata):
     (xtags, xargs, xprs) = xdata.get_xprdata()
     if len(xtags) > 0 and xtags[0] == 'arg':
         callsite = xtags[1]
         argindex = xargs[2]
         xval = str(xprs[1])
         return '[' + str(callsite) + ':' + str(
             argindex) + ': ' + xval + ']'
     if len(xprs) == 3:
         lhs = str(xprs[0])
         rhs = str(xprs[1])
         rrhs = str(xprs[2])
         rhs = X.simplify_result(xargs[1], xargs[2], rhs, rrhs)
         return lhs + ' = ' + rhs
     else:
         if len(xtags) > 0:
             return xtags[0]
         else:
             return 'mov:????'
示例#17
0
 def get_annotation(self, xdata):
     (xtags, xargs, xprs) = xdata.get_xprdata()
     if len(xtags) == 1 and xtags[0] == 'stack-realign':
         alignment = str(xargs[0])
         return 'align stack on ' + alignment + ' bytes'
     elif len(xprs) == 1:  # rhs is zero, result is zero
         lhs = str(xprs[0])
         return lhs + ' = 0'
     elif len(xprs) == 3:  # dst = src, value is unchanged
         lhs = str(xprs[0])
         rhs = str(xprs[2])
         return lhs + ' = ' + rhs + ' (unchanged)'
     elif len(xprs) == 5:
         lhs = str(xprs[0])
         result = str(xprs[3])
         rresult = str(xprs[4])
         result = X.simplify_result(xargs[3], xargs[4], result, rresult)
         return lhs + ' = ' + result
     else:
         return 'and:????'