Module pywraps :: Class loader_input_t
[frames] | no frames]

Class loader_input_t

??-206 --+
         |
        loader_input_t

A helper class to work with linput_t related functions. This class is also used by file loaders scripts.

Instance Methods
 
__init__(self)
 
close(self)
Closes the file
 
open(self, filename, remote=False)
Opens a file (or a remote file)
 
set_linput(self, linput)
Links the current loader_input_t instance to a linput_t instance
 
open_memory(self, start, size)
Create a linput for process memory (By internally calling idaapi.create_memory_linput()) This linput will use dbg->read_memory() to read data
 
seek(self, pos, whence=SEEK_SET)
Set input source position
 
tell(self)
Returns the current position
 
getz(self, sz, fpos=-1)
Returns a zero terminated string at the given position
 
gets(self, len)
Reads a line from the input file.
 
read(self, size)
Reads from the file.
 
readbytes(self, size, big_endian)
Similar to read() but it respect the endianness
 
file2base(self, pos, ea1, ea2, patchable)
Load portion of file into the database This function will include (ea1..ea2) into the addressing space of the program (make it enabled)
 
get_char(self)
Reads a single character from the file.
 
opened(self)
Checks if the file is opened or not
Static Methods
 
from_fp(fp)
A static method to construct an instance from a FILE*
Method Details

open(self, filename, remote=False)

 

Opens a file (or a remote file)

Returns:
Boolean

open_memory(self, start, size)

 

Create a linput for process memory (By internally calling idaapi.create_memory_linput()) This linput will use dbg->read_memory() to read data

Parameters:
  • start - starting address of the input
  • size - size of the memory area to represent as linput if unknown, may be passed as 0

seek(self, pos, whence=SEEK_SET)

 

Set input source position

Returns:
the new position (not 0 as fseek!)

getz(self, sz, fpos=-1)

 

Returns a zero terminated string at the given position

Parameters:
  • sz - maximum size of the string
  • fpos - if != -1 then seek will be performed before reading
Returns:
The string or None on failure.

gets(self, len)

 

Reads a line from the input file. Returns the read line or None

read(self, size)

 

Reads from the file. Returns the buffer or None

file2base(self, pos, ea1, ea2, patchable)

 

Load portion of file into the database This function will include (ea1..ea2) into the addressing space of the program (make it enabled)

Parameters:
  • li - pointer ot input source
  • pos - position in the file
  • (ea1..ea2) - range of destination linear addresses
  • patchable - should the kernel remember correspondance of file offsets to linear addresses.
Returns:
1-ok,0-read error, a warning is displayed

get_char(self)

 

Reads a single character from the file. Returns None if EOF or the read character