Skip to content
/ str2hex Public

A tool to assist in binary exploitation(x86). Getting a hex representation of a string.

License

Notifications You must be signed in to change notification settings

ph4ge/str2hex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

str2hex

A quick and dirty tool to get a string hex representation, deal with endianness when trying to push strings on the stack.

Target ISA: x86

The is alpha code at best.

Requirements

python >=3.7 : because of the use of .isascii()

fire

pytest-cov

Installation

git clone https://github.com/ph4ge/str2hex

Note: downloading the str2hex-main.zip needs to be renamed to str2hex

It is preferable to install under a virtual environment(create python env)

python3 -m venv venv/py3-00/

Under the virtual environment:

pip3 install -r requirements.txt

or

pip3 install fire
pip3 install pytest-cov

Running the tests

A number of trivial test cases exist under tests/. They can be ran:

Under the same virtual environment, we need pytest:

pip install pytest-cov

Running the tests under the str2hex/:

pytest

This step can be skipped.

Running the script

# get hex representation of a string
python3 str2hex.py str2hex --astr="root"
root : 726f6f74

# get hex representation of a string and swap its endianness
python3 str2hex.py str2hex --astr="root" --se
root : 726f6f74
toor : 746f6f72

# get hex representation of for string with length > 4
python3 str2hex.py str2hex --astr="MessageBox"
Mess : 4d657373  ageB : 61676542  ox : 00006f78

About

A tool to assist in binary exploitation(x86). Getting a hex representation of a string.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages