AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

find Hex value

Ein Thema von salim · begonnen am 22. Feb 2008 · letzter Beitrag vom 22. Feb 2008
Antwort Antwort
salim

Registriert seit: 22. Feb 2008
3 Beiträge
 
#1

find Hex value

  Alt 22. Feb 2008, 00:28
HI , i want to be able find an Hex Value into a binary file

let's suppose i have a File named : test.exe or what ever so i want to find the the Hex Value : 546869732070726F6772616D which is the ' This program ' in ASCII in this test.exe .

is there any way .


thank you
  Mit Zitat antworten Zitat
Muetze1
(Gast)

n/a Beiträge
 
#2

Re: find Hex value

  Alt 22. Feb 2008, 01:46
Hi and welcome to this board!

First of all, one basic hint: hexadecimal, decimal, binary, octal or whatever you want, are only different ways to display values. The values themself are always the same but the display differs. You also shows this in your question, because 546869732070726F6772616D is the same as "This program", only the display format differs.

Due this fact: don't care about the display format, just look for the values. So whatever you want to search, convert all inputs (in what display format it ever is entered) to the values it self and search for the given value.

For looking in a binary file, take a look in the help about Delphi-Referenz durchsuchenTFilestream. This class will offer you all needed for this.
  Mit Zitat antworten Zitat
salim

Registriert seit: 22. Feb 2008
3 Beiträge
 
#3

Re: find Hex value

  Alt 22. Feb 2008, 02:07
thank you Muetze1
[quote
Due this fact: don't care about the display format, just look for the values. So whatever you want to search, convert all inputs (in what display format it ever is entered) to the values it self and search for the given value.
quote]

i really don't understand you , could you please drop me an exemple using this : 546869732070726F6772616D


thank you agin
  Mit Zitat antworten Zitat
Muetze1
(Gast)

n/a Beiträge
 
#4

Re: find Hex value

  Alt 22. Feb 2008, 03:30
You got a hexadecimal sring. In hexadecimal there are two characters one byte (each char represents one nibble (4 Bits)). So split the string into pairs of two characters. After this, evaluate these pairs to their respective values (IntToStr() also converts hexadecimal values. But to decide the decimal and hexadecimal representation, IntToStr() needs a $ as prefix). Look in the help for further information: Delphi-Referenz durchsuchenCopy(), Delphi-Referenz durchsuchenPos(), Delphi-Referenz durchsuchenDelete, Delphi-Referenz durchsuchenIntToStr() etc.
  Mit Zitat antworten Zitat
salim

Registriert seit: 22. Feb 2008
3 Beiträge
 
#5

Re: find Hex value

  Alt 22. Feb 2008, 23:19
Hi Muetze1 , when trying the conversion :
i have a little confusion :

when i read my file into an Hexeditor : i found the ASCII value ( MZ ) is 4D5A in hex , but in this article it's written ' if Signature = $5A4D { 'MZ' } then ' why it's changed from 4D5A into the Value
$5A4D

really in confusion :
  Mit Zitat antworten Zitat
Benutzerbild von BUG
BUG

Registriert seit: 4. Dez 2003
Ort: Cottbus
2.094 Beiträge
 
#6

Re: find Hex value

  Alt 22. Feb 2008, 23:26
Zitat von salim:
why it's changed from 4D5A into the Value $5A4D
In my opinion, this happens because of the Endianness.

MfG,
Bug
Intellekt ist das Verstehen von Wissen. Verstehen ist der wahre Pfad zu Einsicht. Einsicht ist der Schlüssel zu allem.
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:01 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz