當前位置: 首頁>>代碼示例>>Python>>正文


Python z3.If方法代碼示例

本文整理匯總了Python中z3.If方法的典型用法代碼示例。如果您正苦於以下問題:Python z3.If方法的具體用法?Python z3.If怎麽用?Python z3.If使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在z3的用法示例。


在下文中一共展示了z3.If方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: BVS

# 需要導入模塊: import z3 [as 別名]
# 或者: from z3 import If [as 別名]
def BVS(self, ast):
        name = ast._encoded_name
        if hasattr(ast, 'annotations'):
            self.extra_bvs_data[name] = (ast.args, ast.annotations)
        else:
            self.extra_bvs_data[name] = (ast.args, None)
        size = ast.size()
        # TODO: Here we can use low level APIs because the check performed by the high level API always results in
        #       the else branch of the check. This evidence although comes from the execution of the angr and claripy
        #       test suite so I'm not sure if this assumption would hold on 100% of the cases
        bv = z3.BitVecSortRef(z3.Z3_mk_bv_sort(self._context.ref(), size), self._context)
        expr = z3.BitVecRef(z3.Z3_mk_const(self._context.ref(), z3.to_symbol(name, self._context), bv.ast), self._context)
        #if mn is not None:
        #    expr = z3.If(z3.ULT(expr, mn), mn, expr, ctx=self._context)
        #if mx is not None:
        #    expr = z3.If(z3.UGT(expr, mx), mx, expr, ctx=self._context)
        #if stride is not None:
        #    expr = (expr // stride) * stride
        return expr 
開發者ID:angr,項目名稱:claripy,代碼行數:21,代碼來源:backend_z3.py

示例2: _abs

# 需要導入模塊: import z3 [as 別名]
# 或者: from z3 import If [as 別名]
def _abs(self, z3_value):
        return z3.If(z3_value >= 0,z3_value,-z3_value) 
開發者ID:cea-sec,項目名稱:miasm,代碼行數:4,代碼來源:z3_ir.py

示例3: to_bool

# 需要導入模塊: import z3 [as 別名]
# 或者: from z3 import If [as 別名]
def to_bool(e : z3.AstRef):
    """
    If `e` is a boolean literal, return its value (True or False).
    Otherwise, return None.
    """
    if z3.is_true(e):
        return True
    if z3.is_false(e):
        return False
    return None 
開發者ID:CozySynthesizer,項目名稱:cozy,代碼行數:12,代碼來源:solver.py

示例4: from_ExprCond

# 需要導入模塊: import z3 [as 別名]
# 或者: from z3 import If [as 別名]
def from_ExprCond(self, expr):
        cond = self.from_expr(expr.cond)
        src1 = self.from_expr(expr.src1)
        src2 = self.from_expr(expr.src2)
        return z3.If(cond != 0, src1, src2) 
開發者ID:cea-sec,項目名稱:miasm,代碼行數:7,代碼來源:z3_ir.py

示例5: _sdivC

# 需要導入模塊: import z3 [as 別名]
# 或者: from z3 import If [as 別名]
def _sdivC(self, num, den):
        """Divide (signed) @num by @den (z3 values) as C would
        See modint.__div__ for implementation choice
        """
        result_sign = z3.If(num * den >= 0,
                            z3.BitVecVal(1, num.size()),
                            z3.BitVecVal(-1, num.size()),
        )
        return z3.UDiv(self._abs(num), self._abs(den)) * result_sign 
開發者ID:cea-sec,項目名稱:miasm,代碼行數:11,代碼來源:z3_ir.py

示例6: MSTORE

# 需要導入模塊: import z3 [as 別名]
# 或者: from z3 import If [as 別名]
def MSTORE(self, gstate, index, value):
        if isinstance(value, z3.BoolRef):
            value = z3.If(value, z3.BitVecVal(1, 256), z3.BitVecVal(0, 256))
        value_bytes = svm_utils.split_bv_into_bytes(value)
        for i in range(32):
            if svm_utils.is_bv_concrete(index):
                gstate.mstate.memory_dict[svm_utils.get_concrete_int(index)+i] = value_bytes[i]
            gstate.mstate.memory = z3.Store(gstate.mstate.memory, index+i, value_bytes[i]) 
開發者ID:eth-sri,項目名稱:ilf,代碼行數:10,代碼來源:execution.py

示例7: convert_to_bitvec

# 需要導入模塊: import z3 [as 別名]
# 或者: from z3 import If [as 別名]
def convert_to_bitvec(val):
    if isinstance(val, z3.BoolRef):
        return z3.If(val, z3.BitVecVal(1, 256), z3.BitVecVal(0, 256))
    elif isinstance(val, bool):
        return z3.BitVecVal(1, 256) if val else z3.BitVecVal(0, 256)
    elif isinstance(val, int):
        return z3.BitVecVal(val, 256)
    else:
        return z3.simplify(val) 
開發者ID:eth-sri,項目名稱:ilf,代碼行數:11,代碼來源:svm_utils.py

示例8: z3crc32

# 需要導入模塊: import z3 [as 別名]
# 或者: from z3 import If [as 別名]
def z3crc32(bytes, hash_table_size):  # computes the crc32 checksum in z3 format
    checksum = 0x00000000ffffffff
    for byte in bytes:
        checksum ^= z3.ZeroExt(56, byte) & 0xff
        for _ in range(8):  # test each bit in the byte we just xor'd in
            checksum = z3.If(checksum & 1 == z3.BitVecVal(1, 64),
                             z3.LShR(checksum, 1) ^ 0xedb88320,  # the binary representation of the CRC-32 polynomial
                             z3.LShR(checksum, 1))
    return (checksum ^ 0xffffffff) % hash_table_size 
開發者ID:twosixlabs,項目名稱:acsploit,代碼行數:11,代碼來源:crc32.py

示例9: hash3

# 需要導入模塊: import z3 [as 別名]
# 或者: from z3 import If [as 別名]
def hash3(name):
    h = z3.BitVecVal(0, 32)
    for i in range(len(name)):
        for j in range(8):
            h = z3.If(z3.LShR(name[i], j) & 1 == 1, (h + 1) & 0xff, h)
        h &= 0x1f
    return h 
開發者ID:integeruser,項目名稱:on-pwning,代碼行數:9,代碼來源:find_name_for_bits.py

示例10: z3Node

# 需要導入模塊: import z3 [as 別名]
# 或者: from z3 import If [as 別名]
def z3Node(self):
		return z3.If(self.cond.z3Node(), self.thn.z3Node(), self.els.z3Node()) 
開發者ID:jeanqasaur,項目名稱:jeeves,代碼行數:4,代碼來源:AST.py


注:本文中的z3.If方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。