Minimal Codes for learning HexEditor

Just starting out? Need help? Post your questions and find answers here.
User avatar
bembulak
Enthusiast
Enthusiast
Posts: 575
Joined: Mon Mar 06, 2006 3:53 pm
Location: Austria

Minimal Codes for learning HexEditor

Post by bembulak »

Hi all,

I do have an apprentice here at work (for networking, serveradministration …) and would like to teach him some other stuff besides infrastructure as well. Like, investigating stuff, poking around in code, use WireShark etc. pp.

Today I thought it would be good, if he had some idea how a HexEditor works and so I wondered if it was difficult to build some Binaries with PB that we could investigate with a HexEditor and eventually change some of the values.

Do you have any ideas on that? I'm not that big of a programmer myself, so I'm asking you for help/hints. Thank you!
cheers,

bembulak
Olli
Addict
Addict
Posts: 1242
Joined: Wed May 27, 2020 12:26 pm

Re: Minimal Codes for learning HexEditor

Post by Olli »

Hi ! And welcome to you !

very interesting subject you share ! Maybe start with :

- the Random() function to simulate a file reading and report the file reading system to a next time.
- the Hex() function to convert a numeric value to a digits string.
- the RSet() function to format the strings by filling the missing zeros
- the TextGadget() function to display all the values in a virtual grid.
- and nest two For... Next loops to draw the virtual grid.

What do you think about this start ?
AZJIO
Addict
Addict
Posts: 2191
Joined: Sun May 14, 2017 1:48 am

Re: Minimal Codes for learning HexEditor

Post by AZJIO »

infratec
Always Here
Always Here
Posts: 7620
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Minimal Codes for learning HexEditor

Post by infratec »

I think he want a file/exe where he can change some bytes with a HEX-Editor.

You can write a program where the text is stored in a datasection.
Then you can modfy the text in the exe file with a Hex-Editor and run it again.

Code: Select all

If OpenWindow(0, 0, 0, 400, 300, "PureBasic Window", #PB_Window_ScreenCentered | #PB_Window_MinimizeGadget)

  EditorGadget(0, 10, 10, 380, 280)
  SetGadgetText(0, PeekS(?Text))
  
  Repeat
    Event = WaitWindowEvent()

    If Event = #PB_Event_CloseWindow  ; If the user has pressed on the close button
      Quit = 1
    EndIf

  Until Quit = 1
  
EndIf


DataSection
  Text:
  Data.s "Hello World" + #LF$ + #LF$ + "Change me with an Hex-Editor, but not my size" + #LF$ + "But it's unicode!"
EndDataSection
AZJIO
Addict
Addict
Posts: 2191
Joined: Sun May 14, 2017 1:48 am

Re: Minimal Codes for learning HexEditor

Post by AZJIO »

For a network administrator learning HexEditor?

Code: Select all

MessageRequester("", "Hello World")
Image
infratec
Always Here
Always Here
Posts: 7620
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Minimal Codes for learning HexEditor

Post by infratec »

User avatar
bembulak
Enthusiast
Enthusiast
Posts: 575
Joined: Mon Mar 06, 2006 3:53 pm
Location: Austria

Re: Minimal Codes for learning HexEditor

Post by bembulak »

infratec wrote: Mon Nov 14, 2022 10:02 pm I think he want a file/exe where he can change some bytes with a HEX-Editor.
Exactly. This is what I had in mind.
For a network administrator learning HexEditor?
Not only network admin. Sysadmin in general is the starting point for this sort of education and it covers multiple topics. Once the apprentice knows where his interests are, he then can do specialization. E.g. Infrastructure Architecture, Security & Pentesting etc. pp.

In general I see the benefit of „climbing other mountains“ / thinking outside the box and having a basic knowledge of these things.

Anyways, the Datasection seems to be a good idea and I‘ll have a look at it.

Thank you all for the contributions!
cheers,

bembulak
Bitblazer
Enthusiast
Enthusiast
Posts: 762
Joined: Mon Apr 10, 2017 6:17 pm
Location: Germany
Contact:

Re: Minimal Codes for learning HexEditor

Post by Bitblazer »

If you want (him) to get a general knowledge about native (non NET) windows binaries aka PE files, i would suggest something like PE Explorer and from there, investigate the individual sections with a hex editor.

Once he finished the PE knowledge, knowing everything about DLL's could be next.
Olli
Addict
Addict
Posts: 1242
Joined: Wed May 27, 2020 12:26 pm

Re: Minimal Codes for learning HexEditor

Post by Olli »

bembulak wrote: Tue Nov 15, 2022 8:43 amThank you all for the contributions!
That is all right !

I blended << learning HexEditor >> and << learning hex editor >> !
Plus the term of a << apprentice >> relation and, I was casting myself in the steps of an hex editor building !
:lol:
Post Reply