kost / mikrotik-npk

Python tools for manipulating Mikrotik NPK format
Other
76 stars 48 forks source link

can't unpack 6.13 npk #2

Open ra1nb0w opened 10 years ago

ra1nb0w commented 10 years ago

With Gentoo Linux

$ ./unpacknpk.py ntp-6.13-mipsbe.npk
'\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x04\x00\x00\x00mips\x02\x00'
Magic: '\x1e\xf1\xd0\xba' should be: '\x1e\xf1\xd0\xba'
Size after this: 241737 Header size: 131 Data size: 241745
Unknown stuff: '\x01\x00 \x00\x00\x00' should be: '\x01\x00 \x00\x00\x00'
Short description: ntp
Revision, unknown, Minor, Major: '\x00f\r\x06' (0, 102, 13, 6)
Build time: '@\xe5tS' Thu May 15 18:03:12 2014
Some other numbers: (0, 0, 16, 4, 0) should be: (0, 0, 16, 4, 0)
Architecture: mips
Another number: (2,) should be: (2,)
Long description: '\n    NTP client and server\n  '
Found data of type: 3 size: 34
Found data of type: 22 size: 3953
Found data of type: 21 size: 237568
Found data of type: 9 size: 68
Found data of type: 16 size: 1

Returning the raw header and the rest of the file (each part in a list)

and no file extracted. With 6.12 unpack works correctly. Some changes? (like backup) thanks

paulschou commented 9 years ago

Please take a look at the commit I pushed, it may help since it looks like you are getting data type 21

ra1nb0w commented 9 years ago

Thank you for you interest. I tryed, but...

./unpacknpk.py routeros-mipsbe-6.13.npk Version 5 npk reader '\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x04\x00\x00\x00mips\x02\x00' Magic: '\x1e\xf1\xd0\xba' should be: '\x1e\xf1\xd0\xba' Size after this: 10690633 Header size: 168 Data size: 10690641 Unknown stuff: '\x12\x00 \x00\x00\x00' should be: '\x01\x00 \x00\x00\x00' Short description: routeros-mipsbe Revision, unknown, Minor, Major: '\x00f\r\x06' (0, 102, 13, 6) Build time: '@\xe5tS' Thu May 15 18:03:12 2014 Some other numbers: (0, 0, 16, 4, 0) should be: (0, 0, 16, 4, 0) Architecture: mips Another number: (2,) should be: (2,) Long description: 'RouterOS for mipsbe RouterBOARDs, includes all supported features\n' Found data of type: 61726 size: 541702864

Returning the raw header and the rest of the file (each part in a list)

---> Nothing more

./unpacknpk.py routeros-mipsbe-6.29.1.npk Version 5 npk reader '\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x04\x00\x00\x00mips\x02\x00' Magic: '\x1e\xf1\xd0\xba' should be: '\x1e\xf1\xd0\xba' Size after this: 10362153 Header size: 168 Data size: 10362161 Unknown stuff: '\x12\x00 \x00\x00\x00' should be: '\x01\x00 \x00\x00\x00' Short description: routeros-mipsbe Revision, unknown, Minor, Major: '\x01f\x1d\x06' (1, 102, 29, 6) Build time: '{^lU' Mon Jun 1 15:30:35 2015 Some other numbers: (0, 0, 16, 4, 0) should be: (0, 0, 16, 4, 0) Architecture: mips Another number: (2,) should be: (2,) Long description: 'RouterOS for mipsbe RouterBOARDs, includes all supported features\n' Found data of type: 61726 size: 489274064

Returning the raw header and the rest of the file (each part in a list)

---> Nothing more

./unpacknpk.py wireless-cm2-6.29.1-mipsbe.npk Version 6 npk reader '\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x10\x00\x04\x00\x00\x00mi' Magic: '\x1e\xf1\xd0\xba' should be: '\x1e\xf1\xd0\xba' Size after this: 962633 Header size: 151 Data size: 962641 Unknown stuff: '\x01\x00$\x00\x00\x00' should be: '\x01\x00 \x00\x00\x00' Short description: wireless-cm2 Revision, unknown, Minor, Major: '\x01f\x1d\x06' (1, 102, 29, 6) Build time: '{^lU' Mon Jun 1 15:30:35 2015 Another number: '\x00\x00\x00\x00' Some other numbers: (0, 2, 16, 4, 0) should be: (0, 2, 16, 4, 0) Architecture: mips Another number: (2,) should be: (2,) Long description: 'Provides support for wireless station and AP.' Found data of type: 3 size: 34 Contents (system): '\x01\x00system\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01f\x1d\x06\x00\x00\x00\x00\x01f\x1d\x06\x00\x00\x00\x00' Found data of type: 19 size: 34 Found data of type: 22 size: 3893 Found data of type: 21 size: 958464 Squash File System Found data of type: 9 size: 68 Found data of type: 16 size: 1

