Ejemplo n.º 1
0
    def update_scan_result(self):
        match_count = self.backend.get_match_count()
        self.found_count_label.set_text(_('Found: %d') % (match_count, ))
        if (match_count > SCAN_RESULT_LIST_LIMIT):
            self.scanresult_liststore.clear()
        else:
            self.command_lock.acquire()
            lines = self.backend.send_command('list', get_output=True)
            self.command_lock.release()

            self.scanresult_tv.set_model(None)
            # temporarily disable model for scanresult_liststore for the sake of performance
            self.scanresult_liststore.clear()
            for line in lines:
                line = misc.decode(line)
                (mid, line) = line.split(']', 1)
                mid = int(mid.strip(' []'))
                (addr, off, rt, val,
                 t) = list(map(str.strip,
                               line.split(',')[:5]))
                addr = int(addr, 16)
                off = int(off.split('+')[1], 16)
                t = t.strip(' []')
                if t == 'unknown':
                    continue
                self.scanresult_liststore.append(
                    [addr, val, t, True, off, rt, mid])
            self.scanresult_tv.set_model(self.scanresult_liststore)
Ejemplo n.º 2
0
    def mabyDoPasswordAndLogins(self, screen):
        if Config.getboolean("Misc", "saveLogins"):
            screen.ids["UsrNameInput"].text = Config.get("Misc", "username")
            screen.ids["PwdInput"].text = decode(
                str(Config.get("Misc", "password")), "JonIsGreen")

            Logger.info("Logins: Loaded")
Ejemplo n.º 3
0
 def __init__(self, libpath='libscanmem.so'):
     self._lib = ctypes.CDLL(libpath)
     self._init_lib_functions()
     self._lib.sm_set_backend()
     self._lib.sm_init()
     self.send_command('reset')
     self.version = misc.decode(self._lib.sm_get_version())
Ejemplo n.º 4
0
 def bytes2value(self, typename, databytes):
     if databytes is None:
         return None
     if typename in TYPENAMES_G2STRUCT:
         return struct.unpack(TYPENAMES_G2STRUCT[typename], databytes)[0]
     elif typename == 'string':
         return misc.decode(databytes, 'replace')
     elif typename == 'bytearray':
         databytes = misc.str2bytes(databytes)
         return ' '.join(['%02x' % (i, ) for i in databytes])
     else:
         return databytes
Ejemplo n.º 5
0
    def matches(self):
        """
        Returns a generator of (match_id_str, addr_str, off_str, region_type, value, types_str) for each match, all strings.
        The function executes commands internally, it is NOT thread safe
        """
        list_bytes = self.send_command('list', get_output=True)
        lines = filter(None, misc.decode(list_bytes).split('\n'))

        line_regex = re.compile(
            r'^\[ *(\d+)\] +([\da-f]+), +\d+ \+ +([\da-f]+), +(\w+), (.*), +\[([\w ]+)\]$'
        )
        for line in lines:
            yield line_regex.match(line).groups()
Ejemplo n.º 6
0
 def get_version(self):
     return misc.decode(self.lib.sm_get_version())
Ejemplo n.º 7
0
 def get_version(self):
     return misc.decode(self.lib.sm_get_version())