Skip to content

Commit

Permalink
up-to-date with triton
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanSalwan committed Oct 29, 2019
1 parent e1802b2 commit cba81eb
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
38 changes: 19 additions & 19 deletions solve-md5.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,8 @@ def hookingHandler(ctx):
# tigress user input
if rel[0] == 'strtoul':
debug('[+] Symbolizing the strtoul return')
var1 = ctx.convertRegisterToSymbolicVariable(ctx.registers.rax)
var0 = ctx.getSymbolicVariableFromId(0)
var1 = ctx.symbolizeRegister(ctx.registers.rax)
var0 = ctx.getSymbolicVariable(0)
ctx.setConcreteVariableValue(var0, ctx.getConcreteVariableValue(var1))
rax = ctx.getSymbolicRegister(ctx.registers.rax)
ast = ctx.getAstContext()
Expand Down Expand Up @@ -579,7 +579,7 @@ def generateSymbolicExpressions(trace, ihash):
def generateLLVMExpressions(ctx, trace):
debug('[+] Converting symbolic expressions to an LLVM module...')
e = tritonexprs2arybo(trace)
var = tritonast2arybo(ctx.getAstContext().variable(ctx.getSymbolicVariableFromId(0)))
var = tritonast2arybo(ctx.getAstContext().variable(ctx.getSymbolicVariable(0)))
M = to_llvm_function(e,[var.v], "SECRET")
return M

Expand Down Expand Up @@ -647,22 +647,22 @@ def main():
# ref_1461550 = (ref_1461548 & 0xFF) # md5: h14
# ref_1461572 = (ref_1461536 & 0xFFFFFFFF) # md5: h15

h0 = ctx.getSymbolicExpressionFromId(rhash[0])
h1 = ctx.getSymbolicExpressionFromId(rhash[1])
h2 = ctx.getSymbolicExpressionFromId(rhash[2])
h3 = ctx.getSymbolicExpressionFromId(rhash[3])
h4 = ctx.getSymbolicExpressionFromId(rhash[4])
h5 = ctx.getSymbolicExpressionFromId(rhash[5])
h6 = ctx.getSymbolicExpressionFromId(rhash[6])
h7 = ctx.getSymbolicExpressionFromId(rhash[7])
h8 = ctx.getSymbolicExpressionFromId(rhash[8])
h9 = ctx.getSymbolicExpressionFromId(rhash[9])
h10 = ctx.getSymbolicExpressionFromId(rhash[10])
h11 = ctx.getSymbolicExpressionFromId(rhash[11])
h12 = ctx.getSymbolicExpressionFromId(rhash[12])
h13 = ctx.getSymbolicExpressionFromId(rhash[13])
h14 = ctx.getSymbolicExpressionFromId(rhash[14])
h15 = ctx.getSymbolicExpressionFromId(rhash[15])
h0 = ctx.getSymbolicExpression(rhash[0])
h1 = ctx.getSymbolicExpression(rhash[1])
h2 = ctx.getSymbolicExpression(rhash[2])
h3 = ctx.getSymbolicExpression(rhash[3])
h4 = ctx.getSymbolicExpression(rhash[4])
h5 = ctx.getSymbolicExpression(rhash[5])
h6 = ctx.getSymbolicExpression(rhash[6])
h7 = ctx.getSymbolicExpression(rhash[7])
h8 = ctx.getSymbolicExpression(rhash[8])
h9 = ctx.getSymbolicExpression(rhash[9])
h10 = ctx.getSymbolicExpression(rhash[10])
h11 = ctx.getSymbolicExpression(rhash[11])
h12 = ctx.getSymbolicExpression(rhash[12])
h13 = ctx.getSymbolicExpression(rhash[13])
h14 = ctx.getSymbolicExpression(rhash[14])
h15 = ctx.getSymbolicExpression(rhash[15])

astCtx = ctx.getAstContext()
finalAst = astCtx.concat([
Expand Down
8 changes: 4 additions & 4 deletions solve-vm-multiple-br.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ def hookingHandler(self):
# tigress user input
if rel[0] == 'strtoul':
debug('[+] Symbolizing the strtoul return')
var = self.ctx.convertRegisterToSymbolicVariable(self.ctx.registers.rax)
var = self.ctx.symbolizeRegister(self.ctx.registers.rax)
self.ctx.setConcreteVariableValue(var, VM_INPUT)

# tigress user input
Expand Down Expand Up @@ -563,7 +563,7 @@ def symbolicLea(self, lea):
models = self.ctx.getModels(crst, 255)
for model in models:
seed = list()
argc = self.ctx.getSymbolicVariableFromId(0)
argc = self.ctx.getSymbolicVariable(0)
seed.append({
'comment': argc.getComment(),
'id': argc.getId(),
Expand All @@ -575,7 +575,7 @@ def symbolicLea(self, lea):
})
for k,v in model.items():
# Get the symbolic variable assigned to the model
symVar = self.ctx.getSymbolicVariableFromId(k)
symVar = self.ctx.getSymbolicVariable(k)
# Save the new input as seed.
seed.append({
'comment': symVar.getComment(),
Expand Down Expand Up @@ -946,7 +946,7 @@ def getNewInput(self, trace):
seed = list()
for k, v in model.items():
# Get the symbolic variable assigned to the model
symVar = trace.ctx.getSymbolicVariableFromId(k)
symVar = trace.ctx.getSymbolicVariable(k)
# Save the new input as seed.
seed.append({
'comment': symVar.getComment(),
Expand Down
4 changes: 2 additions & 2 deletions solve-vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ def generateLLVMExpressions(ctx, pathNumber):

debug('[+] Converting symbolic expressions to an LLVM module...')
e = tritonexprs2arybo(exprs)
var = tritonast2arybo(ctx.getAstContext().variable(ctx.getSymbolicVariableFromId(0)))
var = tritonast2arybo(ctx.getAstContext().variable(ctx.getSymbolicVariable(0)))
M = to_llvm_function(e,[var.v])

return M
Expand Down Expand Up @@ -737,7 +737,7 @@ def main():
e1 = tritonexprs2arybo(paths[0])
e2 = tritonexprs2arybo(paths[1])
ast = ctx.getAstContext()
var = tritonast2arybo(ast.variable(ctx.getSymbolicVariableFromId(0)))
var = tritonast2arybo(ast.variable(ctx.getSymbolicVariable(0)))
if condition[0][0]:
M = to_llvm_function(ExprCond(c, e1, e2), [var.v])
else:
Expand Down

0 comments on commit cba81eb

Please sign in to comment.