Returning the raw header and the rest of the file (each part in a list)

SquashFS found in package, extract 'squashfs' by using unsquashfs.

paulschou commented 9 years ago

Ok, the identifier isn't dumping an object for the first two; I'll take a look at this. The third worked and the file system image was dumped. See the output:

"SquashFS found in package, extract 'squashfs' by using unsquashfs."

On Jun 9, 2015, at 3:25 AM, ra1nb0w notifications@github.com wrote:

SquashFS found in package, extract 'squashfs' by using unsquashfs. Thank you for you interest. I tryed, but...

./unpacknpk.py routeros-mipsbe-6.13.npk Version 5 npk reader '\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x04\x00\x00\x00mips\x02\x00' Magic: '\x1e\xf1\xd0\xba' should be: '\x1e\xf1\xd0\xba' Size after this: 10690633 Header size: 168 Data size: 10690641 Unknown stuff: '\x12\x00 \x00\x00\x00' should be: '\x01\x00 \x00\x00\x00' Short description: routeros-mipsbe Revision, unknown, Minor, Major: '\x00f\r\x06' (0, 102, 13, 6) Build time: '@\xe5tS' Thu May 15 18:03:12 2014 Some other numbers: (0, 0, 16, 4, 0) should be: (0, 0, 16, 4, 0) Architecture: mips Another number: (2,) should be: (2,) Long description: 'RouterOS for mipsbe RouterBOARDs, includes all supported features\n' Found data of type: 61726 size: 541702864

Returning the raw header and the rest of the file (each part in a list)

---> Nothing more

./unpacknpk.py routeros-mipsbe-6.29.1.npk Version 5 npk reader '\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x04\x00\x00\x00mips\x02\x00' Magic: '\x1e\xf1\xd0\xba' should be: '\x1e\xf1\xd0\xba' Size after this: 10362153 Header size: 168 Data size: 10362161 Unknown stuff: '\x12\x00 \x00\x00\x00' should be: '\x01\x00 \x00\x00\x00' Short description: routeros-mipsbe Revision, unknown, Minor, Major: '\x01f\x1d\x06' (1, 102, 29, 6) Build time: '{^lU' Mon Jun 1 15:30:35 2015 Some other numbers: (0, 0, 16, 4, 0) should be: (0, 0, 16, 4, 0) Architecture: mips Another number: (2,) should be: (2,) Long description: 'RouterOS for mipsbe RouterBOARDs, includes all supported features\n' Found data of type: 61726 size: 489274064

Returning the raw header and the rest of the file (each part in a list)

---> Nothing more

./unpacknpk.py wireless-cm2-6.29.1-mipsbe.npk Version 6 npk reader '\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x10\x00\x04\x00\x00\x00mi' Magic: '\x1e\xf1\xd0\xba' should be: '\x1e\xf1\xd0\xba' Size after this: 962633 Header size: 151 Data size: 962641 Unknown stuff: '\x01\x00$\x00\x00\x00' should be: '\x01\x00 \x00\x00\x00' Short description: wireless-cm2 Revision, unknown, Minor, Major: '\x01f\x1d\x06' (1, 102, 29, 6) Build time: '{^lU' Mon Jun 1 15:30:35 2015 Another number: '\x00\x00\x00\x00' Some other numbers: (0, 2, 16, 4, 0) should be: (0, 2, 16, 4, 0) Architecture: mips Another number: (2,) should be: (2,) Long description: 'Provides support for wireless station and AP.' Found data of type: 3 size: 34 Contents (system): '\x01\x00system\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01f\x1d\x06\x00\x00\x00\x00\x01f\x1d\x06\x00\x00\x00\x00' Found data of type: 19 size: 34 Found data of type: 22 size: 3893 Found data of type: 21 size: 958464 Squash File System Found data of type: 9 size: 68 Found data of type: 16 size: 1

Returning the raw header and the rest of the file (each part in a list)

SquashFS found in package, extract 'squashfs' by using unsquashfs.


Reply to this email directly or view it on GitHub: https://github.com/kost/mikrotik-npk/issues/2#issuecomment-110257879

paulschou commented 9 years ago

Note: The newer format seems to use a "squashfs" file system, this image file is like an "iso" file which then needs another utility to extract. This isn't a trivial drop-in replacement of the previous unpacknpk.py as a second utility is needed (unsquashfs) to get to the files.

ra1nb0w commented 9 years ago

Ok. I will look.