From 649fabf3e986c7c51ee36beb4a9df9710400389f Mon Sep 17 00:00:00 2001 From: Alan Yee Date: Mon, 30 Sep 2019 10:00:41 -0700 Subject: [PATCH 1/2] Update SHAtter.py -Succinct standard error print statements -Enforce PEP 8 style for import statements --- SHAtter.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/SHAtter.py b/SHAtter.py index 4febed64..718fba24 100755 --- a/SHAtter.py +++ b/SHAtter.py @@ -1,6 +1,9 @@ # Credit: This file is based on SHAtter exploit (segment overflow) by posixninja and pod2g. -import struct, sys, time +import struct +import sys +import time + import dfu def generate_payload(): @@ -24,13 +27,11 @@ def exploit(): return if 'CPID:8930' not in device.serial_number: - print 'ERROR: Not a compatible device. This exploit is for S5L8930 devices only. Exiting.' - sys.exit(1) + sys.exit('ERROR: Not a compatible device. This exploit is for S5L8930 devices only. Exiting.') if 'SRTG:[iBoot-574.4]' not in device.serial_number: print 'ERROR: CPID is compatible, but serial number string does not match.' - print 'Make sure device is in SecureROM DFU Mode and not LLB/iBSS DFU Mode. Exiting.' - sys.exit(1) + sys.exit('Make sure device is in SecureROM DFU Mode and not LLB/iBSS DFU Mode. Exiting.') dfu.reset_counters(device) dfu.get_data(device, 0x40) @@ -69,7 +70,6 @@ def exploit(): dfu.release_device(device) if failed: - print 'ERROR: Exploit failed. Device did not enter pwned DFU Mode.' - sys.exit(1) + sys.exit('ERROR: Exploit failed. Device did not enter pwned DFU Mode.') print 'Device is now in pwned DFU Mode.' From cc644e23fdf9e93ec28bf6d92e67d8a69136e1a9 Mon Sep 17 00:00:00 2001 From: Alan Yee Date: Mon, 30 Sep 2019 10:10:01 -0700 Subject: [PATCH 2/2] Update SHAtter.py Maintain previously print behavior while including both sentences in stderr --- SHAtter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SHAtter.py b/SHAtter.py index 718fba24..5dfda9c9 100755 --- a/SHAtter.py +++ b/SHAtter.py @@ -30,8 +30,8 @@ def exploit(): sys.exit('ERROR: Not a compatible device. This exploit is for S5L8930 devices only. Exiting.') if 'SRTG:[iBoot-574.4]' not in device.serial_number: - print 'ERROR: CPID is compatible, but serial number string does not match.' - sys.exit('Make sure device is in SecureROM DFU Mode and not LLB/iBSS DFU Mode. Exiting.') + sys.exit('ERROR: CPID is compatible, but serial number string does not match.\n' + 'Make sure device is in SecureROM DFU Mode and not LLB/iBSS DFU Mode. Exiting.') dfu.reset_counters(device) dfu.get_data(device, 0x40)