kost / mikrotik-npk

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

can not unpack version 6.9 npk! #1

Open hynnet opened 10 years ago

hynnet commented 10 years ago

D:\mikrotik-npk-master>python27.exe unpacknpk.py ppp-6.9.npk '\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x04\x00\x00\x00i386\x02\x00' Magic: '\x1e\xf1\xd0\xba' should be: '\x1e\xf1\xd0\xba' Size after this: 393289 Header size: 167 Data size: 4375 Unknown stuff: '\x01\x00 \x00\x00\x00' should be: '\x01\x00 \x00\x00\x00' Short description: pppaaaaaaaaaaaaa Revision, unknown, Minor, Major: '\x00f\t\x06' (0, 102, 9, 6) Build time: '{\x86\xebR' Fri Jan 31 19:18:19 2014 Some other numbers: (0, 0, 16, 4, 0) should be: (0, 0, 16, 4, 0) Architecture: i386 Another number: (2,) should be: (2,) Long description: '\n Provides support for PPP, PPTP, L2TP, PPPoE and ISDN PP P.\n ' Found data of type: 3 size: 34 Found data of type: 22 size: 3917 Found data of type: 21 size: 389120

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

D:\mikrotik-npk-master>python27.exe dumpnpk.py ppp-6.9.npk

'\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x04\x00\x00\x00i386\x02\x00' Magic: '\x1e\xf1\xd0\xba' should be: '\x1e\xf1\xd0\xba' Size after this: 393289 Header size: 167 Data size: 4375 Unknown stuff: '\x01\x00 \x00\x00\x00' should be: '\x01\x00 \x00\x00\x00' Short description: pppaaaaaaaaaaaaa Revision, unknown, Minor, Major: '\x00f\t\x06' (0, 102, 9, 6) Build time: '{\x86\xebR' Fri Jan 31 19:18:19 2014 Some other numbers: (0, 0, 16, 4, 0) should be: (0, 0, 16, 4, 0) Architecture: i386 Another number: (2,) should be: (2,) Long description: '\n Provides support for PPP, PPTP, L2TP, PPPoE and ISDN PP P.\n ' Next 24 chars: '\x03\x00"\x00\x00\x00\x01\x00system\x00\x00\x00\x00\x00\x00\x00\ x00\x00\x00' should be: '\x03\x00"\x00\x00\x00\x01\x00system\x00\x00\x00\x00\x00\x00\x00\ x00\x00\x00' Separators: '\x00f\t\x06\x00\x00\x00\x00' '\x00f\t\x06\x00\x00\x00\x00' first 4: (0, 102, 9, 6) (0, 102, 9, 6)

Found data of type: 3 size: 34 Found data of type: 22 size: 3917 Found data of type: 21 size: 389120

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

kost commented 10 years ago

Do you have link to any public npk package available anywhere with 6.9 so I can check what's wrong?

hynnet commented 10 years ago

http://download2.mikrotik.com/routeros/6.9/mikrotik-6.9.iso http://download2.mikrotik.com/routeros/6.9/routeros-x86-6.9.npk

http://www.mikrotik-software.de/downloads/ http://download.mikrotikindonesia.com/index.php?dir=Firmware/V6/routeros-6.9/ http://routeros.butchevans.com/routeros-6.9/

