i need help finding a command line hex editor

MarioMasta64

hi. i make batch stuff and portable shiz
OP
Member
Joined
Dec 21, 2016
Messages
2,297
Trophies
0
Age
26
Website
github.com
XP
2,092
Country
United States
i need a hex editor that i can use via command prompt something such as write.exe -bytes 0A4E3726594E -output=file.bin -offset 0E7
anybody know if something like this exist and/or can be created? (ive read some documentation it can be made in c# c++ and vb.net but im not exactly able to do those languages..)
 

MarioMasta64

hi. i make batch stuff and portable shiz
OP
Member
Joined
Dec 21, 2016
Messages
2,297
Trophies
0
Age
26
Website
github.com
XP
2,092
Country
United States
basically i need either something that exists or someone good in vb.net c# or c++. if it matters any. i can pay for the program to be custom made as it would obviously take time out of a busy devs day.
 

MarioMasta64

hi. i make batch stuff and portable shiz
OP
Member
Joined
Dec 21, 2016
Messages
2,297
Trophies
0
Age
26
Website
github.com
XP
2,092
Country
United States
i might have someone making it in python. so far its going well. just fixing some kinks with him. anyone is still willing to write one.
 
D

Deleted User

Guest
vim maybe? Like, you can edit it in terminal. Not sure I know something that would do what you are asking
 
  • Like
Reactions: MarioMasta64

MarioMasta64

hi. i make batch stuff and portable shiz
OP
Member
Joined
Dec 21, 2016
Messages
2,297
Trophies
0
Age
26
Website
github.com
XP
2,092
Country
United States
vim maybe? Like, you can edit it in terminal. Not sure I know something that would do what you are asking
what we have now:
readbytes.py <start offset> <end offset> <input> <output> (saves a text file in hex instead of raw data)
writebytes.py <bytes> <offset> <output>
it works but requires python to be installed. made by @Larsenv
 

MarioMasta64

hi. i make batch stuff and portable shiz
OP
Member
Joined
Dec 21, 2016
Messages
2,297
Trophies
0
Age
26
Website
github.com
XP
2,092
Country
United States
heres the code btw:

readbytes.py:
Code:
#Made By Larsenv
#https://github.com/Larsenv/

import binascii
import sys

if len(sys.argv) != 5:
    print("Usage: readbytes.py <start offset> <end offset> <input> <output>")
    sys.exit(1)

def main():
    with open(sys.argv[3], "rb") as source_file:
        read = source_file.read()

    with open(sys.argv[4], "wb") as dest_file:
        dest_file.write(binascii.hexlify(read[int(sys.argv[1], 16):int(sys.argv[2], 16)]))

main()

writebytes.py:
Code:
#Made By Larsenv
#https://github.com/Larsenv/

import binascii
import sys

if len(sys.argv) != 4:
     print("Usage: writebytes.py <bytes> <offset> <input>")
     sys.exit(1)

def main():
    with open(sys.argv[3], "r+b") as f:
        read = f.read()
        f.seek(int(sys.argv[2], 16))
        f.write(binascii.unhexlify(sys.argv[1]))

main()

made by @Larsenv 2017. good man. even wanted me to donate to riiconnect24 rather than him.
 
Last edited by MarioMasta64,

MarioMasta64

hi. i make batch stuff and portable shiz
OP
Member
Joined
Dec 21, 2016
Messages
2,297
Trophies
0
Age
26
Website
github.com
XP
2,092
Country
United States
Wow, that's it? I was thinking of how to do it in C++, but I don't know enough to make something like that. Good work Larsenv!
yea thats it lol. i couldve probably made it but i only know powershell vbs and batch (thank god i didnt try to make this in powershell) and youre free to do it if you want. if you need references for c++ way of doing it i have a few tabs pulled up for it.
 

MarioMasta64

hi. i make batch stuff and portable shiz
OP
Member
Joined
Dec 21, 2016
Messages
2,297
Trophies
0
Age
26
Website
github.com
XP
2,092
Country
United States
also i made a modified one (that was really useful) by removing a single line in a buggy one (it would remove everything after) to remove everything after (im working on a 3ds -> dsi dsiware transfer program)
heres the code for that:

removeendbytes.py:
Code:
#Made By Larsenv
#https://github.com/Larsenv/

import binascii
import sys

if len(sys.argv) != 3:
     print("Usage: removeendbytes.py <offset> <input>")
     sys.exit(1)

def main():
    with open(sys.argv[2], "r+b") as f:
        read = f.read()
        f.seek(int(sys.argv[1], 16))
        f.truncate()

main()

--------------------- MERGED ---------------------------

Have your tried with the Windows Shell? (Not Power Shell).

Try using:

Code:
C:\debug

Then type an ?, to get all the available commands.
yea. but this works alot better and requires less code.

--------------------- MERGED ---------------------------

heres a test of how the files will be used:
Code:
@echo off
cls
Color 0A

call :skip

title test reading bytes from offset 1xF1 to 1xF6 in test.bin and writing in hex to test.txt
python readbytes.py 1F1 1F7 test.bin test.txt
pause

title test writing bytes DE24 to offset 1xF0 in test.bin
python writebytes.py DE24 1F0 test.bin
pause

title removing all bytes starting at offset 1xF6 all the way to the end
python removeendbytes.py 1F6 test.bin
pause

title removing all bytes starting at the 0x00 point and ending at offset 0x06
python removestartbytes.py 006 test.bin
pause
 
Last edited by MarioMasta64,

MarioMasta64

hi. i make batch stuff and portable shiz
OP
Member
Joined
Dec 21, 2016
Messages
2,297
Trophies
0
Age
26
Website
github.com
XP
2,092
Country
United States
oh yea. heres another one (a revision before writebytes.py) that would write raw values to a file:

writebytesraw.py:
Code:
#Made By Larsenv
#https://github.com/Larsenv/

import binascii
import sys

if len(sys.argv) != 5:
    print("Usage: readbytes.py <start offset> <end offset> <input> <output>")
    sys.exit(1)

def main():
    with open(sys.argv[3], "rb") as source_file:
        read = source_file.read()

    with open(sys.argv[4], "wb") as dest_file:
        dest_file.write(read[int(sys.argv[1], 16):int(sys.argv[2], 16)])

main()
 
Last edited by MarioMasta64,

MarioMasta64

hi. i make batch stuff and portable shiz
OP
Member
Joined
Dec 21, 2016
Messages
2,297
Trophies
0
Age
26
Website
github.com
XP
2,092
Country
United States
a new addition:
removestartbytes.py:
Code:
#Made By Larsenv
#https://github.com/Larsenv/

import binascii
import sys

if len(sys.argv) != 3:
    print("Usage: removestartbytes.py <bytes> <file>")

def main():
    with open(sys.argv[2], "rb") as f:
        read = f.read()[int(sys.argv[1]):]

    with open(sys.argv[2], "wb") as f:
        f.write(read)

main()

usage: python removestartbytes.py <end at this offset> <file>
exa: pythong removestartbytes.py 006 test.bin
this will remove all files upto ofset 006 but not 006 itself. so bytes 000-005 will be removed.
 
Last edited by MarioMasta64,

MarioMasta64

hi. i make batch stuff and portable shiz
OP
Member
Joined
Dec 21, 2016
Messages
2,297
Trophies
0
Age
26
Website
github.com
XP
2,092
Country
United States
new addition:

directorysize.py:
Code:
#Made By Larsenv
#https://github.com/Larsenv/

import glob
import os
import sys

if len(sys.argv) != 3:
    print("Usage: directorysize.py <directory> <output>")

def main():
    with open(sys.argv[2], "wb") as dest_file:
        dest_file.write(str(sum(os.path.getsize(f) for f in glob.iglob(sys.argv[1] + "/**", recursive=True))).encode("utf-8"))

main()
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
  • Sicklyboy @ Sicklyboy:
    maaaaan that's so awesome but I also don't want to fork over a hundo for it
  • Veho @ Veho:
    The fuuuuu---
  • Veho @ Veho:
    I thought it was an actual xBox at that price.
  • Sicklyboy @ Sicklyboy:
    I wanna grab a 360 Slim and a 360 E one of these days. Missed the boat of getting them at their lowest though, once they were discontinued. Could've got them for cheap back when I was a broke 20 something working at Target, but then again, I was a broke 20 something working at Target
  • Veho @ Veho:
    Being broke is no fun.
  • K3Nv2 @ K3Nv2:
    @Sicklyboy, $150 isn't that bad for a jtag slim on ebay
  • Veho @ Veho:
    I only wish it was actually playable.
  • Veho @ Veho:
    There's a guy on the Tube of You that makes playable mechanical arcade games out of Lego. This could work on the same principle.
  • Veho @ Veho:
    Just a couple of guys taking their manatee out for some fresh air, why you have to molest them?
  • Veho @ Veho:
    Stupid Chinese shop switched their shipping company and this one is slooooooow.
  • LeoTCK @ LeoTCK:
    STOP BUYING CHINESE CRAP THEN
  • LeoTCK @ LeoTCK:
    SUPPORT LOCAL PRODUCTS, MAKE REVOLUTION
  • LeoTCK @ LeoTCK:
    THEY KEEP REMOVING LOCAL SHIt AND REPLACING WItH INFERIOR CHINESE CRAP
  • LeoTCK @ LeoTCK:
    THATS WHY MY PARTNER CANT GET A GOOTWEAR HIS SIZE ANYMORE
  • LeoTCK @ LeoTCK:
    HE HAS BIG FOOT AND BIG DUCK
  • LeoTCK @ LeoTCK:
    d*ck i mean*
  • LeoTCK @ LeoTCK:
    lol
  • Veho @ Veho:
    Mkay.
  • Veho @ Veho:
    I just ordered another package from China just to spite you.
  • SylverReZ @ SylverReZ:
    Leo could not withstand communism.
  • SylverReZ @ SylverReZ:
    Its OUR products to begin with lol.
    SylverReZ @ SylverReZ: Its OUR products to begin with lol.