@@ -70,12 +70,8 @@ def startSpade(workingPath, suffix, loopCount, fingerprint):
7070#Get Audit Log
7171os .chdir (stagePath )
7272
73- #Ensure no one writing to the file
74- while True :
75- if time .time () > os .path .getmtime ('/var/log/audit/audit.log' ) + 1 :
76- break ;
77-
7873if os .path .exists ('%s/trace.dat' % workingPath ):
74+ os .remove ('%s/trace.dat' % workingPath )
7975
8076subprocess .call ('trace-cmd reset' .split (), stdout = subprocess .DEVNULL , stderr = subprocess .DEVNULL )
8177subprocess .call ('trace-cmd start -e syscalls' .split (), stdout = subprocess .DEVNULL , stderr = subprocess .DEVNULL )
@@ -96,14 +92,7 @@ def startSpade(workingPath, suffix, loopCount, fingerprint):
9692file .write ('end-end\n ' )
9793file .close ()
9894
99- subprocess .call ('trace-cmd stop' .split (), stdout = subprocess .DEVNULL , stderr = subprocess .DEVNULL )
100- subprocess .call (('trace-cmd extract -o %s/trace.dat' % (workingPath )).split (), stdout = subprocess .DEVNULL , stderr = subprocess .DEVNULL )
101-
102- #Handle FTrace Fingerprint
103- ftraceResult = subprocess .check_output (('trace-cmd report -i %s/trace.dat' % (workingPath )).split (), stderr = subprocess .DEVNULL )
104- if ftraceResult :
105- syscallList = [line .split (':' )[1 ].strip () for line in ftraceResult .decode ('ascii' ).split ('\n ' ) if re .match (r'^\s*test-((?!wait4).)*$' ,line )]
106- fingerprintList .append (hashlib .md5 ('' .join (syscallList ).encode ()).hexdigest ())
95+ fingerprint = hashlib .md5 ('' .join (syscallList ).encode ()).hexdigest ()
10796
10897subprocess .check_output (rule0 .split ())
10998
@@ -143,7 +132,8 @@ def startSpade(workingPath, suffix, loopCount, fingerprint):
143132 loopCount = 0
144133 while not os .path .exists (outFile ) or os .path .getsize (outFile ) <= 162 :
145134 loopCount = loopCount + 1
146- startSpade (workingPath , '%s' % suffix , loopCount , fingerprint ] )
135+ startSpade (workingPath , '%s' % suffix , loopCount , fingerprint )
147136else :
148- startSpade (workingPath , '%s-%d' % (sffix , 2 , fingerprint ])
137+ startSpade (workingPath , '%s' % suffix , 2 , fingerprint )
138+
149139print (fingerprint )
0 commit comments