Comments (4)
Thanks, just updated the signatures!
For extraction, binwalk can carve out the ELSP sections, but it relies on external utilities for performing things like decompression or specific file type handling. Alternatively, you could write a binwalk plugin to handle extraction of specific file types or signatures.
Also, to answer your offline question regarding obfuscated length fields, libmagic doesn't provide any way of handling those AFAIK. Binwalk's math
keyword extension would almost work, but not quite; it'd probably be easiest to write a binwalk plugin to handle this.
On a quasi-related note, do you know if lancom released any GPL code, specifically for any SquasFS modifications they may have made? At least for the LC-831A, they appear to be using a non-standard SquashFS format.
from binwalk.
No, they did not release any.
The data in the ELSP sections is not compressed, and when it is there are complete archives inside which can be extracted as they are.
from binwalk.
They use YAFFS2, maybe the SquashFS is from the 3rd party modem Firmware?
from binwalk.
#include "standard-types.hsl"
#pragma displayname("LANCOM Firmware") ;
#pragma fileextensions(".upx")
#pragma byteorder(big_endian)
typedef struct LancomFwHeader
{
#pragma lockAt(0)
WORD CheckSum;
CHAR ProjectName[48];
DWORD LoadAddress;
DWORD OffsetToNextChunk;
DWORD Unknown;
struct Signature
{
UBYTE ChunkHdr1; /* E */
UBYTE ChunkHdr2; /* L */
UBYTE ChunkHdr3; /* S */
UBYTE ChunkHdr4; /* F/S/P/O */
__verify(ChunkHdr1 == 0x45);
__verify(ChunkHdr2 == 0x4c);
__verify(ChunkHdr3 == 0x53);
};
UBYTE Unknown1[8];
/*
253 alpha
255 Rel
220 PR
<220 RC x
>220 && < 237 RU x-220
*/
UBYTE ReleaseNumber;
UBYTE BuildDate[2];
UBYTE HasValidBuildNumber;
__verify(HasValidBuildNumber == 0);
WORD BuildNumber;
CHAR Version[4];
CHAR DeviceName[36];
BYTE Unknown2[8];
blob Data[(((OffsetToNextChunk % 0xFC00) & 0x3FF) ? ((OffsetToNextChunk % 0xFC00) | 0x3FF) + 1 : 0) + ((505 * (OffsetToNextChunk / 0xFC00) + ((((OffsetToNextChunk % 0xFC00) & 0x3FF) ? ((OffsetToNextChunk % 0xFC00) | 0x3FF) + 1 : 0) != 0)) << 7)];
} LANCOMFWHEADER;
typedef struct LancomFwHeaderOld
{
#pragma lockAt(0)
WORD CheckSum;
CHAR ProjectName[48];
DWORD LoadAddress;
DWORD OffsetToNextChunk;
DWORD Unknown;
struct Signature
{
UBYTE ChunkHdr1; /* E */
UBYTE ChunkHdr2; /* L */
UBYTE ChunkHdr3; /* S */
UBYTE ChunkHdr4; /* F/S/P/O */
__verify(ChunkHdr1 == 0x45);
__verify(ChunkHdr2 == 0x4c);
__verify(ChunkHdr3 == 0x53);
};
UBYTE Unknown3[3];
CHAR BuildDate[8];
CHAR Locale[3];
CHAR Version[4];
CHAR DeviceName[36];
BYTE Unknown5[8];
blob Data[(((OffsetToNextChunk % 0xFC00) & 0x3FF) ? ((OffsetToNextChunk % 0xFC00) | 0x3FF) + 1 : 0) + ((505 * (OffsetToNextChunk / 0xFC00) + ((((OffsetToNextChunk % 0xFC00) & 0x3FF) ? ((OffsetToNextChunk % 0xFC00) | 0x3FF) + 1 : 0) != 0)) << 7)];
} LANCOMFWHEADER_OLD;
function AutoParseLancomFirmware
{
UDWord NextHeaderOffset = 0;
UDWord OffsetPosition = 54;
UDWord HeaderSize = 128;
UDWord OffsetPart1;
UDWord OffsetPart2;
/* Insert first structure @ offset 0 */
if (__getUByteAt(77) != 0)
{
__addStructureAt(NextHeaderOffset, "LancomFwHeaderOld", "");
}
else
{
__addStructureAt(NextHeaderOffset, "LancomFwHeader", "");
};
/* calculate the offset of the next chunk */
UDWord OffsetToNextChunk = __getUDWordAt(NextHeaderOffset + OffsetPosition);
OffsetPart1 = OffsetToNextChunk / 0xFC00;
OffsetPart2 = OffsetToNextChunk % 0xFC00;
if ( OffsetPart2 & 0x3FF )
OffsetPart2 = (OffsetPart2 | 0x3FF) + 1;
OffsetToNextChunk = OffsetPart2 + ((505 * OffsetPart1 + (OffsetPart2 != 0)) << 7);
while ((NextHeaderOffset + HeaderSize + OffsetToNextChunk) < __getDocSize())
{
NextHeaderOffset += HeaderSize + OffsetToNextChunk;
if (__getUByteAt(77) != 0)
{
__addStructureAt(NextHeaderOffset, "LancomFwHeaderOld", "");
}
else
{
__addStructureAt(NextHeaderOffset, "LancomFwHeader", "");
};
OffsetToNextChunk = __getUDWordAt(NextHeaderOffset + OffsetPosition);
OffsetPart1 = OffsetToNextChunk / 0xFC00;
OffsetPart2 = OffsetToNextChunk % 0xFC00;
if ( OffsetPart2 & 0x3FF )
OffsetPart2 = (OffsetPart2 | 0x3FF) + 1;
OffsetToNextChunk = OffsetPart2 + ((505 * OffsetPart1 + (OffsetPart2 != 0)) << 7);
};
}
from binwalk.
Related Issues (20)
- Anti-patterns in extractor.py module
- Binwalk stuck when extracting .xz archive
- Cannot extract anything from a device, not file
- If providing more than one file, binwalk uses verbose mode only.
- AttributeError: module 'binwalk' has no attribute 'scan'
- Symlink Error HOT 1
- ubireader problem HOT 6
- Unable to proceed from the installation guide.
- Add support for ArchLinux in deps.sh
- Would it be possible to use the built-in python module 'getpass' as a somewhat OS agnostic way to get the username? HOT 2
- Dockerfile fails to build due to ubi_reader changes HOT 1
- binwalk fails to extract after filename/extension confusion HOT 3
- Call plugins when Result is Valid
- Name 'np' is not defined while calculating file entropy. HOT 1
- deprecated nose dependency, deprecated used of setup.py test
- Python 3.12 compatibility issue: No module named 'imp' HOT 4
- Trouble extracting cpio embedded into kernel file
- Dead Project - Parent Company Killed by Microsoft :( - See readme HOT 6
- external extractor HOT 5
- [Feature Request] Extract RSA/Certificates and Private Keys
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from binwalk.