Pyhexdmp - Python hex dump module

Related tags

Miscellaneouspyhexdmp
Overview

pyhexdmp Python hex dump module

Copyright 2021

Author: Paul Melson

Author notes:

  • Accept single variable as input, plus optional config arguments

  • Detect data type of input

  • Supported data types: str, bytes, bytearray

  • Unsupported data types: complex, bool, int, float

  • Undecided (currently unsupported): list, dict, range, tuple, memoryview

  • Convert input to bytearray()

  • Print hex output format, supported optional arguments:

    • offsets: on/off, default=on, print the distance of the first byte of each line in hex notation on the left

      hexdmp(test_data, offsets='off')
    • showascii: on/off, default=on, print the ASCII characters of each byte on the right (print periods for hi/lo bytes)

      hexdmp(test_data, showascii='off')
    • start: int, manually set offsets start value

      hexdmp(test_data, start=2)
    • width: positive int, default=16, let the user set the number of bytes per line to print

      hexdmp(test_data, width=8)

Usage:

>>> from pyhexdmp import hexdmp
>>> with open('/home/paul/sample.exe', 'rb') as f:
...     raw = f.read()
... 
>>> test_data = raw[:128]
>>> hexdmp(test_data)
00000000: 4d 5a 90 00 03 00 00 00 04 00 00 00 ff ff 00 00  MZ..............
00000010: b8 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00  ........@.......
00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00000030: 00 00 00 00 00 00 00 00 00 00 00 00 f8 00 00 00  ................
00000040: 0e 1f ba 0e 00 b4 09 cd 21 b8 01 4c cd 21 54 68  ........!..L.!Th
00000050: 69 73 20 70 72 6f 67 72 61 6d 20 63 61 6e 6e 6f  is program canno
00000060: 74 20 62 65 20 72 75 6e 20 69 6e 20 44 4f 53 20  t be run in DOS 
00000070: 6d 6f 64 65 2e 0d 0d 0a 24 00 00 00 00 00 00 00  mode....$.......
>>> hexdmp(test_data, offsets='off')
4d 5a 90 00 03 00 00 00 04 00 00 00 ff ff 00 00  MZ..............
b8 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00  ........@.......
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00 00 00 00 00 00 00 00 00 00 00 00 f8 00 00 00  ................
0e 1f ba 0e 00 b4 09 cd 21 b8 01 4c cd 21 54 68  ........!..L.!Th
69 73 20 70 72 6f 67 72 61 6d 20 63 61 6e 6e 6f  is program canno
74 20 62 65 20 72 75 6e 20 69 6e 20 44 4f 53 20  t be run in DOS 
6d 6f 64 65 2e 0d 0d 0a 24 00 00 00 00 00 00 00  mode....$.......
>>> hexdmp(test_data, showascii='off')
00000000: 4d 5a 90 00 03 00 00 00 04 00 00 00 ff ff 00 00
00000010: b8 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00
00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000030: 00 00 00 00 00 00 00 00 00 00 00 00 f8 00 00 00
00000040: 0e 1f ba 0e 00 b4 09 cd 21 b8 01 4c cd 21 54 68
00000050: 69 73 20 70 72 6f 67 72 61 6d 20 63 61 6e 6e 6f
00000060: 74 20 62 65 20 72 75 6e 20 69 6e 20 44 4f 53 20
00000070: 6d 6f 64 65 2e 0d 0d 0a 24 00 00 00 00 00 00 00
>>> hexdmp(test_data, start=2)
00000002: 90 00 03 00 00 00 04 00 00 00 ff ff 00 00 b8 00  ................
00000012: 00 00 00 00 00 00 40 00 00 00 00 00 00 00 00 00  ......@.........
00000022: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00000032: 00 00 00 00 00 00 00 00 00 00 f8 00 00 00 0e 1f  ................
00000042: ba 0e 00 b4 09 cd 21 b8 01 4c cd 21 54 68 69 73  ......!..L.!This
00000052: 20 70 72 6f 67 72 61 6d 20 63 61 6e 6e 6f 74 20   program cannot 
00000062: 62 65 20 72 75 6e 20 69 6e 20 44 4f 53 20 6d 6f  be run in DOS mo
00000072: 64 65 2e 0d 0d 0a 24 00 00 00 00 00 00 00        de....$.......
>>> hexdmp(test_data, width=8)
00000000: 4d 5a 90 00 03 00 00 00  MZ......
00000008: 04 00 00 00 ff ff 00 00  ........
00000010: b8 00 00 00 00 00 00 00  ........
00000018: 40 00 00 00 00 00 00 00  @.......
00000020: 00 00 00 00 00 00 00 00  ........
00000028: 00 00 00 00 00 00 00 00  ........
00000030: 00 00 00 00 00 00 00 00  ........
00000038: 00 00 00 00 f8 00 00 00  ........
00000040: 0e 1f ba 0e 00 b4 09 cd  ........
00000048: 21 b8 01 4c cd 21 54 68  !..L.!Th
00000050: 69 73 20 70 72 6f 67 72  is progr
00000058: 61 6d 20 63 61 6e 6e 6f  am canno
00000060: 74 20 62 65 20 72 75 6e  t be run
00000068: 20 69 6e 20 44 4f 53 20   in DOS 
00000070: 6d 6f 64 65 2e 0d 0d 0a  mode....
00000078: 24 00 00 00 00 00 00 00  $.......
>>> hexdmp(test_data, offsets='off', showascii='off', start=16, width=32)
b8 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 f8 00 00 00 0e 1f ba 0e 00 b4 09 cd 21 b8 01 4c cd 21 54 68
69 73 20 70 72 6f 67 72 61 6d 20 63 61 6e 6e 6f 74 20 62 65 20 72 75 6e 20 69 6e 20 44 4f 53 20
6d 6f 64 65 2e 0d 0d 0a 24 00 00 00 00 00 00 00p
>>> from pyhexdmp import strhexdmp
>>> test_hexdump_string = strhexdmp(test_data)
>>> print(test_hexdump_string)
00000000: 4d 5a 90 00 03 00 00 00 04 00 00 00 ff ff 00 00  MZ..............
00000010: b8 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00  ........@.......
00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00000030: 00 00 00 00 00 00 00 00 00 00 00 00 f8 00 00 00  ................
00000040: 0e 1f ba 0e 00 b4 09 cd 21 b8 01 4c cd 21 54 68  ........!..L.!Th
00000050: 69 73 20 70 72 6f 67 72 61 6d 20 63 61 6e 6e 6f  is program canno
00000060: 74 20 62 65 20 72 75 6e 20 69 6e 20 44 4f 53 20  t be run in DOS 
00000070: 6d 6f 64 65 2e 0d 0d 0a 24 00 00 00 00 00 00 00  mode....$.......

