libTriton  version 0.6 build 1389
api.hpp
Go to the documentation of this file.
1 /*
3 ** Copyright (C) - Triton
4 **
5 ** This program is under the terms of the BSD License.
6 */
7 
8 #ifndef TRITON_API_H
9 #define TRITON_API_H
10 
11 #include <triton/architecture.hpp>
12 #include <triton/ast.hpp>
13 #include <triton/astContext.hpp>
15 #include <triton/callbacks.hpp>
16 #include <triton/dllexport.hpp>
17 #include <triton/immediate.hpp>
18 #include <triton/instruction.hpp>
19 #include <triton/irBuilder.hpp>
20 #include <triton/memoryAccess.hpp>
21 #include <triton/modes.hpp>
23 #include <triton/register.hpp>
24 #include <triton/registers_e.hpp>
25 #include <triton/solverEngine.hpp>
27 #include <triton/taintEngine.hpp>
28 #include <triton/tritonTypes.hpp>
29 
30 
31 
33 namespace triton {
41  class API {
42  protected:
45 
48 
51 
54 
57 
60 
63 
66 
67 
68  public:
70  TRITON_EXPORT API();
71 
73  TRITON_EXPORT ~API();
74 
75 
76  /* Architecture API ============================================================================== */
77 
79  TRITON_EXPORT bool isArchitectureValid(void) const;
80 
82  TRITON_EXPORT triton::arch::architectures_e getArchitecture(void) const;
83 
85  TRITON_EXPORT void checkArchitecture(void) const;
86 
88  TRITON_EXPORT triton::arch::CpuInterface* getCpuInstance(void);
89 
92 
94  TRITON_EXPORT void clearArchitecture(void);
95 
97  TRITON_EXPORT bool isFlag(triton::arch::registers_e regId) const;
98 
100  TRITON_EXPORT bool isFlag(const triton::arch::Register& reg) const;
101 
103  TRITON_EXPORT bool isRegister(triton::arch::registers_e regId) const;
104 
106  TRITON_EXPORT bool isRegister(const triton::arch::Register& reg) const;
107 
109  TRITON_EXPORT const triton::arch::Register& getRegister(triton::arch::registers_e id) const;
110 
112  TRITON_EXPORT const triton::arch::Register& getParentRegister(const triton::arch::Register& reg) const;
113 
116 
118  TRITON_EXPORT bool isRegisterValid(triton::arch::registers_e regId) const;
119 
121  TRITON_EXPORT bool isRegisterValid(const triton::arch::Register& reg) const;
122 
124  TRITON_EXPORT triton::uint32 getGprBitSize(void) const;
125 
127  TRITON_EXPORT triton::uint32 getGprSize(void) const;
128 
130  TRITON_EXPORT triton::uint32 getNumberOfRegisters(void) const;
131 
133  TRITON_EXPORT const std::unordered_map<triton::arch::registers_e, const triton::arch::Register>& getAllRegisters(void) const;
134 
136  TRITON_EXPORT std::set<const triton::arch::Register*> getParentRegisters(void) const;
137 
139  TRITON_EXPORT triton::uint8 getConcreteMemoryValue(triton::uint64 addr, bool execCallbacks=true) const;
140 
142  TRITON_EXPORT triton::uint512 getConcreteMemoryValue(const triton::arch::MemoryAccess& mem, bool execCallbacks=true) const;
143 
145  TRITON_EXPORT std::vector<triton::uint8> getConcreteMemoryAreaValue(triton::uint64 baseAddr, triton::usize size, bool execCallbacks=true) const;
146 
148  TRITON_EXPORT triton::uint512 getConcreteRegisterValue(const triton::arch::Register& reg, bool execCallbacks=true) const;
149 
156  TRITON_EXPORT void setConcreteMemoryValue(triton::uint64 addr, triton::uint8 value);
157 
164  TRITON_EXPORT void setConcreteMemoryValue(const triton::arch::MemoryAccess& mem, const triton::uint512& value);
165 
172  TRITON_EXPORT void setConcreteMemoryAreaValue(triton::uint64 baseAddr, const std::vector<triton::uint8>& values);
173 
180  TRITON_EXPORT void setConcreteMemoryAreaValue(triton::uint64 baseAddr, const triton::uint8* area, triton::usize size);
181 
188  TRITON_EXPORT void setConcreteRegisterValue(const triton::arch::Register& reg, const triton::uint512& value);
189 
191  TRITON_EXPORT bool isMemoryMapped(triton::uint64 baseAddr, triton::usize size=1);
192 
194  TRITON_EXPORT void unmapMemory(triton::uint64 baseAddr, triton::usize size=1);
195 
197  TRITON_EXPORT void disassembly(triton::arch::Instruction& inst) const;
198 
199 
200 
201  /* Processing API ================================================================================ */
202 
204  TRITON_EXPORT bool processing(triton::arch::Instruction& inst);
205 
207  TRITON_EXPORT void initEngines(void);
208 
210  TRITON_EXPORT void removeEngines(void);
211 
213  TRITON_EXPORT void reset(void);
214 
215 
216 
217  /* IR API ======================================================================================== */
218 
220  TRITON_EXPORT void checkIrBuilder(void) const;
221 
223  TRITON_EXPORT bool buildSemantics(triton::arch::Instruction& inst);
224 
226  TRITON_EXPORT triton::ast::AstContext& getAstContext(void);
227 
228 
229 
230 
231  /* AST Representation API ======================================================================== */
232 
234  TRITON_EXPORT triton::uint32 getAstRepresentationMode(void) const;
235 
237  TRITON_EXPORT void setAstRepresentationMode(triton::uint32 mode);
238 
239 
240 
241  /* Callbacks API ================================================================================= */
242 
245 
248 
251 
254 
257 
259  TRITON_EXPORT void removeAllCallbacks(void);
260 
263 
266 
269 
272 
275 
278 
280  TRITON_EXPORT void processCallbacks(triton::callbacks::callback_e kind, const triton::arch::MemoryAccess& mem) const;
281 
283  TRITON_EXPORT void processCallbacks(triton::callbacks::callback_e kind, const triton::arch::Register& reg) const;
284 
285 
286 
287  /* Modes API====================================================================================== */
288 
290  TRITON_EXPORT void checkModes(void) const;
291 
293  TRITON_EXPORT void enableMode(enum triton::modes::mode_e mode, bool flag);
294 
296  TRITON_EXPORT bool isModeEnabled(enum triton::modes::mode_e mode) const;
297 
298 
299 
300  /* Symbolic engine API =========================================================================== */
301 
303  TRITON_EXPORT void checkSymbolic(void) const;
304 
307 
309  TRITON_EXPORT std::map<triton::arch::registers_e, triton::engines::symbolic::SharedSymbolicExpression> getSymbolicRegisters(void) const;
310 
312  TRITON_EXPORT std::map<triton::uint64, triton::engines::symbolic::SharedSymbolicExpression> getSymbolicMemory(void) const;
313 
316 
319 
321  TRITON_EXPORT triton::uint8 getSymbolicMemoryValue(triton::uint64 address);
322 
325 
327  TRITON_EXPORT std::vector<triton::uint8> getSymbolicMemoryAreaValue(triton::uint64 baseAddr, triton::usize size);
328 
331 
333  TRITON_EXPORT const triton::engines::symbolic::SharedSymbolicVariable& convertExpressionToSymbolicVariable(triton::usize exprId, triton::uint32 symVarSize, const std::string& symVarComment="");
334 
336  TRITON_EXPORT const triton::engines::symbolic::SharedSymbolicVariable& convertMemoryToSymbolicVariable(const triton::arch::MemoryAccess& mem, const std::string& symVarComment="");
337 
339  TRITON_EXPORT const triton::engines::symbolic::SharedSymbolicVariable& convertRegisterToSymbolicVariable(const triton::arch::Register& reg, const std::string& symVarComment="");
340 
343 
346 
349 
352 
355 
358 
361 
364 
367 
369  TRITON_EXPORT const triton::engines::symbolic::SharedSymbolicVariable& newSymbolicVariable(triton::uint32 varSize, const std::string& comment="");
370 
372  TRITON_EXPORT void removeSymbolicExpression(triton::usize symExprId);
373 
376 
379 
382 
385 
388 
391 
394 
396  TRITON_EXPORT triton::ast::SharedAbstractNode processSimplification(const triton::ast::SharedAbstractNode& node, bool z3=false) const;
397 
400 
403 
405  TRITON_EXPORT const triton::engines::symbolic::SharedSymbolicVariable& getSymbolicVariableFromName(const std::string& symVarName) const;
406 
408  TRITON_EXPORT const std::vector<triton::engines::symbolic::PathConstraint>& getPathConstraints(void) const;
409 
412 
415 
417  TRITON_EXPORT void clearPathConstraints(void);
418 
420  TRITON_EXPORT void enableSymbolicEngine(bool flag);
421 
423  TRITON_EXPORT bool isSymbolicEngineEnabled(void) const;
424 
426  TRITON_EXPORT bool isSymbolicExpressionIdExists(triton::usize symExprId) const;
427 
429  TRITON_EXPORT bool isMemorySymbolized(const triton::arch::MemoryAccess& mem) const;
430 
432  TRITON_EXPORT bool isMemorySymbolized(triton::uint64 addr, triton::uint32 size=1) const;
433 
435  TRITON_EXPORT bool isRegisterSymbolized(const triton::arch::Register& reg) const;
436 
438  TRITON_EXPORT void concretizeAllMemory(void);
439 
441  TRITON_EXPORT void concretizeAllRegister(void);
442 
444  TRITON_EXPORT void concretizeMemory(const triton::arch::MemoryAccess& mem);
445 
447  TRITON_EXPORT void concretizeMemory(triton::uint64 addr);
448 
450  TRITON_EXPORT void concretizeRegister(const triton::arch::Register& reg);
451 
454 
456  TRITON_EXPORT std::map<triton::usize, triton::engines::symbolic::SharedSymbolicExpression> sliceExpressions(const triton::engines::symbolic::SharedSymbolicExpression& expr);
457 
459  TRITON_EXPORT std::list<triton::engines::symbolic::SharedSymbolicExpression> getTaintedSymbolicExpressions(void) const;
460 
462  TRITON_EXPORT std::unordered_map<triton::usize, triton::engines::symbolic::SharedSymbolicExpression> getSymbolicExpressions(void) const;
463 
465  TRITON_EXPORT const std::unordered_map<triton::usize, triton::engines::symbolic::SharedSymbolicVariable>& getSymbolicVariables(void) const;
466 
469 
472 
473 
474 
475  /* Solver engine API ============================================================================= */
476 
478  TRITON_EXPORT void checkSolver(void) const;
479 
487  TRITON_EXPORT std::map<triton::uint32, triton::engines::solver::SolverModel> getModel(const triton::ast::SharedAbstractNode& node) const;
488 
496  TRITON_EXPORT std::list<std::map<triton::uint32, triton::engines::solver::SolverModel>> getModels(const triton::ast::SharedAbstractNode& node, triton::uint32 limit) const;
497 
499  TRITON_EXPORT bool isSat(const triton::ast::SharedAbstractNode& node) const;
500 
502  TRITON_EXPORT triton::engines::solver::solvers_e getSolver(void) const;
503 
505  TRITON_EXPORT const triton::engines::solver::SolverInterface* getSolverInstance(void) const;
506 
508  TRITON_EXPORT void setSolver(triton::engines::solver::solvers_e kind);
509 
511  TRITON_EXPORT void setCustomSolver(triton::engines::solver::SolverInterface* customSolver);
512 
514  TRITON_EXPORT bool isSolverValid(void) const;
515 
517  TRITON_EXPORT triton::uint512 evaluateAstViaZ3(const triton::ast::SharedAbstractNode& node) const;
518 
521 
522 
523 
524  /* Taint engine API ============================================================================== */
525 
527  TRITON_EXPORT void checkTaint(void) const;
528 
531 
533  TRITON_EXPORT const std::set<triton::uint64>& getTaintedMemory(void) const;
534 
536  TRITON_EXPORT std::set<const triton::arch::Register*> getTaintedRegisters(void) const;
537 
539  TRITON_EXPORT void enableTaintEngine(bool flag);
540 
542  TRITON_EXPORT bool isTaintEngineEnabled(void) const;
543 
545  TRITON_EXPORT bool isTainted(const triton::arch::OperandWrapper& op) const;
546 
548  TRITON_EXPORT bool isMemoryTainted(triton::uint64 addr, triton::uint32 size=1) const;
549 
551  TRITON_EXPORT bool isMemoryTainted(const triton::arch::MemoryAccess& mem) const;
552 
554  TRITON_EXPORT bool isRegisterTainted(const triton::arch::Register& reg) const;
555 
557  TRITON_EXPORT bool setTaint(const triton::arch::OperandWrapper& op, bool flag);
558 
560  TRITON_EXPORT bool setTaintMemory(const triton::arch::MemoryAccess& mem, bool flag);
561 
563  TRITON_EXPORT bool setTaintRegister(const triton::arch::Register& reg, bool flag);
564 
566  TRITON_EXPORT bool taintMemory(triton::uint64 addr);
567 
569  TRITON_EXPORT bool taintMemory(const triton::arch::MemoryAccess& mem);
570 
572  TRITON_EXPORT bool taintRegister(const triton::arch::Register& reg);
573 
575  TRITON_EXPORT bool untaintMemory(triton::uint64 addr);
576 
578  TRITON_EXPORT bool untaintMemory(const triton::arch::MemoryAccess& mem);
579 
581  TRITON_EXPORT bool untaintRegister(const triton::arch::Register& reg);
582 
584  TRITON_EXPORT bool taintUnion(const triton::arch::OperandWrapper& op1, const triton::arch::OperandWrapper& op2);
585 
587  TRITON_EXPORT bool taintAssignment(const triton::arch::OperandWrapper& op1, const triton::arch::OperandWrapper& op2);
588 
590  TRITON_EXPORT bool taintUnionMemoryImmediate(const triton::arch::MemoryAccess& memDst);
591 
593  TRITON_EXPORT bool taintUnionMemoryMemory(const triton::arch::MemoryAccess& memDst, const triton::arch::MemoryAccess& memSrc);
594 
596  TRITON_EXPORT bool taintUnionMemoryRegister(const triton::arch::MemoryAccess& memDst, const triton::arch::Register& regSrc);
597 
599  TRITON_EXPORT bool taintUnionRegisterImmediate(const triton::arch::Register& regDst);
600 
602  TRITON_EXPORT bool taintUnionRegisterMemory(const triton::arch::Register& regDst, const triton::arch::MemoryAccess& memSrc);
603 
605  TRITON_EXPORT bool taintUnionRegisterRegister(const triton::arch::Register& regDst, const triton::arch::Register& regSrc);
606 
608  TRITON_EXPORT bool taintAssignmentMemoryImmediate(const triton::arch::MemoryAccess& memDst);
609 
611  TRITON_EXPORT bool taintAssignmentMemoryMemory(const triton::arch::MemoryAccess& memDst, const triton::arch::MemoryAccess& memSrc);
612 
614  TRITON_EXPORT bool taintAssignmentMemoryRegister(const triton::arch::MemoryAccess& memDst, const triton::arch::Register& regSrc);
615 
617  TRITON_EXPORT bool taintAssignmentRegisterImmediate(const triton::arch::Register& regDst);
618 
620  TRITON_EXPORT bool taintAssignmentRegisterMemory(const triton::arch::Register& regDst, const triton::arch::MemoryAccess& memSrc);
621 
623  TRITON_EXPORT bool taintAssignmentRegisterRegister(const triton::arch::Register& regDst, const triton::arch::Register& regSrc);
624  };
625 
627 };
628 
629 #endif /* TRITON_API_H */
TRITON_EXPORT bool taintUnion(const triton::arch::OperandWrapper &op1, const triton::arch::OperandWrapper &op2)
[taint api] - Abstract union tainting.
Definition: api.cpp:1154
This class is used to interface with solvers.
TRITON_EXPORT bool isArchitectureValid(void) const
[Architecture api] - Returns true if the architecture is valid.
Definition: api.cpp:239
TRITON_EXPORT bool isTaintEngineEnabled(void) const
[taint api] - Returns true if the taint engine is enabled.
Definition: api.cpp:1068
TRITON_EXPORT bool isRegister(triton::arch::registers_e regId) const
[architecture api] - Returns true if the regId is a register.
Definition: api.cpp:288
TRITON_EXPORT triton::uint32 getGprSize(void) const
[architecture api] - Returns the size in byte of the General Purpose Registers.
Definition: api.cpp:328
TRITON_EXPORT void setConcreteMemoryAreaValue(triton::uint64 baseAddr, const std::vector< triton::uint8 > &values)
[architecture api] - Sets the concrete value of a memory area.
Definition: api.cpp:386
triton::arch::Architecture arch
The architecture entry.
Definition: api.hpp:47
TRITON_EXPORT const triton::engines::symbolic::SharedSymbolicVariable & getSymbolicVariableFromName(const std::string &symVarName) const
[symbolic api] - Returns the symbolic variable corresponding to the symbolic variable name...
Definition: api.cpp:830
TRITON_EXPORT const triton::engines::symbolic::SharedSymbolicExpression & createSymbolicExpression(triton::arch::Instruction &inst, const triton::ast::SharedAbstractNode &node, const triton::arch::OperandWrapper &dst, const std::string &comment="")
[symbolic api] - Returns the new shared symbolic abstract expression and links this expression to the...
Definition: api.cpp:706
The abstract architecture class.
This class is used when to represent an instruction.
Definition: instruction.hpp:46
TRITON_EXPORT bool setTaintMemory(const triton::arch::MemoryAccess &mem, bool flag)
[taint api] - Sets the flag (taint or untaint) to a memory.
Definition: api.cpp:1104
TRITON_EXPORT bool taintUnionRegisterMemory(const triton::arch::Register &regDst, const triton::arch::MemoryAccess &memSrc)
[taint api] - Taints RegisterMemory with union. Returns true if the regDst or memSrc are TAINTED...
Definition: api.cpp:1190
TRITON_EXPORT bool taintAssignmentMemoryMemory(const triton::arch::MemoryAccess &memDst, const triton::arch::MemoryAccess &memSrc)
[taint api] - Taints MemoryMemory with assignment. Returns true if the memDst is tainted.
Definition: api.cpp:1208
TRITON_EXPORT void setCustomSolver(triton::engines::solver::SolverInterface *customSolver)
Initializes a custom solver.
Definition: api.cpp:983
registers_e
The list of registers.
Definition: registers_e.hpp:28
TRITON_EXPORT bool isMemoryMapped(triton::uint64 baseAddr, triton::usize size=1)
[architecture api] - Returns true if the range [baseAddr:size] is mapped into the internal memory rep...
Definition: api.cpp:404
TRITON_EXPORT bool isSat(const triton::ast::SharedAbstractNode &node) const
Returns true if an expression is satisfiable.
Definition: api.cpp:1007
TRITON_EXPORT void addPathConstraint(const triton::arch::Instruction &inst, const triton::engines::symbolic::SharedSymbolicExpression &expr)
[symbolic api] - Adds a path constraint.
Definition: api.cpp:848
TRITON_EXPORT const triton::engines::symbolic::SharedSymbolicExpression & createSymbolicMemoryExpression(triton::arch::Instruction &inst, const triton::ast::SharedAbstractNode &node, const triton::arch::MemoryAccess &mem, const std::string &comment="")
[symbolic api] - Returns the new shared symbolic memory expression and links this expression to the i...
Definition: api.cpp:712
TRITON_EXPORT bool taintUnionMemoryImmediate(const triton::arch::MemoryAccess &memDst)
[taint api] - Taints MemoryImmediate with union. Returns true if the memDst is TAINTED.
Definition: api.cpp:1166
TRITON_EXPORT void setSolver(triton::engines::solver::solvers_e kind)
Initializes a predefined solver.
Definition: api.cpp:977
TRITON_EXPORT triton::ast::SharedAbstractNode getPathConstraintsAst(void)
[symbolic api] - Returns the logical conjunction AST of path constraints.
Definition: api.cpp:842
TRITON_EXPORT bool taintAssignment(const triton::arch::OperandWrapper &op1, const triton::arch::OperandWrapper &op2)
[taint api] - Abstract assignment tainting.
Definition: api.cpp:1160
mode_e
Enumerates all kinds of mode.
Definition: modes.hpp:32
TRITON_EXPORT bool processing(triton::arch::Instruction &inst)
[proccesing api] - Processes an instruction and updates engines according to the instruction semantic...
Definition: api.cpp:477
TRITON_EXPORT void initEngines(void)
[proccesing api] - Initializes everything.
Definition: api.cpp:425
TRITON_EXPORT void reset(void)
[proccesing api] - Resets everything.
Definition: api.cpp:467
TRITON_EXPORT triton::ast::SharedAbstractNode getMemoryAst(const triton::arch::MemoryAccess &mem)
[symbolic api] - Returns the AST corresponding to the memory.
Definition: api.cpp:664
TRITON_EXPORT bool taintAssignmentMemoryRegister(const triton::arch::MemoryAccess &memDst, const triton::arch::Register &regSrc)
[taint api] - Taints MemoryRegister with assignment. Returns true if the memDst is tainted...
Definition: api.cpp:1214
TRITON_EXPORT triton::uint512 getConcreteRegisterValue(const triton::arch::Register &reg, bool execCallbacks=true) const
[architecture api] - Returns the concrete value of a register.
Definition: api.cpp:368
TRITON_EXPORT const std::vector< triton::engines::symbolic::PathConstraint > & getPathConstraints(void) const
[symbolic api] - Returns the logical conjunction vector of path constraints.
Definition: api.cpp:836
TRITON_EXPORT triton::ast::SharedAbstractNode processCallbacks(triton::callbacks::callback_e kind, triton::ast::SharedAbstractNode node) const
[callbacks api] - Processes callbacks according to the kind and the C++ polymorphism.
Definition: api.cpp:575
TRITON_EXPORT void enableMode(enum triton::modes::mode_e mode, bool flag)
[modes api] - Enables or disables a specific mode.
Definition: api.cpp:597
TRITON_EXPORT triton::uint512 evaluateAstViaZ3(const triton::ast::SharedAbstractNode &node) const
[solver api] - Evaluates a Triton&#39;s AST via Z3 and returns a concrete value.
Definition: api.cpp:1013
TRITON_EXPORT bool isRegisterSymbolized(const triton::arch::Register &reg) const
[symbolic api] - Returns true if the register expression contains a symbolic variable.
Definition: api.cpp:890
TRITON_EXPORT const triton::engines::symbolic::SharedSymbolicVariable & convertMemoryToSymbolicVariable(const triton::arch::MemoryAccess &mem, const std::string &symVarComment="")
[symbolic api] - Converts a symbolic memory expression to a symbolic variable.
Definition: api.cpp:628
triton::engines::symbolic::SymbolicEngine * symbolic
The symbolic engine.
Definition: api.hpp:56
TRITON_EXPORT std::vector< triton::uint8 > getSymbolicMemoryAreaValue(triton::uint64 baseAddr, triton::usize size)
[symbolic api] - Returns the symbolic values of a memory area.
Definition: api.cpp:784
TRITON_EXPORT void concretizeMemory(const triton::arch::MemoryAccess &mem)
[symbolic api] - Concretizes a specific symbolic memory reference.
Definition: api.cpp:908
TRITON_EXPORT void setConcreteVariableValue(const triton::engines::symbolic::SharedSymbolicVariable &symVar, const triton::uint512 &value)
[symbolic api] - Sets the concrete value of a symbolic variable.
Definition: api.cpp:818
TRITON_EXPORT void setArchitecture(triton::arch::architectures_e arch)
[architecture api] - Initializes an architecture.
Definition: api.cpp:262
TRITON_EXPORT triton::ast::SharedAbstractNode getImmediateAst(const triton::arch::Immediate &imm)
[symbolic api] - Returns the AST corresponding to the immediate.
Definition: api.cpp:652
AST Context - Used as AST builder.
Definition: astContext.hpp:49
TRITON_EXPORT bool isRegisterTainted(const triton::arch::Register &reg) const
[taint api] - Returns true if the register is tainted.
Definition: api.cpp:1092
TRITON_EXPORT triton::ast::AstContext & getAstContext(void)
[IR builder api] - Returns the AST context. Used as AST builder.
Definition: api.cpp:499
TRITON_EXPORT bool taintAssignmentRegisterImmediate(const triton::arch::Register &regDst)
[taint api] - Taints RegisterImmediate with assignment. Returns always false.
Definition: api.cpp:1220
The Triton namespace.
Definition: api.cpp:225
TRITON_EXPORT triton::engines::symbolic::SymbolicEngine * getSymbolicEngine(void)
[symbolic api] - Returns the instance of the symbolic engine.
Definition: api.cpp:616
TRITON_EXPORT void enableSymbolicEngine(bool flag)
[symbolic api] - Enables or disables the symbolic execution engine.
Definition: api.cpp:860
TRITON_EXPORT void clearPathConstraints(void)
[symbolic api] - Clears the logical conjunction vector of path constraints.
Definition: api.cpp:854
triton::callbacks::Callbacks callbacks
The Callbacks interface.
Definition: api.hpp:44
TRITON_EXPORT void concretizeRegister(const triton::arch::Register &reg)
[symbolic api] - Concretizes a specific symbolic register reference.
Definition: api.cpp:920
TRITON_EXPORT void checkSolver(void) const
[solver api] - Raises an exception if the solver engine is not initialized.
Definition: api.cpp:959
TRITON_EXPORT const std::set< triton::uint64 > & getTaintedMemory(void) const
[taint api] - Returns the tainted addresses.
Definition: api.cpp:1050
TRITON_EXPORT triton::arch::architectures_e getArchitecture(void) const
[architecture api] - Returns the architecture as triton::arch::architectures_e.
Definition: api.cpp:250
triton::ast::AstContext astCtxt
The AST Context interface.
Definition: api.hpp:62
This class is used as operand wrapper.
TRITON_EXPORT bool taintAssignmentMemoryImmediate(const triton::arch::MemoryAccess &memDst)
[taint api] - Taints MemoryImmediate with assignment. Returns always false.
Definition: api.cpp:1202
TRITON_EXPORT bool untaintRegister(const triton::arch::Register &reg)
[taint api] - Untaints a register. Returns !TAINTED if the register has been untainted correctly...
Definition: api.cpp:1148
std::shared_ptr< triton::ast::AbstractNode > SharedAbstractNode
Shared Abstract Node.
Definition: ast.hpp:57
TRITON_EXPORT std::map< triton::usize, triton::engines::symbolic::SharedSymbolicExpression > sliceExpressions(const triton::engines::symbolic::SharedSymbolicExpression &expr)
[symbolic api] - Slices all expressions from a given one.
Definition: api.cpp:932
This is used as C++ API.
Definition: api.hpp:41
TRITON_EXPORT const triton::engines::symbolic::SharedSymbolicExpression & getSymbolicRegister(const triton::arch::Register &reg) const
[symbolic api] - Returns the shared symbolic expression corresponding to the parent register...
Definition: api.cpp:766
TRITON_EXPORT void checkModes(void) const
[modes api] - Raises an exception if modes interface is not initialized.
triton::arch::IrBuilder * irBuilder
The IR builder.
Definition: api.hpp:65
TRITON_EXPORT triton::arch::CpuInterface * getCpuInstance(void)
[architecture api] - Returns the instance of the current CPU used.
Definition: api.cpp:255
TRITON_EXPORT bool setTaint(const triton::arch::OperandWrapper &op, bool flag)
[taint api] - Sets the flag (taint or untaint) to an abstract operand (Register or Memory)...
Definition: api.cpp:1098
TRITON_EXPORT std::vector< triton::uint8 > getConcreteMemoryAreaValue(triton::uint64 baseAddr, triton::usize size, bool execCallbacks=true) const
[architecture api] - Returns the concrete value of a memory area.
Definition: api.cpp:362
The modes class.
Definition: modes.hpp:43
TRITON_EXPORT const triton::engines::symbolic::SharedSymbolicVariable & convertExpressionToSymbolicVariable(triton::usize exprId, triton::uint32 symVarSize, const std::string &symVarComment="")
[symbolic api] - Converts a symbolic expression to a symbolic variable. symVarSize must be in bits...
Definition: api.cpp:622
This class is used when an instruction has a register operand.
Definition: register.hpp:44
TRITON_EXPORT void removeEngines(void)
[proccesing api] - Removes everything.
Definition: api.cpp:446
TRITON_EXPORT bool taintUnionMemoryRegister(const triton::arch::MemoryAccess &memDst, const triton::arch::Register &regSrc)
[taint api] - Taints MemoryRegister with union. Returns true if the memDst or regSrc are TAINTED...
Definition: api.cpp:1178
TRITON_EXPORT ~API()
Destructor of the API.
Definition: api.cpp:231
triton::engines::taint::TaintEngine * taint
The taint engine.
Definition: api.hpp:53
TRITON_EXPORT triton::ast::SharedAbstractNode processZ3Simplification(const triton::ast::SharedAbstractNode &node) const
[solver api] - Converts a Triton&#39;s AST to a Z3&#39;s AST, perform a Z3 simplification and returns a Trito...
Definition: api.cpp:1024
TRITON_EXPORT const triton::arch::Register & getRegister(triton::arch::registers_e id) const
[architecture api] - Returns Register from regId.
Definition: api.cpp:298
TRITON_EXPORT void concretizeAllMemory(void)
[symbolic api] - Concretizes all symbolic memory references.
Definition: api.cpp:896
TRITON_EXPORT std::map< triton::arch::registers_e, triton::engines::symbolic::SharedSymbolicExpression > getSymbolicRegisters(void) const
[symbolic api] - Returns the map of symbolic registers defined.
Definition: api.cpp:754
TRITON_EXPORT const triton::engines::symbolic::SharedSymbolicVariable & convertRegisterToSymbolicVariable(const triton::arch::Register &reg, const std::string &symVarComment="")
[symbolic api] - Converts a symbolic register expression to a symbolic variable.
Definition: api.cpp:634
TRITON_EXPORT triton::ast::SharedAbstractNode unrollAst(const triton::ast::SharedAbstractNode &node)
[symbolic api] - Unrolls the SSA form of a given AST.
Definition: api.cpp:926
TRITON_EXPORT void unmapMemory(triton::uint64 baseAddr, triton::usize size=1)
[architecture api] - Removes the range [baseAddr:size] from the internal memory representation.
Definition: api.cpp:410
TRITON_EXPORT const std::unordered_map< triton::usize, triton::engines::symbolic::SharedSymbolicVariable > & getSymbolicVariables(void) const
[symbolic api] - Returns all symbolic variables as a map of <SymVarId : SymVar>
Definition: api.cpp:950
TRITON_EXPORT bool isSymbolicEngineEnabled(void) const
[symbolic api] - Returns true if the symbolic execution engine is enabled.
Definition: api.cpp:866
This class is used to represent an immediate.
Definition: immediate.hpp:36
TRITON_EXPORT triton::engines::symbolic::SharedSymbolicExpression getSymbolicExpressionFromId(triton::usize symExprId) const
[symbolic api] - Returns the shared symbolic expression corresponding to an id.
Definition: api.cpp:806
TRITON_EXPORT void enableTaintEngine(bool flag)
[taint api] - Enables or disables the taint engine.
Definition: api.cpp:1062
TRITON_EXPORT void disassembly(triton::arch::Instruction &inst) const
[architecture api] - Disassembles the instruction and setup operands. You must define an architecture...
Definition: api.cpp:416
TRITON_EXPORT void setConcreteRegisterValue(const triton::arch::Register &reg, const triton::uint512 &value)
[architecture api] - Sets the concrete value of a register.
Definition: api.cpp:398
TRITON_EXPORT bool taintAssignmentRegisterMemory(const triton::arch::Register &regDst, const triton::arch::MemoryAccess &memSrc)
[taint api] - Taints RegisterMemory with assignment. Returns true if the regDst is tainted...
Definition: api.cpp:1226
This class is used to represent a memory access.
TRITON_EXPORT bool buildSemantics(triton::arch::Instruction &inst)
[IR builder api] - Builds the instruction semantics. Returns true if the instruction is supported...
Definition: api.cpp:493
TRITON_EXPORT triton::uint32 getAstRepresentationMode(void) const
[AST representation api] - Returns the AST representation mode as triton::ast::representations::mode_...
Definition: api.cpp:507
TRITON_EXPORT std::map< triton::uint32, triton::engines::solver::SolverModel > getModel(const triton::ast::SharedAbstractNode &node) const
[solver api] - Computes and returns a model from a symbolic constraint.
Definition: api.cpp:995
TRITON_EXPORT triton::ast::SharedAbstractNode getOperandAst(const triton::arch::OperandWrapper &op)
[symbolic api] - Returns the AST corresponding to the operand.
Definition: api.cpp:640
TRITON_EXPORT triton::engines::taint::TaintEngine * getTaintEngine(void)
[taint api] - Returns the instance of the taint engine.
Definition: api.cpp:1044
TRITON_EXPORT triton::uint8 getConcreteMemoryValue(triton::uint64 addr, bool execCallbacks=true) const
[architecture api] - Returns the concrete value of a memory cell.
Definition: api.cpp:350
TRITON_EXPORT const triton::engines::symbolic::SharedSymbolicExpression & createSymbolicFlagExpression(triton::arch::Instruction &inst, const triton::ast::SharedAbstractNode &node, const triton::arch::Register &flag, const std::string &comment="")
[symbolic api] - Returns the new shared symbolic flag expression and links this expression to the ins...
Definition: api.cpp:724
TRITON_EXPORT void setConcreteMemoryValue(triton::uint64 addr, triton::uint8 value)
[architecture api] - Sets the concrete value of a memory cell.
Definition: api.cpp:374
This interface is used as abstract CPU interface. All CPU must use this interface.
TRITON_EXPORT std::unordered_map< triton::usize, triton::engines::symbolic::SharedSymbolicExpression > getSymbolicExpressions(void) const
[symbolic api] - Returns all symbolic expressions as a map of <SymExprId : SymExpr> ...
Definition: api.cpp:944
The IR builder.
Definition: irBuilder.hpp:38
std::uint64_t uint64
unisgned 64-bits
Definition: tritonTypes.hpp:34
TRITON_EXPORT void checkArchitecture(void) const
[architecture api] - Raises an exception if the architecture is not initialized.
Definition: api.cpp:244
TRITON_EXPORT triton::ast::SharedAbstractNode getRegisterAst(const triton::arch::Register &reg)
[symbolic api] - Returns the AST corresponding to the register.
Definition: api.cpp:676
TRITON_EXPORT bool taintUnionMemoryMemory(const triton::arch::MemoryAccess &memDst, const triton::arch::MemoryAccess &memSrc)
[taint api] - Taints MemoryMemory with union. Returns true if the memDst or memSrc are TAINTED...
Definition: api.cpp:1172
std::shared_ptr< triton::engines::symbolic::SymbolicExpression > SharedSymbolicExpression
Shared Symbolic Expression.
Definition: ast.hpp:38
TRITON_EXPORT bool taintMemory(triton::uint64 addr)
[taint api] - Taints an address. Returns TAINTED if the address has been tainted correctly. Otherwise it returns the last defined state.
Definition: api.cpp:1118
std::uint32_t uint32
unisgned 32-bits
Definition: tritonTypes.hpp:31
TRITON_EXPORT bool untaintMemory(triton::uint64 addr)
[taint api] - Untaints an address. Returns !TAINTED if the address has been untainted correctly...
Definition: api.cpp:1136
TRITON_EXPORT API()
Constructor of the API.
Definition: api.cpp:227
The callbacks class.
Definition: callbacks.hpp:86
TRITON_EXPORT std::list< std::map< triton::uint32, triton::engines::solver::SolverModel > > getModels(const triton::ast::SharedAbstractNode &node, triton::uint32 limit) const
[solver api] - Computes and returns several models from a symbolic constraint. The limit is the numbe...
Definition: api.cpp:1001
TRITON_EXPORT const triton::engines::symbolic::SharedSymbolicExpression & createSymbolicVolatileExpression(triton::arch::Instruction &inst, const triton::ast::SharedAbstractNode &node, const std::string &comment="")
[symbolic api] - Returns the new shared symbolic volatile expression and links this expression to the...
Definition: api.cpp:730
TRITON_EXPORT void checkTaint(void) const
[taint api] - Raises an exception if the taint engine is not initialized.
Definition: api.cpp:1038
TRITON_EXPORT triton::uint32 getNumberOfRegisters(void) const
[architecture api] - Returns the number of registers according to the CPU architecture.
Definition: api.cpp:333
TRITON_EXPORT const triton::engines::solver::SolverInterface * getSolverInstance(void) const
Returns the instance of the initialized solver.
Definition: api.cpp:971
TRITON_EXPORT bool isFlag(triton::arch::registers_e regId) const
[architecture api] - Returns true if the register id is a flag.
Definition: api.cpp:278
TRITON_EXPORT std::set< const triton::arch::Register * > getParentRegisters(void) const
[architecture api] - Returns all parent registers.
Definition: api.cpp:344
TRITON_EXPORT triton::uint32 getGprBitSize(void) const
[architecture api] - Returns the bit in byte of the General Purpose Registers.
Definition: api.cpp:323
TRITON_EXPORT const triton::engines::symbolic::SharedSymbolicExpression & createSymbolicRegisterExpression(triton::arch::Instruction &inst, const triton::ast::SharedAbstractNode &node, const triton::arch::Register &reg, const std::string &comment="")
[symbolic api] - Returns the new shared symbolic register expression and links this expression to the...
Definition: api.cpp:718
TRITON_EXPORT const triton::uint512 & getConcreteVariableValue(const triton::engines::symbolic::SharedSymbolicVariable &symVar) const
[symbolic api] - Gets the concrete value of a symbolic variable.
Definition: api.cpp:812
TRITON_EXPORT bool isSymbolicExpressionIdExists(triton::usize symExprId) const
[symbolic api] - Returns true if the symbolic expression ID exists.
Definition: api.cpp:872
TRITON_EXPORT triton::engines::solver::solvers_e getSolver(void) const
Returns the kind of solver as triton::engines::solver::solvers_e.
Definition: api.cpp:965
TRITON_EXPORT std::map< triton::uint64, triton::engines::symbolic::SharedSymbolicExpression > getSymbolicMemory(void) const
[symbolic api] - Returns the map (<Addr : SymExpr>) of symbolic memory defined.
Definition: api.cpp:760
TRITON_EXPORT bool taintUnionRegisterImmediate(const triton::arch::Register &regDst)
[taint api] - Taints RegisterImmediate with union. Returns true if the regDst is TAINTED.
Definition: api.cpp:1184
std::shared_ptr< triton::engines::symbolic::SymbolicVariable > SharedSymbolicVariable
Shared Symbolic variable.
Definition: ast.hpp:41
This interface is used to interface with solvers.
TRITON_EXPORT void addCallback(triton::callbacks::getConcreteMemoryValueCallback cb)
[callbacks api] - Adds a GET_CONCRETE_MEMORY_VALUE callback (LOAD).
Definition: api.cpp:520
TRITON_EXPORT void assignSymbolicExpressionToRegister(const triton::engines::symbolic::SharedSymbolicExpression &se, const triton::arch::Register &reg)
[symbolic api] - Assigns a symbolic expression to a register.
Definition: api.cpp:742
TRITON_EXPORT bool isTainted(const triton::arch::OperandWrapper &op) const
[taint api] - Abstract taint verification. Returns true if the operand is tainted.
Definition: api.cpp:1074
TRITON_EXPORT const triton::engines::symbolic::SharedSymbolicVariable & getSymbolicVariableFromId(triton::usize symVarId) const
[symbolic api] - Returns the symbolic variable corresponding to the symbolic variable id...
Definition: api.cpp:824
std::uint8_t uint8
unisgned 8-bits
Definition: tritonTypes.hpp:25
TRITON_EXPORT void concretizeAllRegister(void)
[symbolic api] - Concretizes all symbolic register references.
Definition: api.cpp:902
TRITON_EXPORT bool isRegisterValid(triton::arch::registers_e regId) const
[architecture api] - Returns true if the regId is a register or a flag.
Definition: api.cpp:313
The taint engine class.
Definition: taintEngine.hpp:53
TRITON_EXPORT void checkIrBuilder(void) const
[IR builder api] - Raises an exception if the IR builder is not initialized.
Definition: api.cpp:487
triton::modes::Modes modes
The modes.
Definition: api.hpp:50
TRITON_EXPORT void checkSymbolic(void) const
[symbolic api] - Raises an exception if the symbolic engine is not initialized.
Definition: api.cpp:610
TRITON_EXPORT void removeAllCallbacks(void)
[callbacks api] - Removes all recorded callbacks.
Definition: api.cpp:545
TRITON_EXPORT bool taintUnionRegisterRegister(const triton::arch::Register &regDst, const triton::arch::Register &regSrc)
[taint api] - Taints RegisterRegister with union. Returns true if the regDst or regSrc are TAINTED...
Definition: api.cpp:1196
TRITON_EXPORT const triton::arch::Register & getParentRegister(const triton::arch::Register &reg) const
[architecture api] - Returns parent Register from a register.
Definition: api.cpp:303
TRITON_EXPORT const triton::engines::symbolic::SharedSymbolicVariable & newSymbolicVariable(triton::uint32 varSize, const std::string &comment="")
[symbolic api] - Returns a new symbolic variable.
Definition: api.cpp:694
TRITON_EXPORT const std::unordered_map< triton::arch::registers_e, const triton::arch::Register > & getAllRegisters(void) const
[architecture api] - Returns all registers.
Definition: api.cpp:338
boost::multiprecision::uint512_t uint512
unsigned 512-bits
Definition: tritonTypes.hpp:43
TRITON_EXPORT bool isMemorySymbolized(const triton::arch::MemoryAccess &mem) const
[symbolic api] - Returns true if memory cell expressions contain symbolic variables.
Definition: api.cpp:878
TRITON_EXPORT std::list< triton::engines::symbolic::SharedSymbolicExpression > getTaintedSymbolicExpressions(void) const
[symbolic api] - Returns the list of the tainted symbolic expressions.
Definition: api.cpp:938
TRITON_EXPORT bool isMemoryTainted(triton::uint64 addr, triton::uint32 size=1) const
[taint api] - Returns true if the address:size is tainted.
Definition: api.cpp:1080
TRITON_EXPORT void assignSymbolicExpressionToMemory(const triton::engines::symbolic::SharedSymbolicExpression &se, const triton::arch::MemoryAccess &mem)
[symbolic api] - Assigns a symbolic expression to a memory.
Definition: api.cpp:736
TRITON_EXPORT bool taintRegister(const triton::arch::Register &reg)
[taint api] - Taints a register. Returns TAINTED if the register has been tainted correctly...
Definition: api.cpp:1130
TRITON_EXPORT triton::uint8 getSymbolicMemoryValue(triton::uint64 address)
[symbolic api] - Returns the symbolic memory value.
Definition: api.cpp:772
TRITON_EXPORT std::set< const triton::arch::Register * > getTaintedRegisters(void) const
[taint api] - Returns the tainted registers.
Definition: api.cpp:1056
std::size_t usize
unsigned MAX_INT 32 or 64 bits according to the CPU.
Definition: tritonTypes.hpp:67
TRITON_EXPORT void setAstRepresentationMode(triton::uint32 mode)
[AST representation api] - Sets the AST representation mode.
Definition: api.cpp:512
TRITON_EXPORT void clearArchitecture(void)
[architecture api] - Clears the architecture states (registers and memory).
Definition: api.cpp:272
TRITON_EXPORT bool taintAssignmentRegisterRegister(const triton::arch::Register &regDst, const triton::arch::Register &regSrc)
[taint api] - Taints RegisterRegister with assignment. Returns true if the regDst is tainted...
Definition: api.cpp:1232
TRITON_EXPORT void removeCallback(triton::callbacks::getConcreteMemoryValueCallback cb)
[callbacks api] - Deletes a GET_CONCRETE_MEMORY_VALUE callback (LOAD).
Definition: api.cpp:550
TRITON_EXPORT bool isSolverValid(void) const
Returns true if the solver is valid.
Definition: api.cpp:989
TRITON_EXPORT triton::uint512 getSymbolicRegisterValue(const triton::arch::Register &reg)
[symbolic api] - Returns the symbolic register value.
Definition: api.cpp:790
TRITON_EXPORT void removeSymbolicExpression(triton::usize symExprId)
[symbolic api] - Removes the symbolic expression corresponding to the id.
Definition: api.cpp:700
TRITON_EXPORT triton::ast::SharedAbstractNode processSimplification(const triton::ast::SharedAbstractNode &node, bool z3=false) const
[symbolic api] - Processes all recorded simplifications. Returns the simplified node.
Definition: api.cpp:796
triton::engines::solver::SolverEngine * solver
The solver engine.
Definition: api.hpp:59
TRITON_EXPORT bool setTaintRegister(const triton::arch::Register &reg, bool flag)
[taint api] - Sets the flag (taint or untaint) to a register.
Definition: api.cpp:1111
TRITON_EXPORT bool isModeEnabled(enum triton::modes::mode_e mode) const
[modes api] - Returns true if the mode is enabled.
Definition: api.cpp:602
TRITON_EXPORT triton::engines::symbolic::SharedSymbolicExpression newSymbolicExpression(const triton::ast::SharedAbstractNode &node, const std::string &comment="")
[symbolic api] - Returns a new shared symbolic expression. Note that if there are simplification pass...
Definition: api.cpp:688