How to use the crash.Crash function in crash

To help you get started, we’ve selected a few crash examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github naturalness / partycrasher / lp / lp_files_to_es.py View on Github external
try:
                    print "Disk: " + database_id
                    crashdata = crash.Crash.load_from_file(bugdir)
                except IOError as e:
                    if "No stacktrace" in str(e):
                        no_stacktrace += 1
                        continue
                    else:
                        raise
                crashdata = ESCrash(crashdata)
            try:
                oracledata = ESCrash(database_id, index='oracle')
            except:
                oracledata = None
            if oracledata is None:
                oracledata = crash.Crash({
                    'database_id': database_id,
                    'bucket': bucket,
                    })
                oracledata = ESCrash(oracledata, index='oracle')
            else:
                oracledata['bucket'] = bucket
            bugs_total += 1
print str(bugs_total) + " loaded"
print str(no_stacktrace) + " thrown out because of unparsable stacktraces"
github saelo / iCrashalyzer / parser.py View on Github external
def process(self, report):
        crash = Crash()

        # extract basic information
        self.extract('id', report, crash)
        self.extract('os', report, crash)
        self.extract('device', report, crash)

        if 'Largest process' in report:
            # crashed due to low memory
            crash.domain = Crash.USERLAND
            crash.type = Crash.LOWMEM
            return crash

        if 'iBoot version' in report:
            # kernel panic
            crash.domain = Crash.KERNEL
            if 'WDT timeout' in report:         # basic detection for panics caused by the watchdog timer
github microsoft / ptvsd / src / ptvsd / _vendored / pydevd / pydevd_attach_to_process / winappdbg / sql.py View on Github external
def toCrash(self, getMemoryDump = False):
        """
        Returns a L{Crash} object using the data retrieved from the database.

        @type  getMemoryDump: bool
        @param getMemoryDump: If C{True} retrieve the memory dump.
            Defaults to C{False} since this may be a costly operation.

        @rtype:  L{Crash}
        @return: Crash object.
        """
        crash = Marshaller.loads(str(self.data))
        if not isinstance(crash, Crash):
            raise TypeError(
                "Expected Crash instance, got %s instead" % type(crash))
        crash._rowid = self.id
        if not crash.memoryMap:
            memory = getattr(self, "memory", [])
            if memory:
                crash.memoryMap = [dto.toMBI(getMemoryDump) for dto in memory]
        return crash
github naturalness / partycrasher / lp / lp_files_to_es.py View on Github external
buckets.append(bucket)
    for bugdir in buglist:
        bugdir = os.path.join(bucketdir, bugdir)
        assert os.path.isdir(bugdir)
        #print repr(os.listdir(bugdir))
        if len(os.listdir(bugdir)) > 1:
            database_id = 'launchpad:'+os.path.basename(bugdir)
            try:
                crashdata = ESCrash(database_id)
                print "ES: " + database_id
            except:
                crashdata = None
            if crashdata is None:
                try:
                    print "Disk: " + database_id
                    crashdata = crash.Crash.load_from_file(bugdir)
                except IOError as e:
                    if "No stacktrace" in str(e):
                        no_stacktrace += 1
                        continue
                    else:
                        raise
                crashdata = ESCrash(crashdata)
            try:
                oracledata = ESCrash(database_id, index='oracle')
            except:
                oracledata = None
            if oracledata is None:
                oracledata = crash.Crash({
                    'database_id': database_id,
                    'bucket': bucket,
                    })
github saelo / iCrashalyzer / main.py View on Github external
crashes.append(crashalyzer.analyze_report(report))
    else:
        print("[!] could not open file %s, skipping" % entry)

if args.unique:
    unique_crashes = []
    for crash in crashes:
        if not crash in unique_crashes:
            unique_crashes.append(crash)
        else:
            print("[*] %s is (likely) a duplicate of %s" % (crash.id, unique_crashes[unique_crashes.index(crash)].id))

    crashes = unique_crashes

if args.verbose:
    Crash.verbosity += args.verbose

if args.all:
    Crash.output_all = True

if args.output:
    out = open(args.output, 'w+')

for crash in crashes:
    if out:
        out.write(str(crash) + '\n')
    else:
        print('\n' + str(crash))

if out:
    out.close()
github naturalness / partycrasher / partycrasher / comparer.py View on Github external
def alt_bucket(self, crash, field='bucket'):
        assert isinstance(crash, Crash)
        matches = self.es.search(
        index=self.index,
        body={
            'query': {
                'filtered':{
                    'query': {
                        'match_all': {}
                        },
                    'filter': {
                        'term': {
                            self.name: self.get_signature(crash),
                        }
                    }
                }
            },
            'aggregations': {
github saelo / iCrashalyzer / parser.py View on Github external
# extract basic information
        self.extract('id', report, crash)
        self.extract('os', report, crash)
        self.extract('device', report, crash)

        if 'Largest process' in report:
            # crashed due to low memory
            crash.domain = Crash.USERLAND
            crash.type = Crash.LOWMEM
            return crash

        if 'iBoot version' in report:
            # kernel panic
            crash.domain = Crash.KERNEL
            if 'WDT timeout' in report:         # basic detection for panics caused by the watchdog timer
                crash.type = Crash.TIMEOUT
            else:
                crash.type = Crash.KFAULT
                self.extract('pc', report, crash)
                if int(crash.numeric_os()[0]) < 6:
                    # no KASLR before iOS 6
                    crash.kbase = '0x80002000'  # assume default base address
                else:
                    self.extract('kbase', report, crash)
                self.extract('kfa', report, crash)
        else:
            # userland crash
            crash.domain = Crash.USERLAND
            if 'RPCTimeout message received to terminate' in report:
                crash.type = Crash.TIMEOUT
                self.extract('procto', report, crash)
            else: