Utilisation de la librairie Hachoir
Hachoir is a Python library that allows to view and edit a binary stream field by field. In other words, Hachoir allows you to "browse" any binary stream just like you browse directories and files. A file is split in a tree of fields, where the smallest field is just one bit. There are other fields types: integers, strings, bits, padding types, floats, etc. Hachoir is the French word for a meat grinder (meat mincer), which is used by butchers to divide meat into long tubes; Hachoir is used by computer butchers to divide binary files into fields.
Hachoir is composed of the parser core (hachoir-core), various file format parsers (hachoir-parser), and other peripheral programs. For example, you can use hachoir-metadata to extract information from your favourite photos or videos. Hachoir also allows you to edit files (of supported formats) without the original (often proprietary) program that was used to create them.
Installation de
la librairie Hachoir
--->>> http://hachoir.org/index.html
Il est nécessaire d'installer hachoir-core,
hachoir-metadata, hachoir-urwid et hachoir-editor pour que les scripts
d'exemple fonctionnent.
Se placer en ligne de commande dans chaque répertoire et lancer python
setup.py install en tant que root.
( Le fichier manquant nécessaire à l'installation de hachoir-editor à renommer en py)
Première utilisation possible
Dans le répertoie hachoir-tools se trouve un fuzzer.
L'idée est de détourner l'usage purement sécurité vers un usage ludique en
créant des images aléatoires, buggées.
Il est possible de placer les images sources sous plusieurs
formats ( tous les
formats possibles ) afin d'obtenir des résultats différents.
J'ai modifié le script pour pouvoir créer les images buggées --->> Download.
./stress.py directorysource
Format Bmp
Format Gif
Format Pcx
Format Tga
Deuxième utilisation possible
Il est possible de modifier à la main les paramètres de nombreux
fichiers et par exemple les paramètres d'un fichier Jpeg.
Tous ces champs
sont lisibles grâce à l'utilitaire hachoir-urwid.
Code Python:
from hachoir_parser import
createParser
from hachoir_editor import
createEditor
from hachoir_core.field import
writeIntoFile
parser = createParser(u"lena.jpg")
editor = createEditor(parser)
editor["huffman[0]/content/huffman_table[0]/count[9]"].value=
15
writeIntoFile(editor, u"resultat.jpg")

Troisième utilisation possible
Plusieurs scripts effectuant de l'édition de masse
