Code Monkey home page Code Monkey logo

Comments (5)

devttys0 avatar devttys0 commented on July 18, 2024

I think what you're looking for is offset-adjust, not jump-to-offset.

from binwalk.

m0sia avatar m0sia commented on July 18, 2024

Not really. What i want to do is jump back in file and continue parsing.

from binwalk.

devttys0 avatar devttys0 commented on July 18, 2024

The jump-to-offset keyword is used to instruct binwalk where it should resume the scan (e.g., if binwalk finds a file system that is 2MB in size, there's no point in scanning the next 2MB of data). Keywords are interpreted by binwalk after libmagic has already processed the entire signature, so it can't be used to do what you're attempting.

Due to binwalk's requirement that signatures start at an offset of 0, if you want to process data that comes before your magic string then you'll need to write a plugin to handle that.

With that said, the zero-offset requirement can be quite limiting and is a hold over from older code. With the current code base it should be possible to allow for arbitrary signature offsets without affecting scan speed. I'll leave this issue open while I look into it.

from binwalk.

m0sia avatar m0sia commented on July 18, 2024

Ok, understood. I am looking at the source code now to write my own plugin, because there are a lot of limitations in magic file syntax.
And I want to write decoders for firmwares I am reversing.

As an example of magic syntax: to avoid false positive reaction I want to check that lelong value is less then file-size.

Another example: I want to search for magicB blob only if I found magicA before current offset.

from binwalk.

devttys0 avatar devttys0 commented on July 18, 2024

True, sometimes the magic file format just doesn't cut it, which is why binwalk has added some pseudo-extensions to the magic file format.

Speaking of which, the latest check in to the master branch validates the file-size keyword (i.e.., if file-size value plus the signature offset is bigger than the size of the file, it is considered invalid). You'll still need a plugin for only matching magicB if magicA was previously found though.

Additionally, the latest master code supports specifying non-negative offsets for your magic signatures which should alleviate your original issue.

from binwalk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.