当前位置: 首页>>代码示例>>Python>>正文


Python Misc.is_64bit方法代码示例

本文整理汇总了Python中jarvis.core.helpers.Misc.is_64bit方法的典型用法代码示例。如果您正苦于以下问题:Python Misc.is_64bit方法的具体用法?Python Misc.is_64bit怎么用?Python Misc.is_64bit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jarvis.core.helpers.Misc的用法示例。


在下文中一共展示了Misc.is_64bit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_dangerous_args

# 需要导入模块: from jarvis.core.helpers import Misc [as 别名]
# 或者: from jarvis.core.helpers.Misc import is_64bit [as 别名]
    def get_dangerous_args(self, ea):
        """
        Find the dangerous function arguments
        Ex. "call strncpy" find the third push,
        which should correspond to the size argument
        @returns: list of arguments (may be empty)
        """

        # TODO: x86 only at the moment, x64 at least
        # TODO: the algo as a whole is flaky...
        # which paths are being considered?
        if misc.is_64bit():
            raise NotImplementedError

        prev_addr = ea
        dang_args = []
        dang_name = GetOpnd(ea, 0)
        dang_arg_idx = 0

        for pat, arg_idx in self.dangerous_patterns.iteritems():
            if pat in dang_name:
                dang_arg_idx = arg_idx

        while dang_arg_idx > 0:
            pi = DecodePreviousInstruction(prev_addr)

            # DecodePreviousInstruction returns None if we try
            # to decode past the beginning of the function
            if not pi:
                return []

            if pi.get_canon_mnem() == 'push':
                dang_arg_idx -= 1
                push_op = GetOpnd(pi.ea, 0)
                dang_args.append(push_op)

            prev_addr = pi.ea

        return dang_args
开发者ID:0xr0ot,项目名称:JARVIS,代码行数:41,代码来源:IntegerIssues.py

示例2: get_dangerous_args

# 需要导入模块: from jarvis.core.helpers import Misc [as 别名]
# 或者: from jarvis.core.helpers.Misc import is_64bit [as 别名]
    def get_dangerous_args(self, ea):
        """
        Find the dangerous function arguments
        Ex. "call strncpy" find the third push,
        which should correspond to the size argument
        @returns: list of arguments (may be empty)
        """
        dang_name = GetOpnd(ea, 0)
        dang_arg_idx = 0
        #x86_64_regs = ['rdi', 'rsi', 'rdx', 'rcx', 'r8', 'r9'] # System V AMD64 ABI
        x86_64_regs = ['rcx', 'rdx', 'r8', 'r9'] # Microsoft x64

        # TODO: the algo as a whole is flaky...
        # which paths are being considered?
        for pat, arg_idx in self.dangerous_patterns.iteritems():
            if pat in dang_name:
                dang_arg_idx = arg_idx

        if misc.is_64bit():
            return x86_64_regs[:dang_arg_idx]

        prev_addr = ea
        dang_args = []
        while dang_arg_idx > 0:
            pi = DecodePreviousInstruction(prev_addr)

            # DecodePreviousInstruction returns None if we try
            # to decode past the beginning of the function
            if not pi:
                return []

            if pi.get_canon_mnem() == 'push':
                dang_arg_idx -= 1
                push_op = GetOpnd(pi.ea, 0)
                dang_args.append(push_op)

            prev_addr = pi.ea

        return dang_args
开发者ID:carlosgprado,项目名称:JARVIS,代码行数:41,代码来源:IntegerIssues.py


注:本文中的jarvis.core.helpers.Misc.is_64bit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。