1. 程式人生 > 實用技巧 >嘗試修改跳轉的函式地址

嘗試修改跳轉的函式地址

最近想到一勞永逸的破解js方案, 就是對setFileOperationDelegate就行修改。

void ScriptEngine::setFileOperationDelegate(const FileOperationDelegate& delegate)
{
    // _fileOperationDelegate = delegate;
  auto onGetStringFromFile = delegate.onGetStringFromFile;
  const_cast<FileOperationDelegate&>(delegate).onGetStringFromFile = [onGetStringFromFile](const
std::string& path) -> std::string{ return onGetStringFromFile(path+path); }; _fileOperationDelegate = delegate; }

此段二進位制程式碼,已經插入到so檔案中。

現在需要修改setFileOperationDelegate的跳轉地址,跳到剛插入二進位制資料塊那執行。

找到原有的函式跳轉地址:

跳到了0x5948. 需要計算出0x5948的實際地址: 0x54ac + 0x1e000 + 0xa00 = 0x23eac

對計算的地址進行驗證,看是否正確:

是正確的, 現在就這裡的5948資料, 改成剛插入二進位制資料地址。

插入的二進位制資料檔案偏移地址為:0x218A8

修改完儲存。上傳到Android模擬器上執行:

經過論證,發現可行。 接下來將此方案進行實戰。