Skip to content

Commit 1381e9a

Browse files
author
Arthur Chan
committed
Fix problems
1 parent 88cec7b commit 1381e9a

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

startTool/startSpade.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,8 @@ def startSpade(workingPath, suffix, loopCount, fingerprint):
7070
#Get Audit Log
7171
os.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-
7873
if os.path.exists('%s/trace.dat' % workingPath):
74+
os.remove('%s/trace.dat' % workingPath)
7975

8076
subprocess.call('trace-cmd reset'.split(), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
8177
subprocess.call('trace-cmd start -e syscalls'.split(), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
@@ -96,14 +92,7 @@ def startSpade(workingPath, suffix, loopCount, fingerprint):
9692
file.write('end-end\n')
9793
file.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

10897
subprocess.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)
147136
else:
148-
startSpade(workingPath, '%s-%d' %(sffix, 2, fingerprint])
137+
startSpade(workingPath, '%s' % suffix, 2, fingerprint)
138+
149139
print (fingerprint)

0 commit comments

Comments
 (0)