[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r18406: {torflow} Relocate result files to falsepositive dir too. (torflow/trunk/NetworkScanners)
Author: mikeperry
Date: 2009-02-05 16:49:25 -0500 (Thu, 05 Feb 2009)
New Revision: 18406
Modified:
torflow/trunk/NetworkScanners/libsoat.py
torflow/trunk/NetworkScanners/soat.py
Log:
Relocate result files to falsepositive dir too.
Modified: torflow/trunk/NetworkScanners/libsoat.py
===================================================================
--- torflow/trunk/NetworkScanners/libsoat.py 2009-02-05 21:35:42 UTC (rev 18405)
+++ torflow/trunk/NetworkScanners/libsoat.py 2009-02-05 21:49:25 UTC (rev 18406)
@@ -328,6 +328,20 @@
replace('|','_').replace('*','_').replace('<','_').replace('>','_').replace('"',''))
return replaced[:200]
+ def resultFilename(self, result):
+ # XXX: Check existance and make a secondary name if exists.
+ dir = data_dir+result.proto.lower()+'/'
+ if result.false_positive:
+ dir += 'falsepositive/'
+ elif result.status == TEST_SUCCESS:
+ dir += 'successful/'
+ elif result.status == TEST_INCONCLUSIVE:
+ dir += 'inconclusive/'
+ elif result.status == TEST_FAILURE:
+ dir += 'failed/'
+
+ return dir+address+'.result.'+result.exit_node[1:]
+
def saveResult(self, result):
''' generic method for saving test results '''
address = ''
@@ -340,15 +354,7 @@
else:
raise Exception, 'This doesn\'t seems to be a result instance.'
- dir = data_dir+result.proto.lower()+'/'
- if result.status == TEST_SUCCESS:
- dir += 'successful/'
- if result.status == TEST_INCONCLUSIVE:
- dir += 'inconclusive/'
- if result.status == TEST_FAILURE:
- dir += 'failed/'
-
- result_file = open(dir+address+'.result.'+result.exit_node[1:], 'w')
+ result_file = open(self.resultFilename(result), 'w')
pickle.dump(result, result_file)
result_file.close()
Modified: torflow/trunk/NetworkScanners/soat.py
===================================================================
--- torflow/trunk/NetworkScanners/soat.py 2009-02-05 21:35:42 UTC (rev 18405)
+++ torflow/trunk/NetworkScanners/soat.py 2009-02-05 21:49:25 UTC (rev 18406)
@@ -402,7 +402,11 @@
if r.site == address:
kill_results.append(r)
for r in kill_results:
+ # Save this new result file in false positive dir
+ # and remove old one
+ os.unlink(self.datahandler.resultFilename(r))
r.mark_false_positive(reason)
+ self.datahandler.saveResult(r)
self.results.remove(r)
def register_exit_failure(self, address, exit_node):