static PyObject *Triton_getSymExprs(PyObject *self, PyObject *noargs) {
  PyObject                          *ret;
  std::vector<SymbolicExpression *> exprs;
  uint64                            numberOfExprs = 0;

  exprs = ap.getExpressions();
  numberOfExprs = exprs.size();
  ret = xPyList_New(numberOfExprs);
  for (uint64 index = 0; index < numberOfExprs; index++)
    PyList_SetItem(ret, index, PySymbolicExpression(exprs[index]));

  return ret;
}
static PyObject *Triton_getSymExpr(PyObject *self, PyObject *id) {
  uint64              exprId;
  SymbolicExpression  *expr;

  if (!PyLong_Check(id) && !PyInt_Check(id))
    return PyErr_Format(PyExc_TypeError, "getSymExpr(): expected an id (integer) as argument");

  exprId = PyLong_AsLong(id);
  expr = ap.getExpressionFromId(exprId);

  if (expr == nullptr)
    return PyErr_Format(PyExc_TypeError, "getSymExpr(): Invalid symbolic expression ID");

  return PySymbolicExpression(expr);
}
Exemple #3
0
      static PyObject* Instruction_getSymbolicExpressions(PyObject* self, PyObject* noarg) {
        triton::arch::Instruction*  inst;
        triton::uint32              exprSize;
        PyObject*                   symExprs;

        inst     = PyInstruction_AsInstruction(self);
        exprSize = inst->symbolicExpressions.size();
        symExprs = xPyList_New(exprSize);

        for (triton::uint32 index = 0; index < exprSize; index++) {
          PyObject* obj = nullptr;
          obj = PySymbolicExpression(inst->symbolicExpressions[index]);
          PyList_SetItem(symExprs, index, obj);
        }

        return symExprs;
      }
static PyObject *Triton_getTaintedExpressions(PyObject *self, PyObject *noarg) {
  PyObject                                  *ret;
  std::list<SymbolicExpression *>           exprs;
  std::list<SymbolicExpression *>::iterator it;
  uint64                                    index = 0;
  uint64                                    numberOfExprs = 0;

  exprs = ap.getTaintedExpressions();
  numberOfExprs = exprs.size();
  ret = xPyList_New(numberOfExprs);
  for (it = exprs.begin(); it != exprs.end(); it++) {
    PyList_SetItem(ret, index, PySymbolicExpression(*it));
    index++;
  }

  return ret;
}
static PyObject *Instruction_getSymbolicExpressions(PyObject *self, PyObject *noarg) {
  std::list<SymbolicExpression*> symExpressions;
  std::list<SymbolicExpression*>::iterator it;

  if (PyInstruction_AsIns(self) != nullptr) {
    symExpressions = PyInstruction_AsIns(self)->getSymbolicExpressions();
  }

  PyObject *SEList = xPyList_New(symExpressions.size());
  Py_ssize_t index = 0;
  for (it = symExpressions.begin() ; it != symExpressions.end(); it++) {
    PyObject *PySE = PySymbolicExpression(*it);
    PyList_SetItem(SEList, index, PySE);
    index++;
  }

  return SEList;
}