1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
| dst1=[0x71, 0xDE, 0xA5, 0xF6, 0x43, 0x22, 0x89, 0xF7, 0xD1, 0xA4, 0x0C, 0x19, 0x9B, 0xF3, 0x4F, 0x97]
import json
class sig_frame: def __init__(self,reglist): self.r8 =reglist["r8"][0] self.r9 =reglist["r9"][0] self.r10=reglist["r10"][0] self.r11=reglist["r11"][0] self.r12=reglist["r12"][0] self.r13=reglist["r13"][0] self.r14=reglist["r14"][0] self.r15=reglist["r15"][0] self.rdi=reglist["rdi"][0] self.rsi=reglist["rsi"][0] self.rbp=reglist["rbp"][0] self.rbx=reglist["rbx"][0] self.rdx=reglist["rdx"][0] self.rax=reglist["rax"][0] self.rcx=reglist["rcx"][0] self.rsp=reglist["rsp"][0] self.rip=reglist["rip"][0]
def func_4015f1(reglist): curreg=sig_frame(reglist) if curreg.rbx: print('( '+str(hex(curreg.rdx))+' + 4*'+str(hex(curreg.rax))+') = ('+str(hex(curreg.rdx))+' + 4*'+str(hex(curreg.rcx))+')')
else: print('( '+str(hex(curreg.rdx))+' + 4*'+str(hex(curreg.rax))+') = '+str(hex(curreg.rcx)))
def func_401594(reglist): curreg=sig_frame(reglist) if curreg.rbx: print('( '+str(hex(curreg.rdx))+' + 4*'+str(hex(curreg.rax))+') += ('+str(hex(curreg.rdx))+' + 4*'+str(hex(curreg.rcx))+')') else: print('( '+str(hex(curreg.rdx))+' + 4*'+str(hex(curreg.rax))+') += '+str(hex(curreg.rcx)))
def func_401535(reglist): curreg=sig_frame(reglist) if curreg.rbx: print('( '+str(hex(curreg.rdx))+' + 4*'+str(hex(curreg.rax))+') >>= ('+str(hex(curreg.rdx))+' + 4*'+str(hex(curreg.rcx))+')')
else: print('( '+str(hex(curreg.rdx))+' + 4*'+str(hex(curreg.rax))+') >>= '+str(hex(curreg.rcx)))
def func_401477(reglist): curreg=sig_frame(reglist) if curreg.rbx: print('( '+str(hex(curreg.rdx))+' + 4*'+str(hex(curreg.rax))+') ^= ('+str(hex(curreg.rdx))+' + 4*'+str(hex(curreg.rcx))+')')
else: print('( '+str(hex(curreg.rdx))+' + 4*'+str(hex(curreg.rax))+') ^= '+str(hex(curreg.rcx)))
def func_4014d6(reglist): curreg=sig_frame(reglist) if curreg.rbx: print('( '+str(hex(curreg.rdx))+' + 4*'+str(hex(curreg.rax))+') <<= ('+str(hex(curreg.rdx))+' + 4*'+str(hex(curreg.rcx))+')')
else: print('( '+str(hex(curreg.rdx))+' + 4*'+str(hex(curreg.rax))+') <<= '+str(hex(curreg.rcx)))
def checkfunc(currip,reglist): if currip==0x4015f1: func_4015f1(reglist) return 0 if currip == 0x401594: func_401594(reglist) return 0
if currip == 0x401477: func_401477(reglist) return 0 if currip == 0x401535: func_401535(reglist) return 0 if currip == 0x4014d6: func_4014d6(reglist) return 0
return 1
with open('result.json','r') as f: flowlist=json.load(f)
count=0 for flow in flowlist: count+=1 if checkfunc(flow["rip"][0],flow): print("curfunction : "+str(hex(flow["rip"][0]))) for i,j in flow.items(): if i!="rsp" and i!='rip' and j[0]: print(i+':'+str(hex(j[0])),end=' , ') print('\n------------------')
with open('flowana','r') as f: b=f.read() b=b.split('\n')
strlist=['']*0xf strlist[0]="input_0" strlist[1]="input_1" strlist[2]="input_2" strlist[3]="input_3"
import re
for row in b: curindexlist=re.findall(r'(?<=4\*0x)[0-9a-z]*',row) curindex=int(curindexlist[0],16) curtag=re.findall(r'(?<=\) )[=|>|+|<|^]*(?= )',row)[0] if curtag=='=': if len(curindexlist) > 1: strlist[curindex] = strlist[int(curindexlist[1],16)] else: strlist[curindex]=re.findall(r'(?<= = ).*',row)[0] print(strlist[curindex]) elif curtag=='+=': if len(curindexlist) > 1: strlist[curindex] = strlist[curindex] + ' + ' + strlist[int(curindexlist[1],16)] else: strlist[curindex]=strlist[curindex] + ' + ' + re.findall(r'(?<= \+= ).*',row)[0] print(strlist[curindex]) elif curtag=='>>=': if len(curindexlist) > 1: strlist[curindex] =' ( ( ' + strlist[curindex] + ' ) >> ' + strlist[int(curindexlist[1],16)] + ' ) ' else: strlist[curindex]=' ( ( ' + strlist[curindex] + ' ) >> ' + re.findall(r'(?<= >>= ).*',row)[0] + ' ) ' print(strlist[curindex]) elif curtag=='<<=': if len(curindexlist) > 1: strlist[curindex] =' ( ( ' + strlist[curindex] + ' ) << ' + strlist[int(curindexlist[1],16)] + ' ) ' else: strlist[curindex]=' ( ( ' + strlist[curindex] + ' ) << ' + re.findall(r'(?<= <<= ).*',row)[0] + ' ) ' print(strlist[curindex]) elif curtag=='^=': if len(curindexlist) > 1: strlist[curindex] =' ( ( ' + strlist[curindex] + ' ) ^ ' + strlist[int(curindexlist[1],16)] + ' ) ' else: strlist[curindex]=' ( ( ' + strlist[curindex] + ' ) ^ ' + re.findall(r'(?<= ^= ).*',row)[0] + ' ) ' print(strlist[curindex]) else: print("error") print(curtag) exit()
print('------------------') for i in range(4): print(strlist[i])
|