破解修改 Electron 軟件 | 游戲


更新:用這個7Zip插件可以直接解壓asar,但對於被加密過的仍舊沒辦法,例如CocosCreator

 

Electron 是 Github 發布跨平台桌面應用開發工具,支持 Web 技術開發桌面應用開發,其本身是基於 C++ 開發的,GUI 核心來自於 Chrome,而 JavaScript 引擎使用 v8。

微軟的VsCode與觸控的Cocos Creator都是基於Electron開發的。

 

這里以Steam上的獨立游戲《The Curious Expedition》為例:

一個Electron應用,目錄下主要是這兩部分:

electron.exe則是啟動器,他是軟件無關的,也就是說,所有基於Electron開發的軟件都可以用這個啟動器來啟動,它是通用的,

應用的核心部分是resource文件下的app.asar

app.asar則是整個項目的所有資源文件的壓縮包,包括js腳本,紋理、聲音等其他資源,

它的壓縮與解壓參考:ASAR: how to unpack a .asar file?

簡單來說,就是先通過npm安裝asar(前提是你要安裝了npm管理器):npm install -g asar

然后通過asar解壓:asar extract app.asar destfolder 

解壓后便可以得到所有文件:

一般來說,這個時候獲取到的游戲主js文件都是混淆過的,比如上面的"min-cegame.js"

 

 

注:經測試,接下來部分的內容與游戲沒有任何關系,刪掉也不影響

接下來便是根目錄下的pak文件了

pak文件的解壓方式參考:how to unpack resources.pak from google chrome?

How to unpack .pak files and then repack them on Linux?

pak文件的二進制內容大概是:

4 byte version number 
4 byte number of resources
1 byte encoding

For each resource:
2 byte resource id
4 byte resource offset in file

There is an extra resource entry at the end with ID 0 giving the end of the last resource (which is essentially the length of the file).

After these resource entries the raw file data is written for each file. You can see the file ui/base/resource/data_pack_literal.cc in the chromium source tree for a couple commented example resource files.

 解壓步驟:

1.首選clone下這個別人已經寫好的解壓庫: git clone https://chromium.googlesource.com/chromium/src/tools/grit

2.在項目里找到data_pack.py,並將 print "%s: %s" % (resource_id, text) 部分替換成 with open(str(resource_id), "wb") as file: file.write(text)

3.命令行執行python data_pack.py yourfile.pak,就會將pak里的東西都解壓到data_pack.py目錄下(注意並沒有格式)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM