cjroehrig / nvtool

A tool to convert Tomato router NVRAM files to/from various formats.
BSD 2-Clause "Simplified" License
6 stars 0 forks source link

IndexError: list index out of range #1

Closed reikred closed 3 years ago

reikred commented 3 years ago

I played around with nvtool.py from https://github.com/cjroehrig/nvtool , but it has some problem with the older .cfg file when trying to extract into rml. It did not work well on old .cfg files and sometimes not even a new one.

... FILTERMATCH (log_remoteip,): NO MATCH FILTERMATCH (ct_udp_timeout,30 180): NO MATCH FILTERMATCH (wl_antdiv,-1): NO MATCH FILTERMATCH (CFG:hw_type,0x0000000d): False Traceback (most recent call last): File "/users/someuser/bin/freshtomato-nvtool.py", line 2155, in main() File "/users/someuser/bin/freshtomato-nvtool.py", line 2150, in main out_nvfile.write(opts.outfile, nvdict) File "/users/someuser/bin/freshtomato-nvtool.py", line 599, in write buf = self.writer(nvdict) File "/users/someuser/bin/freshtomato-nvtool.py", line 1146, in writer buf += tag_handler.emit(val) File "/users/someuser/bin/freshtomato-nvtool.py", line 1701, in emit buf += self.emit_record(nvfields, count) File "/users/someuser/bin/freshtomato-nvtool.py", line 1718, in emit_record (nv, val) = self.emit_value(f, nvfields, count=count) File "/users/someuser/bin/freshtomato-nvtool.py", line 1757, in emit_value nv = nvfields[pos] IndexError: list index out of range

I found your tool and also posted about the above as part of my report at (in moderation at the moment)

https://www.linksysinfo.org/index.php?threads/a-curiosity-why-cant-tomato-have-router-config-backup-across-versions.76565/page-4

Otherwise a great tool!!

cjroehrig commented 3 years ago

Is there any way you can attach your .cfg file? The oldest one I have is a Tomato v121 from 2008, but I suspect there are lots of nvram changes between versions and variants/distros. Best we can hope is to add each one in as someone encounters it.

cjroehrig commented 3 years ago

Never mind, my old file gives the same error and I've updated nvtool to have better error handling for files it doesn't understand, so you should hopefully still get an editable RML file you can hand-edit to make a valid config.