Exemplo n.º 1
0
    def test_02_putdata(self):
        # fail if fake executable is present BEFORE putdata
        data = dbaccess.getdata()
        self.failIf("no such executable" in data.executables)

        # adding fake executable
        data.executables["no such executable"] = [
            ('no', 'such', 'sequence'),
        ]
        dbaccess.putdata(data)

        # fail if NOT present AFTER putdata
        data = dbaccess.getdata()
        self.failUnless("no such executable" in data.executables)

        # removing
        del data.executables["no such executable"]
        dbaccess.putdata(data)

        # fail if fake executable is present after removing it
        data = dbaccess.getdata()
        self.failIf("no such executable" in data.executables)
Exemplo n.º 2
0
    def test_02_putdata(self):
        # fail if fake executable is present BEFORE putdata
        data = dbaccess.getdata()
        self.failIf("no such executable" in data.executables)

        # adding fake executable 
        data.executables["no such executable"] = [ 
            ('no', 'such', 'sequence'), 
        ]
        dbaccess.putdata(data)

        # fail if NOT present AFTER putdata
        data = dbaccess.getdata()
        self.failUnless("no such executable" in data.executables)
        
        # removing
        del data.executables["no such executable"]
        dbaccess.putdata(data)

        # fail if fake executable is present after removing it
        data = dbaccess.getdata()
        self.failIf("no such executable" in data.executables)
Exemplo n.º 3
0
from reader import SetSyscallDataReader
import config
import dbaccess

msg = "%s database. Stop at any time with CTRL+C"

if not dbaccess.dbexists():
    print msg % "Creating"
    data = SetSyscallDataReader(input=sys.stdin)

else:
    print "Loading old data...",
    reader = dbaccess.getdata()
    print "done"

    dbaccess.check_seq_length_consistency(reader.sequence_lengths)

    print msg % "Updating"

    data = SetSyscallDataReader(input=sys.stdin, 
        data_to_merge=reader.executables)

dbaccess.putdata(data)

print "Database built into", config.FILENAME

print "Unique syscalls sequences per executable name:"

for execname in data.executables:
    print execname, len(data.executables[execname])