本文整理匯總了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)
示例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)
示例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
示例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)
示例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