Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

Commit

Permalink
Add how to restore genuine firmware (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
macaron authored Feb 28, 2024
1 parent 8ce307f commit ea8beb9
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
30 changes: 30 additions & 0 deletions restore-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build genuine firmware
on:
push:
branches: [ 'main' ]

jobs:
build-openwrt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Download encrypted firmware from elecom support
run: |
curl -O https://dl.elecom.co.jp/support/download/network/wireless_lan/ap/wab-i1750-ps/WAB-I1750-PS-FW-V1-5-10.zip
unzip WAB-I1750-PS-FW-V1-5-10.zip
- name: Remove the first 128 bytes.
run: dd if=WAB-I1750-PS-FW-V1-5-10.bin of=WAB-I1750-PS-FW-V1-5-10.bin.enc bs=1 skip=128

- name: Decrypt binary file
run: python3 decrypt.py WAB-I1750-PS-uboot-V1.0.2.bin.enc 8844a2d168b45a2d dec.bin

- run: file dec.bin

# - name: Upload build result
# uses: actions/upload-artifact@v4
# with:
# name: restore-genuine-firmware
# path: |
# dec.bin
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,19 @@ Use at your own risk. I take no responsibility if your device explodes.

<img width="971" alt="" src="https://github.com/macaron/WAB-I1750-PS/assets/19354702/bf99cd71-5b5f-4986-9f78-44377fb2b3d2">

## Restore genuine firmware

- Download latest firmware from elecom support https://www.elecom.co.jp/support/download/network/wireless_lan/ap/wab-i1750-ps/
- `dd if=WAB-I1750-PS-FW-V1-5-10.bin of=WAB-I1750-PS-FW-V1-5-10.bin.enc bs=1 skip=128`
- Run decrypt.py
- e.g. `python3 decrypt.py WAB-I1750-PS-FW-V1-5-10.bin.enc 8844a2d168b45a2d dec.bin`
- Upload dec.bin http://192.168.1.1/cgi-bin/luci/admin/system/flash
- Poweroff
- Go 192.168.3.1 ID:admin PW:admin, Don't forget change your machine ip address.(In my case, 192.168.3.2/24)

## Thanks

- https://github.com/openwrt/openwrt
- https://github.com/masebb/openwrt-WAB-I1750-PS
- https://github.com/openwrt/openwrt/pull/3661
- https://github.com/musashino205/openwrt/commit/34d77170457b714e71bcdd33b53e821494bbfd3b
32 changes: 32 additions & 0 deletions decrypt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import sys

def xor_decrypt(data, key):
key = bytes.fromhex(key)
decrypted_data = bytearray()

for i in range(len(data)):
decrypted_data.append(data[i] ^ key[i % len(key)])

return bytes(decrypted_data)

def main():
if len(sys.argv) != 4:
print("Usage: python decrypt.py <encrypted_file_path> <key> <decrypted_file_path>")
sys.exit(1)

encrypted_file_path = sys.argv[1]
key = sys.argv[2]
decrypted_file_path = sys.argv[3]

with open(encrypted_file_path, "rb") as encrypted_file:
encrypted_data = encrypted_file.read()

decrypted_data = xor_decrypt(encrypted_data, key)

with open(decrypted_file_path, "wb") as decrypted_file:
decrypted_file.write(decrypted_data)

print("Decrypted!")

if __name__ == "__main__":
main()

0 comments on commit ea8beb9

Please sign in to comment.