-
Notifications
You must be signed in to change notification settings - Fork 144
/
testing_equality.py
executable file
·61 lines (52 loc) · 1.51 KB
/
testing_equality.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python2
## -*- coding: utf-8 -*-
import sys
import random
import subprocess
bad = 0.0
test = 0.0
if len(sys.argv) != 3:
print 'Syntax: %s <tigress binary> <clean binary>'
sys.exit(-1)
tigress = sys.argv[1]
triton = sys.argv[2]
for x in range(1000):
ret1 = subprocess.check_output([tigress, str(x)])
ret2 = subprocess.check_output([triton, str(x)])
if ret1 != ret2:
print '[-] Invalid with %d' %(x)
bad += 1
else:
print '[+] Success with %d' %(x)
test += 1
for i in range(1000):
x = random.randrange(0, 0xffff)
ret1 = subprocess.check_output([tigress, str(x)])
ret2 = subprocess.check_output([triton, str(x)])
if ret1 != ret2:
print '[-] Invalid with %d' %(x)
bad += 1
else:
print '[+] Success with %d' %(x)
test += 1
for i in range(1000):
x = random.randrange(0xffff, 0xffffffff)
ret1 = subprocess.check_output([tigress, str(x)])
ret2 = subprocess.check_output([triton, str(x)])
if ret1 != ret2:
print '[-] Invalid with %d' %(x)
bad += 1
else:
print '[+] Success with %d' %(x)
test += 1
for i in range(1000):
x = random.randrange(0xffffffff, 0xffffffffffffffff)
ret1 = subprocess.check_output([tigress, str(x)])
ret2 = subprocess.check_output([triton, str(x)])
if ret1 != ret2:
print '[-] Invalid with %d' %(x)
bad += 1
else:
print '[+] Success with %d' %(x)
test += 1
print '[+] Success: %.02f' %(100 - (bad * 100.0 / test))