Giter Club home page Giter Club logo

hexcalc's Introduction

======= PURPOSE =========== 

Disclaimer: This script is buggy and not very well commented. 

Which numbers do I have to subtract from 0x00000000 in order to hit my target value of 0xe7ffe775 ?

This script will help with the trial and error process. See sample output below.

An input file will specify which 4-byte sequences need to be encoded. This script will calculate a goal sum by subtracting the target value from 0xFFFFFFFF and adding 1

Goal = 0xFFFFFFFF - target + 1

You will then try to pick hex values that will add up to the goal. Once you've identified the values to hit your goal, the next target value to be encoded will be loaded.

The final output will be a summary of your calculations.


====== USAGE ===============

usage: hexcalc.py [-h] [-v] -f INFILE [-a CHARFILE]

Hex Calculation

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose         print verbose log (everything in response)
  -f INFILE, --infile INFILE
                        Path to file with binary strings - 4 bytes per line
                        ('\x75\xe7\x3f\x34')
  -a CHARFILE, --charfile CHARFILE
                        Path to file with list of allowed characters in format
                        '\x75'


======== EXAMPLE ===========

./hexcalc.py -f egghunterbytes.txt -a allowed-chars.txt


====== SAMPLE OUTPUT ========

Bytes to encode: 0xfa8b5730

	Goal Sum: 0574a8d0
	Last:     00000000
	Current:  00000000

	Last try: 



Enter a hex string:
Format 0x00112233
(ctrl+c to move to next value or type 'back'):
0x02325270

Bytes to encode: 0xfa8b5730

	Goal Sum: 0574a8d0
	Last:     02325270
	Current:  02325270

	Last try: 0x02325270


Subtract 1 : 0x02325270

Enter a hex string:
Format 0x00112233
(ctrl+c to move to next value or type 'back'):
0x02314450

Bytes to encode: 0xfa8b5730

	Goal Sum: 0574a8d0
	Last:     046396c0
	Current:  046396c0

	Last try: 0x02314450


Subtract 1 : 0x02325270
Subtract 2 : 0x02314450

Enter a hex string:
Format 0x00112233
(ctrl+c to move to next value or type 'back'):
0x01111210

Bytes to encode: 0xfa8b5730

	Goal Sum: 0574a8d0   
	Last:     0574a8d0 
	Current:  0574a8d0 <-- Matches Goal

	Last try: 0x01111210


Subtract 1 : 0x02325270
Subtract 2 : 0x02314450
Subtract 3 : 0x01111210
Keep new value? : [y/N] 
 y


Final output: 
Target value: 0xfa8b5730
Subtract the following values:
	0x02325270
	0x02314450
	0x01111210



hexcalc's People

Watchers

 avatar  avatar

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.