Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(44)  |  Call(31)  |  Derive(0)  |  Import(13)

        def log(obj, message):
    if settings.logging_on or settings.logging_on_verbose:
    # will out to file or console.
        print obj.__name__, message
        


src/u/b/ubi_reader-HEAD/modules/ubifs/walk.py   ubi_reader(Download)
from modules.ubifs import nodes
from modules.ubifs.defines import *
from modules.debug import error, log, verbose_log, verbose_display
 
def index(ubifs, lnum, offset, inodes={}):
        buf = ubifs.file.read(UBIFS_COMMON_HDR_SZ)
        chdr = nodes.common_hdr(buf)        
        log(index , '%s file addr: %s' % (chdr, ubifs.file.last_read_addr()))
        verbose_display(chdr)
 
    if chdr.node_type == UBIFS_IDX_NODE:
        idxn = nodes.idx_node(node_buf)
        log(index, '%s file addr: %s' % (idxn, file_offset))
        verbose_display(idxn)
        branch_idx = 0
        for branch in idxn.branches:
            verbose_log(index, '-------------------')
            log(index, '%s file addr: %s' % (branch, file_offset + UBIFS_IDX_NODE_SZ + (branch_idx * UBIFS_BRANCH_SZ)))
        inon = nodes.ino_node(node_buf)
        ino_num = inon.key['ino_num']
        log(index, '%s file addr: %s, ino num: %s' % (inon, file_offset, ino_num))
        verbose_display(inon)
 

src/u/b/ubi_reader-HEAD/modules/ubifs/__init__.py   ubi_reader(Download)
import struct
 
from modules.debug import error, log, verbose_display
from modules.ubifs.defines import *
from modules.ubifs import nodes, display
            self.file.reset()
            sb_chdr = nodes.common_hdr(self.file.read(UBIFS_COMMON_HDR_SZ))
            log(self , '%s file addr: %s' % (sb_chdr, self.file.last_read_addr()))
            verbose_display(sb_chdr)
 
                self._min_io_size = self._sb_node.min_io_size
                self._leb_size = self._sb_node.leb_size       
                log(self , '%s file addr: %s' % (self._sb_node, self.file.last_read_addr()))
                verbose_display(self._sb_node)
            else:
                self.file.seek(mst_offset)
                mst_chdr = nodes.common_hdr(self.file.read(UBIFS_COMMON_HDR_SZ))
                log(self , '%s file addr: %s' % (mst_chdr, self.file.last_read_addr()))
                verbose_display(mst_chdr)
 
                if mst_chdr.node_type == UBIFS_MST_NODE:
                    self.file.seek(mst_offset + UBIFS_COMMON_HDR_SZ)
                    buf = self.file.read(UBIFS_MST_NODE_SZ)
                    self._mst_nodes[i] = nodes.mst_node(buf)
                    log(self , '%s%s file addr: %s' % (self._mst_nodes[i], i, self.file.last_read_addr()))

src/u/b/ubi_reader-HEAD/modules/ubifs/output.py   ubi_reader(Download)
from modules.ubifs import walk
from modules.ubifs.misc import decompress
from modules.debug import error, log, verbose_log
 
 
            if not os.path.exists(dent_path):
                os.mkdir(dent_path)
                log(extract_dents, 'Make Dir: %s' % (dent_path))
 
                if perms:
                else:
                    os.link(inode['hlink'] ,dent_path)
                    log(extract_dents, 'Make Link: %s > %s' % (dent_path, inode['hlink']))
            else:
                buf = _process_reg_file(ubifs, inode, dent_path)
            # probably will need to decompress ino data if > UBIFS_MIN_COMPR_LEN
            os.symlink('%s' % inode['ino'].data, dent_path)
            log(extract_dents, 'Make Symlink: %s > %s' % (dent_path, inode['ino'].data))
        except Exception, e:
            error(extract_dents, 'Warn', 'SYMLINK Fail: %s : %s' % (inode['ino'].data, dent_path)) 
            if True:
                os.mknod(dent_path, inode['ino'].mode, dev)
                log(extract_dents, 'Make Device Node: %s' % (dent_path))
 
                if perms:

src/u/b/ubi_reader-HEAD/modules/ubi_io/__init__.py   ubi_reader(Download)
#############################################################
 
from modules.debug import error, log, verbose_log
from modules.ubi.block import sort
 
    def __init__(self, path, block_size, start_offset=0, end_offset=None):
        self.__name__ = 'UBI_File'
        self.is_valid = False
        try:
            log(self, 'Open Path: %s' % path)
        self._fhandle.seek(0,2)
        file_size = self.tell()
        log(self, 'File Size: %s' % file_size)
 
        self._start_offset = start_offset
        log(self, 'Start Offset: %s' % (self._start_offset))
        else:
            self._end_offset = file_size 
        log(self, 'End Offset: %s' % (self._end_offset))
 
        self._block_size = block_size

src/u/b/ubi_reader-HEAD/modules/ubi/block/__init__.py   ubi_reader(Download)
import re
from modules import settings
from modules.debug import error, log, verbose_display, verbose_log
from modules.ubi import display
from modules.ubi.defines import UBI_EC_HDR_SZ, UBI_VID_HDR_SZ, UBI_INTERNAL_VOL_START, UBI_EC_HDR_MAGIC
            blocks[blk.peb_num] = blk
            peb_count += 1
            log(extract_blocks, blk)
            verbose_log(extract_blocks, 'file addr: %s' % (ubi.file.last_read_addr()))
            verbose_display(blk)      

src/u/b/ubi_reader-HEAD/modules/utils.py   ubi_reader(Download)
 
import re
from modules.debug import error, log
from modules.ubi.defines import UBI_EC_HDR_MAGIC, FILE_CHUNK_SZ
from modules.ubifs.defines import UBIFS_NODE_MAGIC, UBIFS_SB_NODE_SZ, UBIFS_SB_NODE, UBIFS_COMMON_HDR_SZ
        if buf == UBI_EC_HDR_MAGIC:
            ftype = UBI_EC_HDR_MAGIC
            log(guess_filetype, 'File looks like a UBI image.')
 
        elif buf == UBIFS_NODE_MAGIC:
            ftype = UBIFS_NODE_MAGIC
            log(guess_filetype, 'File looks like a UBIFS image.')

src/u/b/ubi_reader-HEAD/ubi_utils_info.py   ubi_reader(Download)
from modules.ubifs.defines import PRINT_UBIFS_KEY_HASH, PRINT_UBIFS_COMPR
from modules.ubi_io import ubi_file, leb_virtual_file
from modules.debug import error, log
from modules.utils import guess_filetype, guess_start_offset, guess_peb_size
 
        try:
            os.makedirs(outpath)
            log(create_output_dir, 'Created output path: %s' % outpath)
        except Exception, e:
            error(create_output_dir, 'Fatal', '%s' % e)

src/u/b/ubi_reader-HEAD/extract_files.py   ubi_reader(Download)
from modules.ubifs.defines import UBIFS_NODE_MAGIC
from modules.ubi_io import ubi_file, leb_virtual_file
from modules.debug import error, log
from modules.utils import guess_filetype, guess_start_offset, guess_leb_size, guess_peb_size
 
        try:
            os.makedirs(outpath)
            log(create_output_dir, 'Created output path: %s' % outpath)
        except Exception, e:
            error(create_output_dir, 'Fatal', '%s' % e)

src/u/b/ubi_reader-HEAD/extract_images.py   ubi_reader(Download)
from modules.ubi.defines import UBI_EC_HDR_MAGIC
from modules.ubi_io import ubi_file
from modules.debug import error, log
from modules.utils import guess_filetype, guess_start_offset, guess_peb_size
 
def create_output_dir(outpath):
    if not os.path.exists(outpath):
        try:
            os.makedirs(outpath)
            log(create_output_dir, 'Created output path: %s' % outpath)

src/u/b/ubi_reader-HEAD/modules/ubi/block/layout.py   ubi_reader(Download)
#############################################################
 
from modules.debug import error, log
from modules.ubi.block import sort
 
                    layouts_grouped.append([blocks[l].peb_num])
 
        log(group_pairs, layouts_grouped)
        return layouts_grouped
    except Exception, e:

  1 | 2  Next