Beispiel #1
0
def main():
    num = 0
    for filename, path in get_sqlite_files("../sqlite"):
        try:
            cx = sqlite3.connect(path)
            cx.text_factory = str
            cu=cx.cursor()

            cu.execute("select microThreadId, sessionId, s2cIp, s2cPort, c2sIp, c2sPort from ZealotMicroThread")
            for i in cu.fetchall():
                microThreadId, sessionId, s2cIp, s2cPort, c2sIp, c2sPort = i

            pacp = Pcap(microThreadId,sessionId,s2cIp,s2cPort,c2sIp,c2sPort,filename)
            cu.execute("select fid,data from ZealotNumericData")
            for i in cu.fetchall():
                fid,data = i
                pacp.setf(fid,data)

            cu.execute("select data from ZealotFieldData")
            data = []
            part= []
            for i in cu.fetchall():
                if i == (None,):
                    print "fail"
                    continue
                print i
                temp = binascii.b2a_qp(i[0]).strip().strip('"').strip()
                data.append(temp)
                part.append(segmentation_common2word_split(temp))

            pacp.coarse_part = "||".join(data)
            pacp.fine_part = " | | ".join(part)

            db.insert_db(pacp)
            num += 1
            print num
        except Exception as e:
            import traceback
            logging.error(traceback.format_exc())
            num += 1
            raise Exception(e)
Beispiel #2
0
 def part(self, data):
     return segmentation_common2word_split(data)