diff --git a/.gitignore b/.gitignore index 100a88a..7e84af6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .idea cmake-build-debug CMakeLists.txt +.build \ No newline at end of file diff --git a/README.md b/README.md index 070dacb..d8e8e8b 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,12 @@ Some stuff about GPON Stick DFP-34X-2C2 / DFP-34G-2C2 ## Set hexadecimal GPON password +(There is a pre-built binary available in releases) - Set up a cross-compilation environment with [crosstool-ng](https://crosstool-ng.github.io/docs/) - Use the `ct-ng.config` in the repo, or config it as `arm-unknown-linux-uclibcgnueabi` in the samples, with CPU set to `arm9tdmi` -- Compile libtagparamuserapi.so with command like `arm-unknown-linux-uclibcgnueabi-gcc -shared -o libtagparamuserapi.so libtagparamuserapi.c` +- Compile the dummy libtagparamuserapi.so with command like `arm-unknown-linux-uclibcgnueabi-gcc -shared -o libtagparamuserapi.so libtagparamuserapi.c` - Compile the program with command like `arm-unknown-linux-uclibcgnueabi-gcc -std=c99 libtagparamuserapi.so -s -o setmac_hex setmac_hex.c` -- Send compiled executable to the stick through telnet using the python script `telnet_send.py` -- Telnet to the stick and run command like `/var/tmp/setmac_hex 1 2178 "f2 01 80 01 02 03 04 00 00 00"` (replace the hex string in quotes) to set GPON password +- Set up a TFTP server in the same subnet, and get the executable on stick with commands like `cd /var/tmp && tftp -g setmac_hex -p 192.168.1.2 69` +- Telnet to stick and run command like `/var/tmp/setmac_hex 1 2178 "f2 01 80 01 02 03 04 00 00 00"` to set GPON password - Run `setmac 2 2178` or `/var/tmp/setmac_hex 2 2178` to verify the result diff --git a/telnet_send.py b/telnet_send.py deleted file mode 100644 index 5851f2c..0000000 --- a/telnet_send.py +++ /dev/null @@ -1,28 +0,0 @@ -import telnetlib -from time import sleep - -exe = r'setmac_hex' # file path -host = '192.168.1.1' -user = 'root' -password = 'Pon521' - -tn = telnetlib.Telnet(host) - -tn.read_until(b'Login: ') -tn.write(user.encode('ascii') + b'\n') -if password: - tn.read_until(b'Password: ') - tn.write(password.encode('ascii') + b'\n') -tn.write(b'> /var/tmp/setmac_hex\n') -tn.write(b'chmod +x /var/tmp/setmac_hex\n') - -with open(exe, 'rb') as f: - while (_bytes := f.read(20)): # seems writing 20 bytes each time could be most stable - data = '' - for byte in _bytes: - data += '\\x' + bytes([byte]).hex() - tn.write(b'echo -ne "' + data.encode('ascii') + b'" >> /var/tmp/setmac_hex\n') - sleep(0.1) - -tn.write(b'exit\n') -print(tn.read_all().decode('ascii'))