From: kost Date: 2014-02-14 16:30 To: kost/mikrotik-npk CC: hynnet Subject: Re: [mikrotik-npk] can not unpack version 6.9 npk! (#1) Do you have link to any public npk package available anywhere with 6.9 so I can check what's wrong? — Reply to this email directly or view it on GitHub.

kost commented 10 years ago

wget "http://www.mikrotik-software.de/downloads/routeros-x86-6.9.npk"

$ ./dumpnpk.py routeros-x86-6.9.npk '\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x04\x00\x00\x00i386\x02\x00' Magic: '\x1e\xf1\xd0\xba' should be: '\x1e\xf1\xd0\xba' Size after this: 15241883 Header size: 152 Data size: 15241891 Unknown stuff: '\x12\x00 \x00\x00\x00' should be: '\x01\x00 \x00\x00\x00' Short description: routeros-x86 [...] Files in package: fil nx UPGRADEBOOTER 1391160062 fil nx UPGRADED 1391160062 dir 253 bin 1391070225 fil 253 bin/mlogin 1391070225 fil 253 bin/bash_login 1391070225 fil 253 bin/bash 1391071475 fil 253 bin/milo 1391071348 dir ex boot 1391159984 fil ex boot/vmlinuz-smp 1391159984 fil 180 boot/initrd.rgz 1391070277 fil nx boot/map 1391160062 fil 180 boot/milo.conf 1391070225 fil ex boot/vmlinuz 1391159986 fil 180 /var/pdb/system/crc 1391160062 Files in package: fil ex boot/memtest.bin 1391072397 fil 180 /var/pdb/advanced-tools/crc 1391160090

It works. But I'm testing it on Linux/Mac. Not sure if it works correctly on Windows... :(

hynnet commented 10 years ago

I try it on windows 2012 R2, fail. D:\mikrotik-npk-master>wget "http://www.mikrotik-software.de/downloads/routeros-x86-6.9.npk" --17:05:30-- http://www.mikrotik-software.de/downloads/routeros-x86-6.9.npk => `routeros-x86-6.9.npk' Resolving www.mikrotik-software.de... done. Connecting to www.mikrotik-software.de[217.22.207.161]:80... connected. HTTP request sent, awaiting response... 200 OK Length: 15,241,891 [text/plain]

100%[====================================>] 15,241,891 488.07K/s ETA 00:00

17:06:02 (488.07 KB/s) - `routeros-x86-6.9.npk' saved [15241891/15241891]

D:\mikrotik-npk-master>python27.exe dumpnpk.py routeros-x86-6.9.npk '\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x04\x00\x00\x00i386\x02\x00' Magic: '\x1e\xf1\xd0\xba' should be: '\x1e\xf1\xd0\xba' Size after this: 15241883 Header size: 152 Data size: 4333 Unknown stuff: '\x12\x00 \x00\x00\x00' should be: '\x01\x00 \x00\x00\x00' Short description: routeros-x86aaaa Revision, unknown, Minor, Major: '\x00f\t\x06' (0, 102, 9, 6) Build time: '{\x86\xebR' Fri Jan 31 19:18:19 2014 Some other numbers: (0, 0, 16, 4, 0) should be: (0, 0, 16, 4, 0) Architecture: i386 Another number: (2,) should be: (2,) Long description: 'RouterOS for x86, includes all supported features\n' Next 24 chars: '\x15\x00\x00\x00\x00\x00\x14\x00"\x00\x00\x00\x01\x00ipv6\x00\x0 0\x00\x00\x00\x00' should be: '\x03\x00"\x00\x00\x00\x01\x00system\x00\x00\x00\x00\x00\x00\x00\ x00\x00\x00' Separators: '\x00\x00\x00\x00\x00\x00\x00\x00' '\x00\x00\x00\x00\x00\x00\x00\x00 ' first 4: (0, 0, 0, 0) (0, 0, 0, 0)

Found data of type: 21 size: 0 Found data of type: 20 size: 34 Found data of type: 1 size: 32 Found data of type: 16 size: 4 Found data of type: 2 size: 52 Found data of type: 3 size: 2 Found data of type: 22 size: 3812 Found data of type: 21 size: 8249344

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

From: kost Date: 2014-02-14 16:56 To: kost/mikrotik-npk CC: hynnet Subject: Re: [mikrotik-npk] can not unpack version 6.9 npk! (#1) wget "http://www.mikrotik-software.de/downloads/routeros-x86-6.9.npk" /dumpnpk.py ~/my/mikrotik/routeros-x86-6.9.npk '\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x04\x00\x00\x00i386\x02\x00' Magic: '\x1e\xf1\xd0\xba' should be: '\x1e\xf1\xd0\xba' Size after this: 15241883 Header size: 152 Data size: 15241891 Unknown stuff: '\x12\x00 \x00\x00\x00' should be: '\x01\x00 \x00\x00\x00' Short description: routeros-x86 [...] Files in package: fil nx UPGRADEBOOTER 1391160062 fil nx UPGRADED 1391160062 dir 253 bin 1391070225 fil 253 bin/mlogin 1391070225 fil 253 bin/bash_login 1391070225 fil 253 bin/bash 1391071475 fil 253 bin/milo 1391071348 dir ex boot 1391159984 fil ex boot/vmlinuz-smp 1391159984 fil 180 boot/initrd.rgz 1391070277 fil nx boot/map 1391160062 fil 180 boot/milo.conf 1391070225 fil ex boot/vmlinuz 1391159986 fil 180 /var/pdb/system/crc 1391160062 Files in package: fil ex boot/memtest.bin 1391072397 fil 180 /var/pdb/advanced-tools/crc 1391160090 It works. But I'm testing it on Linux/Mac. Not sure if it works correctly on Windows... :( — Reply to this email directly or view it on GitHub.

hynnet commented 10 years ago

It not work on windows. It unpack routeros-x86-6.9.npk success on linux but can not unpack ppp-6.9.npk ! (on CentOS v6.5)

[root@localhost ]# git clone https://github.com/kost/mikrotik-npk.git [root@localhost ]# wget http://www.mikrotik-software.de/downloads/all_packages-x86-6.9.zip [root@localhost ]# unzip all_packages-x86-6.9.zip [root@localhost ]# mikrotik-npk/unpacknpk.py ppp-6.9.npk '\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x04\x00\x00\x00i386\x02\x00' Magic: '\x1e\xf1\xd0\xba' should be: '\x1e\xf1\xd0\xba' Size after this: 393289 Header size: 167 Data size: 393297 Unknown stuff: '\x01\x00 \x00\x00\x00' should be: '\x01\x00 \x00\x00\x00' Short description: ppp Revision, unknown, Minor, Major: '\x00f\t\x06' (0, 102, 9, 6) Build time: '{\x86\xebR' Fri Jan 31 19:18:19 2014 Some other numbers: (0, 0, 16, 4, 0) should be: (0, 0, 16, 4, 0) Architecture: i386 Another number: (2,) should be: (2,) Long description: '\n Provides support for PPP, PPTP, L2TP, PPPoE and ISDN PPP.\n ' Found data of type: 3 size: 34 Found data of type: 22 size: 3917 Found data of type: 21 size: 389120 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)

[root@localhost v6]# mikrotik-npk/unpacknpk.py routeros-x86-6.9.npk '\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x04\x00\x00\x00i386\x02\x00' Magic: '\x1e\xf1\xd0\xba' should be: '\x1e\xf1\xd0\xba' Size after this: 15241883 Header size: 152 Data size: 15241891 Unknown stuff: '\x12\x00 \x00\x00\x00' should be: '\x01\x00 \x00\x00\x00' Short description: routeros-x86 Revision, unknown, Minor, Major: '\x00f\t\x06' (0, 102, 9, 6) Build time: '{\x86\xebR' Fri Jan 31 19:18:19 2014 Some other numbers: (0, 0, 16, 4, 0) should be: (0, 0, 16, 4, 0) Architecture: i386 Another number: (2,) should be: (2,) Long description: 'RouterOS for x86, includes all supported features\n' Found data of type: 21 size: 0 Found data of type: 20 size: 34 Found data of type: 1 size: 32 Found data of type: 16 size: 4 Found data of type: 2 size: 52 Found data of type: 3 size: 2 Found data of type: 22 size: 3812 Found data of type: 21 size: 8249344 Found data of type: 7 size: 3 Contents (oninstall): '\n ' Found data of type: 4 size: 3486321 Uncompressing data... Found data of type: 9 size: 68 Found data of type: 1 size: 32 Found data of type: 16 size: 4 Found data of type: 2 size: 33 Found data of type: 3 size: 34 Found data of type: 22 size: 3243 Found data of type: 21 size: 356352 Found data of type: 9 size: 68 Found data of type: 1 size: 32 Found data of type: 16 size: 4 Found data of type: 2 size: 36 Found data of type: 3 size: 34 Found data of type: 22 size: 3880 Found data of type: 21 size: 69632 Found data of type: 9 size: 68 Found data of type: 1 size: 32 Found data of type: 16 size: 4 Found data of type: 2 size: 73 Found data of type: 3 size: 34 Found data of type: 19 size: 34 Found data of type: 22 size: 3803 Found data of type: 21 size: 1409024 Found data of type: 9 size: 68 Found data of type: 1 size: 32 Found data of type: 16 size: 4 Found data of type: 2 size: 24 Found data of type: 3 size: 34 Found data of type: 22 size: 3892 Found data of type: 21 size: 217088 Found data of type: 9 size: 68 Found data of type: 1 size: 32 Found data of type: 16 size: 4 Found data of type: 2 size: 30 Found data of type: 3 size: 34 Found data of type: 22 size: 3886 Found data of type: 21 size: 188416 Found data of type: 9 size: 68 Found data of type: 1 size: 32 Found data of type: 16 size: 4 Found data of type: 2 size: 33 Found data of type: 3 size: 34 Found data of type: 19 size: 34 Found data of type: 22 size: 3843 Found data of type: 21 size: 114688 Found data of type: 9 size: 68 Found data of type: 1 size: 32 Found data of type: 16 size: 4 Found data of type: 2 size: 48 Found data of type: 3 size: 34 Found data of type: 22 size: 3868 Found data of type: 21 size: 135168 Found data of type: 9 size: 68 Found data of type: 1 size: 32 Found data of type: 16 size: 4 Found data of type: 2 size: 65 Found data of type: 3 size: 34 Found data of type: 22 size: 3851 Found data of type: 21 size: 389120 Found data of type: 9 size: 68 Found data of type: 1 size: 32 Found data of type: 16 size: 4 Found data of type: 2 size: 76 Found data of type: 3 size: 34 Found data of type: 22 size: 3840 Found data of type: 21 size: 397312 Found data of type: 9 size: 68 Found data of type: 1 size: 32 Found data of type: 16 size: 4 Found data of type: 2 size: 59 Found data of type: 3 size: 34 Found data of type: 22 size: 3857 Found data of type: 21 size: 118784 Found data of type: 4 size: 66124 Uncompressing data... 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)

Files in package: fil nx UPGRADEBOOTER 1391160062 fil nx UPGRADED 1391160062 dir 253 bin 1391070225 fil 253 bin/mlogin 1391070225 fil 253 bin/bash_login 1391070225 fil 253 bin/bash 1391071475 fil 253 bin/milo 1391071348 dir ex boot 1391159984 fil ex boot/vmlinuz-smp 1391159984 fil 180 boot/initrd.rgz 1391070277 fil nx boot/map 1391160062 fil 180 boot/milo.conf 1391070225 fil ex boot/vmlinuz 1391159986 fil 180 /var/pdb/system/crc 1391160062 Files in package: fil ex boot/memtest.bin 1391072397 fil 180 /var/pdb/advanced-tools/crc 1391160090 [root@localhost v6]#

From: hynnet Date: 2014-02-14 17:15 To: kost/mikrotik-npk Subject: Re: Re: [mikrotik-npk] can not unpack version 6.9 npk! (#1) I try it on windows 2012 R2, fail. D:\mikrotik-npk-master>wget "http://www.mikrotik-software.de/downloads/routeros-x86-6.9.npk" --17:05:30-- http://www.mikrotik-software.de/downloads/routeros-x86-6.9.npk => `routeros-x86-6.9.npk' Resolving www.mikrotik-software.de... done. Connecting to www.mikrotik-software.de[217.22.207.161]:80... connected. HTTP request sent, awaiting response... 200 OK Length: 15,241,891 [text/plain]

100%[====================================>] 15,241,891 488.07K/s ETA 00:00

17:06:02 (488.07 KB/s) - `routeros-x86-6.9.npk' saved [15241891/15241891]

D:\mikrotik-npk-master>python27.exe dumpnpk.py routeros-x86-6.9.npk '\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x04\x00\x00\x00i386\x02\x00' Magic: '\x1e\xf1\xd0\xba' should be: '\x1e\xf1\xd0\xba' Size after this: 15241883 Header size: 152 Data size: 4333 Unknown stuff: '\x12\x00 \x00\x00\x00' should be: '\x01\x00 \x00\x00\x00' Short description: routeros-x86aaaa Revision, unknown, Minor, Major: '\x00f\t\x06' (0, 102, 9, 6) Build time: '{\x86\xebR' Fri Jan 31 19:18:19 2014 Some other numbers: (0, 0, 16, 4, 0) should be: (0, 0, 16, 4, 0) Architecture: i386 Another number: (2,) should be: (2,) Long description: 'RouterOS for x86, includes all supported features\n' Next 24 chars: '\x15\x00\x00\x00\x00\x00\x14\x00"\x00\x00\x00\x01\x00ipv6\x00\x0 0\x00\x00\x00\x00' should be: '\x03\x00"\x00\x00\x00\x01\x00system\x00\x00\x00\x00\x00\x00\x00\ x00\x00\x00' Separators: '\x00\x00\x00\x00\x00\x00\x00\x00' '\x00\x00\x00\x00\x00\x00\x00\x00 ' first 4: (0, 0, 0, 0) (0, 0, 0, 0)

Found data of type: 21 size: 0 Found data of type: 20 size: 34 Found data of type: 1 size: 32 Found data of type: 16 size: 4 Found data of type: 2 size: 52 Found data of type: 3 size: 2 Found data of type: 22 size: 3812 Found data of type: 21 size: 8249344

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

From: kost Date: 2014-02-14 16:56 To: kost/mikrotik-npk CC: hynnet Subject: Re: [mikrotik-npk] can not unpack version 6.9 npk! (#1) wget "http://www.mikrotik-software.de/downloads/routeros-x86-6.9.npk" /dumpnpk.py ~/my/mikrotik/routeros-x86-6.9.npk '\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x04\x00\x00\x00i386\x02\x00' Magic: '\x1e\xf1\xd0\xba' should be: '\x1e\xf1\xd0\xba' Size after this: 15241883 Header size: 152 Data size: 15241891 Unknown stuff: '\x12\x00 \x00\x00\x00' should be: '\x01\x00 \x00\x00\x00' Short description: routeros-x86 [...] Files in package: fil nx UPGRADEBOOTER 1391160062 fil nx UPGRADED 1391160062 dir 253 bin 1391070225 fil 253 bin/mlogin 1391070225 fil 253 bin/bash_login 1391070225 fil 253 bin/bash 1391071475 fil 253 bin/milo 1391071348 dir ex boot 1391159984 fil ex boot/vmlinuz-smp 1391159984 fil 180 boot/initrd.rgz 1391070277 fil nx boot/map 1391160062 fil 180 boot/milo.conf 1391070225 fil ex boot/vmlinuz 1391159986 fil 180 /var/pdb/system/crc 1391160062 Files in package: fil ex boot/memtest.bin 1391072397 fil 180 /var/pdb/advanced-tools/crc 1391160090 It works. But I'm testing it on Linux/Mac. Not sure if it works correctly on Windows... :( — Reply to this email directly or view it on GitHub.

paulschou commented 9 years ago

Please take a look at the commit I have pushed