Changeset 219 for test


Ignore:
Timestamp:
03/31/11 00:29:09 (13 years ago)
Author:
tim
Message:

updated time conversion to return a double for more precision
added modified attribute to keys to obtain user friendly time value
added accessor for key classnames
converted data attributes to functions to make workload more explicit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/pyregfi-smoketest.py

    r218 r219  
    8282    for k in hive:
    8383        for v in k.values:
    84             d = v.data
     84            d = v.fetch_data()
    8585            if d == None:
    8686                data_stat += 0.1
     
    9090                data_stat += d/2.0**64
    9191
    92             d = v.data_raw
     92            d = v.fetch_raw_data()
    9393            if d == None:
    9494                dataraw_stat += 0.1
     
    133133
    134134
     135# Iterates hive gathering stats about security and classname records
     136def iterFetchRelated(hive):
     137    security_stat = 0.0
     138    classname_stat = 0.0
     139    modified_stat = 0.0
     140
     141    for k in hive:
     142        cn = k.fetch_classname()
     143        if cn == None:
     144            classname_stat += 0.000001
     145        elif type(cn) == bytearray:
     146            classname_stat += len(cn)/2**32
     147        else:
     148            classname_stat += len(cn)
     149
     150        modified_stat += k.modified
     151       
     152    print("  Security stat: %f" % security_stat)
     153    print("  Classname stat: %f" % classname_stat)
     154    print("  Modified stat: %f" % modified_stat)
     155
    135156if len(sys.argv) < 2:
    136157    usage()
     
    138159
    139160
    140 #tests = [("iterTallyNames",iterTallyNames),("iterParentWalk",iterParentWalk),("iterTallyData",iterTallyData),]
    141 tests = [("recurseKeyTally",recurseKeyTally),("iterParentWalk",iterParentWalk),]
     161#tests = [("iterTallyNames",iterTallyNames),("iterParentWalk",iterParentWalk),("iterTallyData",iterTallyData),("recurseKeyTally",recurseKeyTally),("iterFetchRelated",iterFetchRelated),]
     162tests = [("iterFetchRelated",iterFetchRelated),]
    142163
    143164files = []
Note: See TracChangeset for help on using the changeset viewer.