Skip to content

Instantly share code, notes, and snippets.

@the-j0k3r
Created November 22, 2021 10:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save the-j0k3r/7b0b12baade586540f806f0be3eed92d to your computer and use it in GitHub Desktop.
Save the-j0k3r/7b0b12baade586540f806f0be3eed92d to your computer and use it in GitHub Desktop.
Windows: WZR-HP-G300NH TFTP RECOVERY batch script and instructions.

The MIT License (MIT)

Copyright © 2021 the-j0k3r

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

@ECHO OFF
REM Copyright (c) 2021 the-j0k3r
REM License MIT
REM -- HACK CMD Window force it to be scrollable, Powershell hack FTW !!
powershell.exe -command "& {$pshost = Get-Host;$pswindow = $pshost.UI.RawUI;$newsize = $pswindow.BufferSize;$newsize.height = 9999;$pswindow.buffersize = $newsize;}"
REM -- END HACK
REM 0- Enable the built in Windows TFT client https://www.thewindowsclub.com/enable-tftp-windows-10
REM 1- /!\ TURN off windows firewall /!\
REM 2- CONNECT PC/Laptop and router to an unmanaged switch, leave the router powered off
REM 3- SET the PC/Laptop Ethernet interface to STATIC IP and enter 192.168.11.2 with the netmask 255.255.255.0, gateway/DNS 192.168.11.1.
REM 4- Open a Termina and type: route print
REM 5- Find interface number for the respective Ethernet interface (from step 3) e.g. 2 and replace with the correct interface number below in NETSH line.
REM 6- Download from https://ftp.dd-wrt.com/dd-wrtv2/downloads/betas/ the buffalo_to_ddwrt_webflash-MULTI.bin to C:\
REM -- If you are using a different path change it below
REM 7- RUN this script as administrator at the same time you plug in power to your router.
REM NOTE: On success, don't forget to revert step 3 from static to dinamic.
NETSH interface ipv4 add neighbors 2 192.168.11.1 02-aa-bb-cc-dd-1a
ARP -s 192.168.11.1 02-aa-bb-cc-dd-1a
REM Wait for 10 seconds the WZR-HP-G300NH TFTP listens only for 4 seconds!!
TIMEOUT /t 10 /nobreak
ECHO.
ROUTE PRINT
ARP -a
ECHO.
ECHO TFTP PUT is trying to upload the buffalo_to_ddwrt_webflash-MULTI.bin NOW!
ECHO Wait for Success/Failure - ON Success WAIT until the RED light has completely stopped flashing, could take 10/15/30+ minutes.
TFTP -i 192.168.11.1 PUT C:\buffalo_to_ddwrt_webflash-MULTI.bin
ECHO.
ECHO --- Next step will cleanup the added ARP entries ---
ECHO ------------- Press ENTER to proceed ---------------
ECHO.
PAUSE
NETSH interface ipv4 delete neighbors 2 192.168.11.1 02-aa-bb-cc-dd-1a
ARP -d 192.168.11.1 02-aa-bb-cc-dd-1a
ARP -d 192.168.11.1
ARP -d 192.168.11.255
GOTO :EOF
:EOF
ECHO -- This should have worked on first try, if it failed make sure the Firewall is OFF --
ECHO -- Re-run script AS ADMINISTRATOR when ready --
ECHO -- Insert COIN to Continue....
timeout /t 3 /nobreak
@the-j0k3r
Copy link
Author

the-j0k3r commented Nov 22, 2021

For the latest firmware downloads use https://ftp.dd-wrt.com/dd-wrtv2/downloads/betas/

For macOS recovery methods for the WZR-HP-G300NH see this gist

For Linux should be similar commands as in macOS as above, just keep in mind the command are different where tftp client installation is concerned if its not included with your chosen Linux distro.

Good luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment