From 541ba512dae46c8aa0e33618e79bd6fdbed435c0 Mon Sep 17 00:00:00 2001 From: 4am Date: Tue, 29 Jan 2019 20:55:25 -0500 Subject: [PATCH] add SunburstPatcher --- passport.py | 3 +- passport/__init__.py | 2 +- passport/patchers/__init__.py | 2 +- passport/patchers/bademu.py | 1 - passport/patchers/sunburst.py | 53 ++++++++++++++++++++++++++++++++ passport/patchers/universale7.py | 2 +- passport/strings.py | 4 ++- 7 files changed, 60 insertions(+), 7 deletions(-) create mode 100644 passport/patchers/sunburst.py diff --git a/passport.py b/passport.py index 90b16b9..b184d08 100755 --- a/passport.py +++ b/passport.py @@ -6,12 +6,11 @@ from passport import eddimage, wozardry, a2rimage from passport import DefaultLogger, DebugLogger from passport import Crack, Verify, Convert -from passport.strings import STRINGS +from passport.strings import __date__, STRINGS import argparse import os.path __version__ = "0.2" # https://semver.org/ -__date__ = "2019-01-29" __progname__ = "passport" class BaseCommand: diff --git a/passport/__init__.py b/passport/__init__.py index 311a35a..2336419 100755 --- a/passport/__init__.py +++ b/passport/__init__.py @@ -586,7 +586,7 @@ class BasePassportProcessor: # base class self.patches_found = [] self.patch_count = 0 # number of patches found across all tracks self.patcher_classes = [ - #SunburstPatcher, + sunburst.SunburstPatcher, #JMPBCF0Patcher, #JMPBEB1Patcher, #JMPBECAPatcher, diff --git a/passport/patchers/__init__.py b/passport/patchers/__init__.py index 534480e..bbd219f 100644 --- a/passport/patchers/__init__.py +++ b/passport/patchers/__init__.py @@ -14,6 +14,7 @@ __all__ = [ "mecc4", "microfun", "rwts", + "sunburst", "universale7", ] @@ -41,4 +42,3 @@ class Patcher: # base class def run(self, logical_sectors, track_num): """returns list of Patch objects representing patches that could be applied to logical_sectors""" return [] - diff --git a/passport/patchers/bademu.py b/passport/patchers/bademu.py index 5702efe..77eee17 100644 --- a/passport/patchers/bademu.py +++ b/passport/patchers/bademu.py @@ -22,4 +22,3 @@ tested on b'\xC9\xD5' b'\xF0\x12'): return [] return [Patch(0, 3, 0x58, b'\xF0\x06')] - return patches diff --git a/passport/patchers/sunburst.py b/passport/patchers/sunburst.py new file mode 100644 index 0000000..e417dd4 --- /dev/null +++ b/passport/patchers/sunburst.py @@ -0,0 +1,53 @@ +from passport.patchers import Patch, Patcher +from passport.util import * + +class SunburstPatcher(Patcher): + """RWTS with track-based address and data prologue modifications + +tested on +- Challenge Math +- Safari Search +- Ten Clues +- The Factory +- Trading Post +- Word Quest +""" + def should_run(self, track_num): + return self.g.is_rwts and (track_num == 0) + + def run(self, logical_sectors, track_num): + if not find.at(0x40, logical_sectors[3], b'\xD0'): return [] + if not find.at(0x9C, logical_sectors[3], b'\xF0'): return [] + if not find.at(0x69, logical_sectors[4], bytes.fromhex( + "48" + "A5 2A" + "4A" + "A8" + "B9 29 BA" + "8D 6A B9" + "8D 84 BC" + "B9 34 BA" + "8D FC B8" + "8D 5D B8" + "C0 11" + "D0 03" + "A9 02" + "AC" + "A9 0E" + "8D C0 BF" + "68" + "69 00" + "48" + "AD 78 04" + "90 2B")): return [] + if not find.at(0x69, logical_sectors[6], bytes.fromhex( + "4C B8 B6" + "EA" + "EA" + "EA")): return [] + if not find.at(0x8C, logical_sectors[8], bytes.fromhex( + "69 BA")): return [] + return [Patch(0, 3, 0x40, bytes.fromhex("F0")), + Patch(0, 3, 0x9C, bytes.fromhex("D0")), + Patch(0, 6, 0x69, bytes.fromhex("20 C3 BC 20 C3 BC")), + Patch(0, 8, 0x8C, bytes.fromhex("A0 B9"))] diff --git a/passport/patchers/universale7.py b/passport/patchers/universale7.py index 91a4372..2147ab0 100644 --- a/passport/patchers/universale7.py +++ b/passport/patchers/universale7.py @@ -7,7 +7,7 @@ class UniversalE7Patcher(Patcher): (invented by qkumba, see PoC||GTFO 0x11 and 4am crack no. 655 Rocky's Boots 4.0 for explanation) """ e7sector = b'\x00'*0xA0 + b'\xAC\x00'*0x30 - + def should_run(self, track_num): return True diff --git a/passport/strings.py b/passport/strings.py index 29f29c5..73a70ea 100644 --- a/passport/strings.py +++ b/passport/strings.py @@ -1,5 +1,7 @@ +__date__ = "2019-01-29" + STRINGS = { - "header": "Passport.py by 4am (2019-01-28)\n", # max 32 characters + "header": "Passport.py by 4am (" + __date__ + ")\n", # max 32 characters "reading": "Reading from {filename}\n", "diskrwts": "Using disk's own RWTS\n", "bb00": "T00,S05 Found $BB00 protection check\n"