commit 0adc1ba818124325d03961e53c1c6bedd3e90413 Author: Arturo Filastò art@torproject.org Date: Sat Jun 16 16:38:49 2012 +0200
Fix random mutation function to not be unfair towards unlucky people --- ooni/plugins/chinatrigger.py | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/ooni/plugins/chinatrigger.py b/ooni/plugins/chinatrigger.py index caa6a05..8a2418a 100644 --- a/ooni/plugins/chinatrigger.py +++ b/ooni/plugins/chinatrigger.py @@ -74,7 +74,10 @@ class ChinaTriggerTest(ScapyTest): Slightly changed mutate function. """ ret = pkt[:idx-1] - ret += chr(random.randint(0, 256)) + mutation = chr(random.randint(0, 256)) + while mutation == pkt[idx]: + mutation = chr(random.randint(0, 256)) + ret += mutation ret += pkt[idx:] return ret
tor-commits@lists.torproject.org