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


Python ida_diskio.get_user_idadir方法代码示例

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


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

示例1: update_pythonrc

# 需要导入模块: import ida_diskio [as 别名]
# 或者: from ida_diskio import get_user_idadir [as 别名]
def update_pythonrc():
    rcpath = os.path.join(ida_diskio.get_user_idadir(), "idapythonrc.py")
    sep_with_ver = SEP[0] + __version__.encode()
    payload = b'%s\n%s\n%s' % (sep_with_ver, RC.strip(), SEP[1])
    if os.path.isfile(rcpath):
        with open(rcpath, 'rb') as f:
            py = f.read()
            if payload in py:
                return

            if all(x in py for x in SEP):
                py = py.split(SEP[0], 1)
                py = py[0] + py[1].split(SEP[1], 1)[1]
            py = payload + py
            log.info('Updating idapkg into idapythonrc.py.')
    else:
        py = payload
        log.info('Added idapkg into idapythonrc.py. Will work after restarting!')

    with open(rcpath, 'wb') as f:
        f.write(py) 
开发者ID:Jinmo,项目名称:idapkg,代码行数:23,代码来源:main.py

示例2: update_pythonrc

# 需要导入模块: import ida_diskio [as 别名]
# 或者: from ida_diskio import get_user_idadir [as 别名]
def update_pythonrc():
    rcpath = os.path.join(ida_diskio.get_user_idadir(), "idapythonrc.py")
    sep_with_ver = SEP[0] + __version__
    payload = b'%s\n%s\n%s' % (sep_with_ver, RC.strip(), SEP[1])
    if os.path.isfile(rcpath):
        with open(rcpath, 'rb') as f:
            py = f.read()
            if payload in py and all(x in py for x in SEP):
                py = py.split(SEP[0], 1)
                py = py[0] + py[1].split(SEP[1], 1)[1]
    else:
        py = payload

    print('Removed idapkg from idapythonrc.py. '
          'I hope to see you again! :)')

    print(' You can remove ~/idapkg directory to remove packages and configurations.')

    with open(rcpath, 'wb') as f:
        f.write(py) 
开发者ID:Jinmo,项目名称:idapkg,代码行数:22,代码来源:uninstaller.py

示例3: _load_filters

# 需要导入模块: import ida_diskio [as 别名]
# 或者: from ida_diskio import get_user_idadir [as 别名]
def _load_filters(self, pw):
        filters = []
        filterdir = os.path.join(ida_diskio.idadir('plugins'), 'cyber')
        if not os.path.exists(filterdir):
            usr_plugins_dir = os.path.join(ida_diskio.get_user_idadir(), "plugins")
            filterdir = os.path.join(usr_plugins_dir, 'cyber')
        if os.path.exists(filterdir):
            sys.path.append(filterdir)
            for entry in os.listdir(filterdir):
                if entry.lower().endswith('.py') and entry.lower() != '__init__.py':
                    mod = os.path.splitext(entry)[0]
                    fmod = __import__(mod, globals(), locals(), [], 0)
                    if fmod is not None:
                        flt = fmod.FILTER_INIT(pw)
                        if flt is not None:
                            filters.append((fmod, flt))
        return filters 
开发者ID:patois,项目名称:IDACyber,代码行数:19,代码来源:idacyber.py

示例4: user_resource

# 需要导入模块: import ida_diskio [as 别名]
# 或者: from ida_diskio import get_user_idadir [as 别名]
def user_resource(directory, filename):
        """
        Return the absolute path to a resource located in the user directory.
        It should be:
        * %APPDATA%\\Roaming\\Hex-Rays\\IDA Pro\\plugin\\idarling under Windows
        * $HOME/.idapro/plugins/idarling under Linux and MacOS.
        """
        user_dir = ida_diskio.get_user_idadir()
        plug_dir = os.path.join(user_dir, "plugins")
        local_dir = os.path.join(plug_dir, "idarling")
        res_dir = os.path.join(local_dir, directory)
        if not os.path.exists(res_dir):
            os.makedirs(res_dir, 493)  # 0755
        return os.path.join(res_dir, filename) 
开发者ID:IDArlingTeam,项目名称:IDArling,代码行数:16,代码来源:plugin.py

示例5: get_user_directory

# 需要导入模块: import ida_diskio [as 别名]
# 或者: from ida_diskio import get_user_idadir [as 别名]
def get_user_directory(self):
        user_dir = ida_diskio.get_user_idadir()
        plug_dir = os.path.join(user_dir, "plugins")
        res_dir = os.path.join(plug_dir, "findcrypt-yara")
        if not os.path.exists(res_dir):
            os.makedirs(res_dir, 0o755)
        return res_dir 
开发者ID:polymorf,项目名称:findcrypt-yara,代码行数:9,代码来源:findcrypt3.py


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