Module ida_diskio
[frames] | no frames]

Module ida_diskio

IDA Plugin SDK API wrapper: diskio

Classes
  generic_linput_t
Proxy of C++ generic_linput_t class.
Functions
 
close_linput(li)
Close loader input.
linput_t *
create_bytearray_linput(s)
Trivial memory linput.
linput_t *
create_generic_linput(gl)
Create a generic linput
linput_t *
create_memory_linput(start, size)
Create a linput for process memory.
 
eclose(fp)
PyObject *
enumerate_files(path, fname, callback)
Enumerate files in the specified directory while the callback returns 0.
FILE *
fopenA(file)
Open a file for append in text mode, deny none.
FILE *
fopenM(file)
Open a file for read/write in binary mode, deny write.
FILE *
fopenRB(file)
Open a file for read in binary mode, deny none.
FILE *
fopenRT(file)
Open a file for read in text mode, deny none.
FILE *
fopenWB(file)
Open a new file for write in binary mode, deny read/write.
FILE *
fopenWT(file)
Open a new file for write in text mode, deny write.
int
get_ida_subdirs(subdir, flags=0)
Get list of directories in which to find a specific IDA resource (see 'IDA subdirectories' ).
linput_type_t
get_linput_type(li)
Get linput type.
str
get_special_folder(csidl)
Get a folder location by CSIDL (see 'Common CSIDLs' ).
char const *
get_user_idadir()
Get user ida related directory.
str
getsysfile(filename, subdir)
Search for IDA system file.
char const *
idadir(subdir)
Get IDA directory (if subdir==NULL) or the specified subdirectory (see 'IDA subdirectories' )
linput_t *
open_linput(file, remote)
Open loader input.
str
qlgetz(li, fpos)
Read a zero-terminated string from the input.
Variables
  CFG_SUBDIR = 'cfg'
  CSIDL_APPDATA = 26
  CSIDL_LOCAL_APPDATA = 28
  CSIDL_PROGRAM_FILES = 38
  CSIDL_PROGRAM_FILESX86 = 42
  CSIDL_PROGRAM_FILES_COMMON = 43
  IDA_SUBDIR_IDADIR_FIRST = 2
  IDA_SUBDIR_IDP = 1
  IDA_SUBDIR_ONLY_EXISTING = 4
  IDC_SUBDIR = 'idc'
  IDP_SUBDIR = 'procs'
  IDS_SUBDIR = 'ids'
  LDR_SUBDIR = 'loaders'
  LINPUT_GENERIC = 4
  LINPUT_LOCAL = 1
  LINPUT_NONE = 0
  LINPUT_PROCMEM = 3
  LINPUT_RFILE = 2
  PLG_SUBDIR = 'plugins'
  SIG_SUBDIR = 'sig'
  SWIG_PYTHON_LEGACY_BOOL = 1
  THM_SUBDIR = 'themes'
  TIL_SUBDIR = 'til'
  __package__ = None
Function Details

close_linput(li)

 

Close loader input.

Parameters:
  • li, (C++ - linput_t *)

create_generic_linput(gl)

 

Create a generic linput

Parameters:
  • gl - linput description. this object will be destroyed by close_linput() using "delete gl;" (C++: generic_linput_t *)
Returns: linput_t *

create_memory_linput(start, size)

 

Create a linput for process memory. This linput will use read_dbg_memory() to read data.

Parameters:
  • start - starting address of the input (C++: ea_t)
  • size - size of the memory area to represent as linput if unknown, may be passed as 0 (C++: asize_t)
Returns: linput_t *

enumerate_files(path, fname, callback)

 

Enumerate files in the specified directory while the callback returns 0.

Parameters:
  • path - directory to enumerate files in
  • fname - mask of file names to enumerate
  • callback - a callable object that takes the filename as its first argument and it returns 0 to continue enumeration or non-zero to stop enumeration.
Returns: PyObject *
None in case of script errors tuple(code, fname) : If the callback returns non-zero

fopenA(file)

 

Open a file for append in text mode, deny none.

Parameters:
  • file, (C++ - const char *)
Returns: FILE *
NULL if failure

fopenM(file)

 

Open a file for read/write in binary mode, deny write.

Parameters:
  • file, (C++ - const char *)
Returns: FILE *
NULL if failure

fopenRB(file)

 

Open a file for read in binary mode, deny none.

Parameters:
  • file, (C++ - const char *)
Returns: FILE *
NULL if failure

fopenRT(file)

 

Open a file for read in text mode, deny none.

Parameters:
  • file, (C++ - const char *)
Returns: FILE *
NULL if failure

fopenWB(file)

 

Open a new file for write in binary mode, deny read/write. If a file exists, it will be removed.

Parameters:
  • file, (C++ - const char *)
Returns: FILE *
NULL if failure

fopenWT(file)

 

Open a new file for write in text mode, deny write. If a file exists, it will be removed.

Parameters:
  • file, (C++ - const char *)
Returns: FILE *
NULL if failure

get_ida_subdirs(subdir, flags=0)

 
Get list of directories in which to find a specific IDA resource (see
'IDA subdirectories' ). The order of the resulting list is as follows:

- [$IDAUSR/subdir (0..N entries)]
- $IDADIR/subdir

@param subdir: name of the resource to list (C++: const char *)
@param flags: Subdirectory modification flags  bits (C++: int)
@return: number of directories appended to 'dirs'

Returns: int

get_linput_type(li)

 

Get linput type.

Parameters:
  • li, (C++ - linput_t *)
Returns: linput_type_t

get_special_folder(csidl)

 

Get a folder location by CSIDL (see 'Common CSIDLs' ). Path should be of at least MAX_PATH size

Parameters:
  • csidl, (C++ - int)
Returns: str

get_user_idadir()

 
Get user ida related directory.

- if $IDAUSR is defined:
    - the first element in $IDAUSR
- else
    - default user directory ($HOME/.idapro or %APPDATA%Hex-Rays/IDA Pro)

Returns: char const *

getsysfile(filename, subdir)

 

Search for IDA system file. This function searches for a file in:each directory specified by IDAUSR%ida directory [+ subdir] and returns the first match.

Parameters:
  • filename, (C++ - const char *)
  • subdir, (C++ - const char *)
Returns: str
NULL if not found, otherwise a pointer to full file name.

idadir(subdir)

 

Get IDA directory (if subdir==NULL) or the specified subdirectory (see 'IDA subdirectories' )

Parameters:
  • subdir, (C++ - const char *)
Returns: char const *

open_linput(file, remote)

 

Open loader input.

Parameters:
  • file, (C++ - const char *)
  • remote, (C++ - bool)
Returns: linput_t *

qlgetz(li, fpos)

 

Read a zero-terminated string from the input. If fpos == -1 then no seek will be performed.

Parameters:
  • li, (C++ - linput_t *)
  • fpos, (C++ - int64)
Returns: str