Skip to content

Instantly share code, notes, and snippets.

@pamaury
Created August 5, 2013 17:11
Show Gist options
  • Save pamaury/6157618 to your computer and use it in GitHub Desktop.
Save pamaury/6157618 to your computer and use it in GitHub Desktop.
--[[
Fuze+ 2.36.8 hacking
required argument (in order):
- path to firmware
]]--
if #arg < 2 then
error("not enough argument to fuzep patcher")
end
local fw = hwp.load_file(arg[1])
local patch_addr = arm.to_thumb(hwp.make_addr(0x40fa419a))
local proxy_addr = arm.to_arm(hwp.make_addr(0x40efb248))
-- parse old jump
local inst = arm.parse_branch(fw, patch_addr)
print("Old jump: ", inst)
-- introduce jump to proxy
local new_jump = arm.make_branch(proxy_addr, true)
arm.write_branch(fw, patch_addr, new_jump)
print("New jump: ", arm.parse_branch(fw, patch_addr))
-- do return in proxy
arm.write_return(fw, proxy_addr)
-- write result
hwp.save_file(fw, arg[2])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment