Advertisement
Guest User

Untitled

a guest
Apr 8th, 2020
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.38 KB | None | 0 0
  1. diff --git a/a.cpp b/a.cpp
  2. index 395d5c9..b243544 100644
  3. --- a/a.cpp
  4. +++ b/a.cpp
  5. @@ -1,3 +1,5 @@
  6. +auto ast = api.getAstContext();
  7. +
  8.  // Triton API has changed a lot. Commenting for now
  9.  auto path_constraint = ponce_runtime_status.myPathConstraints[bound];
  10.  if (path_constraint.conditionAddr == pc)
  11. @@ -10,16 +12,16 @@ if (path_constraint.conditionAddr == pc)
  12.         if (cmdOptions.showExtraDebugInfo)
  13.             msg("[+] Keeping condition %d\n", j);
  14.         triton::usize ripId = ponce_runtime_status.myPathConstraints[j].conditionRipId;
  15. -       auto symExpr = api.unrollAstFromId(ripId);
  16. +       auto symExpr = api.getSymbolicExpression(ripId)->getAst();
  17.         ea_t takenAddr = ponce_runtime_status.myPathConstraints[j].takenAddr;
  18.  
  19. -       expr.push_back(triton::ast::assert_(triton::ast::equal(symExpr, triton::ast::bv(takenAddr, symExpr->getBitvectorSize()))));
  20. +       expr.push_back(ast.equal(symExpr, ast.bv(takenAddr, symExpr->getBitvectorSize())));
  21.     }
  22.     if (cmdOptions.showExtraDebugInfo)
  23.         msg("[+] Inverting condition %d\n", bound);
  24.     //And now we negate the selected condition
  25.     triton::usize ripId = ponce_runtime_status.myPathConstraints[bound].conditionRipId;
  26. -   auto symExpr = api.getFullAstFromId(ripId);
  27. +   auto symExpr = api.getSymbolicExpression(ripId)->getAst();
  28.     ea_t notTakenAddr = ponce_runtime_status.myPathConstraints[bound].notTakenAddr;
  29.     if (cmdOptions.showExtraDebugInfo) {
  30.         if (inf.is_64bit())
  31. @@ -27,10 +29,10 @@ if (path_constraint.conditionAddr == pc)
  32.         else
  33.             msg("[+] ripId: %d notTakenAddr: %#x\n", ripId, notTakenAddr);
  34.     }
  35. -   expr.push_back(triton::ast::assert_(triton::ast::equal(symExpr, triton::ast::bv(notTakenAddr, symExpr->getBitvectorSize()))));
  36. +   expr.push_back(ast.equal(symExpr, ast.bv(notTakenAddr, symExpr->getBitvectorSize())));
  37.  
  38.     //Time to solve
  39. -   auto final_expr = triton::ast::compound(expr);
  40. +   auto final_expr = ast.compound(expr);
  41.  
  42.     if (cmdOptions.showDebugInfo)
  43.         msg("[+] Solving formula...\n");
  44. @@ -41,7 +43,9 @@ if (path_constraint.conditionAddr == pc)
  45.         /*Create the full formula*/
  46.         ss << "(set-logic QF_AUFBV)\n";
  47.         /* Then, delcare all symbolic variables */
  48. -       ss << api.getSymbolicEngine()->getVariablesDeclaration();
  49. +                for (auto it : api.getSymbolicVariables()) {
  50. +         ss << ast.declare(ast.variable(v.second));
  51. +                }
  52.         //ss << api.getVariablesDeclaration();
  53.         /* And concat the user expression */
  54.         ss << "\n\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement