Comments (1)
Base64 has no special delimiter symbol. Also there are multiple possible and valid B64 encodings as listed in: https://en.wikipedia.org/wiki/Base64#Variants_summary_table
Unpacking b64 is trivial. However determining if a string sequence is really b64 encoded has no reliable measure. The following has to always hold true for potential b64 match:
- Always present Character set: A-Za-z0-9=
- Depending on b64 specification: +/_:.,~-
- Default for most: +/
- Default for safe URL encodings: -_
- Depending on b64 specification: +/_:.,~-
- string length % 4 == 0
A regex to determine whether a string may be b64 encoded could look like this:
^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$
This checks whether the character sequence has zero or more valid b64 blocks of size 4 (because even the empty string is encoded to 4 ASCII characters). If the final sequence block has not length 4 it is checked for padding (either 1 or 2 "=").
Important Note: This still matches things like "aaaa" as it could be valid b64.
In the context of firmware unpacking, decoded strings could be either valid ASCII sequences or byte patterns, hence there is no trivial means for validation for decoded sequences.
from fact_extractor.
Related Issues (20)
- how to extract recursively? HOT 1
- Extracting zip with generic carver produces wired results HOT 4
- Make the Dockerfile more cache friendly
- Document fakeroot slowness
- Investigate guestfstools for mounting as unprivileged user HOT 1
- The "avm_kernel_image" extractor does not work HOT 1
- Check if binwalk can be installed from original again HOT 1
- Drop unstuff installation HOT 1
- jffs not functional on bionic HOT 2
- avm_kernel_image: correct handling of combined images from AVM's firmware HOT 2
- path bug in AVM kernel extractor
- srec unpacker bug HOT 1
- Error unpacking raw filesystem images with invalid partitions
- UnicodeDecodeError in uboot plugin
- Support for post-unpack plugins HOT 5
- Feature Request: Recursive Extraction HOT 1
- Introduce option to preserve empty files and symlinks HOT 1
- Focal Installation HOT 1
- generic_carver/binwalk problems HOT 2
- Question: is privileged mode required? HOT 5
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 fact_extractor.