Giter Site home page Giter Site logo

magic-bytes-validator's People

Contributors

ciosoriog avatar dependabot[bot] avatar djek-sweng avatar djek-traperto avatar kryptobi avatar maxbreuker avatar michael-ruetter-traperto avatar neon-js avatar niklas-schmidt-traperto avatar rotteraxel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

magic-bytes-validator's Issues

Idea for v2

This is not a real "issue" but rather an idea that I had. Currently, we cannot handle special quirks (like offsets, variable bytes inside a sequence or final byte sequences) really well. This is based on our architecture, which handles every FileType the same. To mitigate those problems, we could refactor our matching logic:

An IFileType has a bool Matches(byte[] bytes) method, which returns whether a given (complete) file stream matches a file type. An abstract AbstractStartSequencesFileType : IFileType could implement the Matches method to validate its magic byte sequences (given by its inheritors) just like we match the file types today.
File types with special magic bytes logic could be implemented clean and encapsulated in the file type only. A drawback would be, that we need to load the complete file stream before matching. But this is necessary to be completely sure that the file type matches.

This would obviously be a major breaking change. Therefore we would be forced to make it a v2. Depending on how many other people depend on this package, we should support the v1 alongside v2, at least for some time.

What do you think about this?

Magic Bytes offset on Streams

Thanks for this library, I've found it very useful in a project I'm working on. However I've found that when evaluating magic bytes with the StreamFileTypeProvider, the offset is never considered, meaning that the mp4 format will never be discovered (or others that might be supported in the future that have offset bytes)

I'm sending a pull request with this fix and an optimization when ordering the sizes to find the maximum bytes size for the buffer,

Thanks for your hard work!

Add functionality to detect mimetypes from a data-stream

Sometimes you don't have a extension nor a mimetype and the only way is to detect is by inspecting the data and look for magic bytes.

Since the library also knows the magic bytes it would be great if it also offers a detection mechanism.

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.