mirror of
https://github.com/GNS3/gns3-server.git
synced 2024-11-16 16:54:51 +02:00
Allow listing x86_64 IOU images. Fixes #2376
This commit is contained in:
parent
d9e4ce5639
commit
3df7af12e1
@ -53,7 +53,6 @@ def list_images(emulator_type):
|
|||||||
directory = os.path.normpath(directory)
|
directory = os.path.normpath(directory)
|
||||||
for root, _, filenames in _os_walk(directory, recurse=recurse):
|
for root, _, filenames in _os_walk(directory, recurse=recurse):
|
||||||
for filename in filenames:
|
for filename in filenames:
|
||||||
path = os.path.join(root, filename)
|
|
||||||
if filename not in files:
|
if filename not in files:
|
||||||
if filename.endswith(".md5sum") or filename.startswith("."):
|
if filename.endswith(".md5sum") or filename.startswith("."):
|
||||||
continue
|
continue
|
||||||
@ -73,8 +72,9 @@ def list_images(emulator_type):
|
|||||||
with open(os.path.join(root, filename), "rb") as f:
|
with open(os.path.join(root, filename), "rb") as f:
|
||||||
# read the first 7 bytes of the file.
|
# read the first 7 bytes of the file.
|
||||||
elf_header_start = f.read(7)
|
elf_header_start = f.read(7)
|
||||||
# valid IOS images must start with the ELF magic number, be 32-bit, big endian and have an ELF version of 1
|
# valid IOU or IOS images must start with the ELF magic number, be 32-bit or 64-bit,
|
||||||
if not elf_header_start == b'\x7fELF\x01\x02\x01' and not elf_header_start == b'\x7fELF\x01\x01\x01':
|
# little endian and have an ELF version of 1
|
||||||
|
if elf_header_start != b'\x7fELF\x02\x01\x01' and elf_header_start != b'\x7fELF\x01\x01\x01':
|
||||||
continue
|
continue
|
||||||
|
|
||||||
images.append({
|
images.append({
|
||||||
|
Loading…
Reference in New Issue
Block a user