Unifi-Tools / UFiber.Configurator

UFiber Configuration Tool
MIT License
151 stars 24 forks source link

Issue writing MAC #15

Open nigelpatsmith opened 2 years ago

nigelpatsmith commented 2 years ago

I've been having issues getting UFiber.Configurator to write the MAC address.

➜  macos-x64 ./UFiber.Configurator --host 192.168.1.1 --vendor ARLT --serial ######## --mac 30:B1:xx:xx:xx:xx
### Original Image ###
--- NVRAM Information --
- mtdblock3 hash: 759ca19c79dc00c54a75c36e73959b101679de020704cac8aaefc84e0e1802a8
- NVRAM Version: 6
- Boot parameters: e=192.168.1.1:ffffff00 h=192.168.1.254 g= r=f f=vmlinux i=bcm963xx_fs_kernel d=1 p=0 c= a=
- Board Id: UBNT_SFU_####
- PSI size: 24
- Total MAC addresses: 5
- GPON MAC address: D0:21:xx:xx:xx:xx
- GPON Vendor Id: UBNT
- GPON Serial Number: ########
- GPON SLID (password):
- Checksum: 447620156

### Patching fw-11032022-110808.bin...
Unhandled exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.ArgumentException: Data must be an even length. (Parameter 'data')
   at UFiber.Configurator.NVRAM.AsBytes(String data)
   at UFiber.Configurator.NVRAM.SetBaseMacAddress(String mac)
   at <Program>$.<>c.<<Main>$>b__0_2(String host, String user, String pw, Int32 port, Boolean dryRun, String slid, String vendor, String serial, String mac, String fwToRestore)
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at System.Delegate.DynamicInvoke(Object[] args)
   at System.CommandLine.Invocation.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass23_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass27_0.<<UseVersionOption>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass25_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__24_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass11_0.<<UseDebugDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__10_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass14_0.<<UseExceptionHandler>b__0>d.MoveNext()

When I use it just to write the serial, theres no problem.

➜  macos-x64 ./UFiber.Configurator --host 192.168.1.1 --vendor ARLT --serial ########
### Original Image ###
--- NVRAM Information --
- mtdblock3 hash: 759ca19c79dc00c54a75c36e73959b101679de020704cac8aaefc84e0e1802a8
- NVRAM Version: 6
- Boot parameters: e=192.168.1.1:ffffff00 h=192.168.1.254 g= r=f f=vmlinux i=bcm963xx_fs_kernel d=1 p=0 c= a=
- Board Id: UBNT_SFU_####
- PSI size: 24
- Total MAC addresses: 5
- GPON MAC address: D0:21:xx:xx:xx:xx
- GPON Vendor Id: UBNT
- GPON Serial Number: ########
- GPON SLID (password):
- Checksum: 447620156

### Patching fw-11032022-110936.bin...
### Patched fw-11032022-110936.bin!
--- NVRAM Information --
- mtdblock3 hash: b39e55e5dcaf42fe3d2ed0c5d0cf91bd90b33b347b3656aa2389eff328b39ec4
- NVRAM Version: 6
- Boot parameters: e=192.168.1.1:ffffff00 h=192.168.1.254 g= r=f f=vmlinux i=bcm963xx_fs_kernel d=1 p=0 c= a=
- Board Id: UBNT_SFU_6848
- PSI size: 24
- Total MAC addresses: 5
- GPON MAC address: D0:21:F9:15:68:80
- GPON Vendor Id: ARLT
- GPON Serial Number: 10347795
- GPON SLID (password):
- Checksum: 3432620010

Uploading patched file to the target UFiber device...
Uploaded!
### Applying patched file on the target UFiber device...
### Applied patch! Please reboot your UFiber device to load the new image.

I was finally able to get the MAC changed as a third step using usb_serial_hack.py

➜  Downloads ./ubi_serial_hack.py -r 192.168.1.1 -p 22 --serial 41:52:4c:54:xx:xx:xx:xx --mac 30:B1:xx:xx:xx:xx --insecure
Password:
[+] Downloaded mtdblock3.BIN
[!] Hashsum of mtdblock3.BIN (sha256): 094553cd45b34658c442d803456130097ba0eef79a8bcb1e66624f7724ef0283
[~] nvram_version:    6
[~] boot_line:        "e=192.168.1.1:ffffff00 h=192.168.1.254 g= r=f f=vmlinux i=bcm963xx_fs_kernel d=1 p=0 c= a= "
[~] board_id:         "UBNT_SFU_####"
[~] main_thread:      0
[~] psi_size:         24
[~] num_mac_addr:     5
[~] base_mac_addr:    d0:21:xx:xx:xx:xx
[~] old_check_sum:    0xffffffff
[~] vendor_id:        "UBNT"
[~] serial_id:        "f9156880"
[~] serial_formatted: "55:42:4e:54:xx:xx:xx:xx"
[~] gpon_password:    "          "
[~] checksum:         0xddaa45a
[+] Built mtdblock3_new.BIN
[!] Hashsum of mtdblock3_new.BIN (sha256): eaa4666b5f1dfad8a6a233e01dcfd7067c95ea4b2ad09542b2f47eebe4722ad2
[~] nvram_version:    6
[~] boot_line:        "e=192.168.1.1:ffffff00 h=192.168.1.254 g= r=f f=vmlinux i=bcm963xx_fs_kernel d=1 p=0 c= a= "
[~] board_id:         "UBNT_SFU_xxxx"
[~] main_thread:      0
[~] psi_size:         24
[~] num_mac_addr:     5
[~] base_mac_addr:    30:b1:xx:xx:xx:xx
[~] old_check_sum:    0xffffffff
[~] vendor_id:        "ARLT"
[~] serial_id:        "xxxxxxxx"
[~] serial_formatted: "41:52:4c:54:xx:xx:xx:xx"
[~] gpon_password:    "          "
[~] checksum:         0xfd2b0d9b
[+] Uploaded mtdblock3_new.BIN
hmmferreira commented 2 years ago

I hope I am not saying something wrong, but I just went through the same process and removing the colons from the MAC address solved the issue for me.

Instead of passing the mac as --mac 30:B1:xx:xx:xx:xx, try --mac 30B1xxxxxxxx

I hope this helps.

nigelpatsmith commented 2 years ago

Thanks Hugo

On 15 Mar 2022, at 11:09, Hugo Ferreira @.***> wrote:

I hope I am not saying something wrong, but I just went through the same process and removing the colons from the MAC address solved the issue for me.

Instead of passing the mac as --mac 30:B1:xx:xx:xx:xx, try --mac 30B1xxxxxxxx

I hope this helps.

— Reply to this email directly, view it on GitHub https://github.com/Unifi-Tools/UFiber.Configurator/issues/15#issuecomment-1067794926, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKV2DBFLQXOUUBLO3SLC2LVABOXFANCNFSM5QRWR2QA. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.