>>> 
Async-first dependency injection library based on python type hints

Dependency Depression Async-first dependency injection library based on python type hints Quickstart First let's create a class we would be injecting:

Doctor 8 Oct 10, 2022
Packages of Example Data for The Effect

causaldata This repository will contain R, Stata, and Python packages, all called causaldata, which contain data sets that can be used to implement th

103 Dec 24, 2022
Online learning platform

🛠 Status: In Development Teached is currently in development. So we encourage you to use it and give us your feedback, but there are things that have

Mohamed Nesredin 2 Feb 07, 2021
Collection of functions for working with interlaced content in VapourSynth.

vsfieldkit Collection of functions for working with interlaced content in VapourSynth. It does not have any hard dependencies outside of VapourSynth.

Justin Turner Arthur 11 May 27, 2022
tool to automate exploitation of android degubg bridge vulnerability

DISCLAIMER DISCLAIMER: ANY MALICIOUS USE OF THE CONTENTS FROM THIS ARTICLE WILL NOT HOLD THE AUTHOR RESPONSIBLE HE CONTENTS ARE SOLELY FOR EDUCATIONAL

6 Feb 12, 2022
Framework for creating efficient data processing pipelines

Aqueduct Framework for creating efficient data processing pipelines. Contact Feel free to ask questions in telegram t.me/avito-ml Key Features Increas

avito.tech 137 Dec 29, 2022
Python script to combine the statistical results of a TOPAS simulation that was split up into multiple batches.

topas-merge-simulations Python script to combine the statistical results of a TOPAS simulation that was split up into multiple batches At the top of t

Sebastian Schäfer 1 Aug 16, 2022
An evolutionary multi-agent platform based on mesa and NEAT

An evolutionary multi-agent platform based on mesa and NEAT

Valerio1988 6 Dec 04, 2022
A function decorator for enforcing function signatures

A function decorator for enforcing function signatures

Emmanuel I. Obi 0 Dec 08, 2021
Draw random mazes in python

a-maze Draw random mazes in python This program generates and draws a rectangular maze, with an entrance on one side and one on the opposite side. The

Andrea Pasquali 1 Nov 21, 2021
A beautiful and useful prompt for your shell

A Powerline style prompt for your shell A beautiful and useful prompt generator for Bash, ZSH, Fish, and tcsh: Shows some important details about the

Buck Ryan 6k Jan 08, 2023
Apache Superset out of box version(Windows 64-bit)

superset_app Apache Superset out of box version (Windows 64bit) prepare job download 3 files python-3.8.10-embed-amd64.zip get-pip.py python_geohash‑0

Steven Lee 9 Oct 02, 2022
Module 2's katas from Launch X's python introduction course.

Module2Katas Module 2's katas from Launch X's python introduction course. Virtual environment creation process (on Windows): Create a folder in any de

Javier Méndez 1 Feb 10, 2022
HashDB Binary Ninja Plugin

HashDB Plugin (v0.1) Author: Vector 35 Inc Plugin for interacting with the OALABS HashDB service. Description: Plugin that can be used to lookup hashe

Jordan 3 Jul 30, 2022
This is the code of Python enthusiasts collection and written.

I am Python's enthusiast, like to collect Python's programs and code.

cnzb 35 Apr 18, 2022
Reference python implementation of Chia pool operations for pool operators

This repository provides a sample server written in python, which is meant to server as a basis for a Chia Pool. While this is a fully functional implementation, it requires some work in scalability

Chia Network 451 Dec 13, 2022
Un Assistente Vocale scritto in Python e altamente personalizzabile

Un Assistente Vocale scritto in Python e altamente personalizzabile

Marco 2 May 06, 2022
A curated list of awesome things related to Pydantic! 🌪️

Awesome Pydantic A curated list of awesome things related to Pydantic. These packages have not been vetted or approved by the pydantic team. Feel free

Marcelo Trylesinski 186 Jan 05, 2023
Repository for 2021 Computer Vision Class @ Chulalongkorn University

2110443 - Computer Vision (2021/2) Computer Vision @ Chulalongkorn University Anaconda Download Link https://www.anaconda.com/download/ Miniconda and

Chula PIC Lab 5 Jul 19, 2022
Free Vocabulary Trainer - not only for German, but any language

Bilderraten DOWNLOAD THE EXE FILE HERE! What can you do with it? Vocabulary Trainer for any language Use your own vocabulary list No coding required!

Hans Alemão 4 Jan 02, 2023