Changeset 721
- Timestamp:
- 05/25/07 22:40:00 (6 years ago)
- Location:
- branch/umitdb/datahandler
- Files:
-
- 5 modified
-
connection.py (modified) (1 diff)
-
demo_xml_insertion.py (modified) (2 diffs)
-
retrieve.py (modified) (1 diff)
-
store.py (modified) (1 diff)
-
xmlstore.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branch/umitdb/datahandler/connection.py
r720 r721 37 37 debug("Openning connection to database; %s" % database) 38 38 39 self.conn = sqlite.connect(database )39 self.conn = sqlite.connect(database, detect_types=sqlite.PARSE_COLNAMES) 40 40 self.cursor = self.conn 41 41 -
branch/umitdb/datahandler/demo_xml_insertion.py
r719 r721 1 1 import sys 2 import time 2 3 import timing 3 4 from xmlstore import XMLStore … … 5 6 if __name__ == "__main__": 6 7 if len(sys.argv) < 2: 7 print "Specify a XML file."8 print "Specify at least one XML file." 8 9 sys.exit(0) 9 10 11 start = time.ctime() 12 10 13 timing.start() 14 storing = XMLStore("schema-testing.db") 15 for file in sys.argv[1:]: 16 storing.store_xml(file) 17 timing.finish() 11 18 12 XMLStore("schema-testing.db", sys.argv[1])13 14 timing.finish()15 print timing.milli()19 print "Started on:", start 20 print "Finished on:", time.ctime() 21 print "No. of files specified:", len(sys.argv[1:]) 22 print "It took", timing.milli(), "miliseconds to complete operation." -
branch/umitdb/datahandler/retrieve.py
r720 r721 50 50 normalize(info) 51 51 52 info["ostype"] = empty() # FIX: Parser not handling this yet.52 info["ostype"] = empty() # ToFix: Parser isnt storing this 53 53 54 54 data = (info["service_product"], info["service_version"], -
branch/umitdb/datahandler/store.py
r720 r721 189 189 debug("Inserting new osmatch into database") 190 190 191 osmatch["line"] = empty() # FIX: it seems parser isnt storing this191 osmatch["line"] = empty() # ToFix: Parser isnt storing this 192 192 self.cursor.execute("INSERT INTO osmatch (name, accuracy, line, \ 193 193 fk_host) VALUES (?, ?, ?, ?)", (osmatch["name"], -
branch/umitdb/datahandler/xmlstore.py
r720 r721 18 18 # USA 19 19 20 from datetime import datetime 20 21 from umitCore.NmapParser import NmapParser 21 22 from connection import ConnectDB … … 44 45 45 46 if xml_file: 46 self. insert_xml(xml_file)47 self.store_xml(xml_file) 47 48 48 49 49 def insert_xml(self, xml_file):50 def store_xml(self, xml_file): 50 51 """ 51 52 Inserts xml file into database. … … 73 74 temp_d = { } 74 75 75 temp_d["distance"] = empty() 76 temp_d["distance"] = empty() # ToFix: Parser isnt storing this 76 77 temp_d["uptime"] = host.uptime["seconds"] 77 78 temp_d["lastboot"] = host.uptime["lastboot"] … … 371 372 scan_d = { } 372 373 scan_d["args"] = parsedsax.nmap["nmaprun"]["args"] 373 scan_d["start"] = parsedsax.nmap["nmaprun"]["start"] 374 scan_d["startstr"] = empty() 375 scan_d["finish"] = parsedsax.nmap["runstats"]["finished_time"] 376 scan_d["finishstr"] = empty() 374 timestamp_start = parsedsax.nmap["nmaprun"]["start"] 375 scan_d["start"] = datetime.fromtimestamp(float(timestamp_start)) 376 scan_d["startstr"] = empty() # ToFix: Parser isnt storing this 377 timestamp_finish = parsedsax.nmap["runstats"]["finished_time"] 378 scan_d["finish"] = datetime.fromtimestamp(float(timestamp_finish)) 379 scan_d["finishstr"] = empty() # ToFix: Parser isnt storing this 377 380 scan_d["xmloutputversion"] = parsedsax.nmap["nmaprun"]["xmloutputversion"] 378 381 if self.store_original: … … 392 395 # get fk_scanner 393 396 scanner_id = self.get_scanner_id_from_db(scanner_name, 394 scanner_version)397 scanner_version) 395 398 if not scanner_id: 396 399 self.insert_scanner_db(scanner_name, scanner_version)
