当前位置: 首页>>代码示例>>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;未经允许,请勿转载。