Results 1 to 15 of 15
  1. #1
    Jabberwock's Avatar
    Join Date
    Jun 2012
    Gender
    male
    Posts
    1,735
    Reputation
    191
    Thanks
    15,701
    My Mood
    Relaxed

    Reverse hex number in executable memory region

    Since in the memory the hex number is reversed, how can I reverse it to its right order without too much hassle?

    Here is how it is in CE:



    As you can see I want to reverse "54B0F801" to "01F8B054".
    And how I "retrieve" it from that position?
    Even familiar landscapes will
    reveal a different kind of beauty
    if you change your viewpoint.
    Where these new encounters
    and new bonds will lead you...
    Such dazzling golden days.
    I, too, look forward to
    what I might behold.

  2. #2
    .::SCHiM::.'s Avatar
    Join Date
    Sep 2010
    Gender
    male
    Posts
    733
    Reputation
    180
    Thanks
    880
    My Mood
    Twisted
    What are you trying to do here?
    Because I can tell you in advance that what you're planning is not the best way to go about it.

    I'm SCHiM

    Morals derive from the instinct to survive. Moral behavior is survival behavior above the individual level.

    Polymorphic engine
    Interprocess callback class
    SIN
    Infinite-precision arithmetic
    Hooking dynamic linkage
    (sloppy)Kernel mode Disassembler!!!

    Semi debugger




  3. The Following User Says Thank You to .::SCHiM::. For This Useful Post:

    Jabberwock (08-19-2012)

  4. #3
    Jabberwock's Avatar
    Join Date
    Jun 2012
    Gender
    male
    Posts
    1,735
    Reputation
    191
    Thanks
    15,701
    My Mood
    Relaxed
    I'm trying to retrieve an address. What do you mean it's not the best way?

    I'm being assisted with a signature scanner.
    Even familiar landscapes will
    reveal a different kind of beauty
    if you change your viewpoint.
    Where these new encounters
    and new bonds will lead you...
    Such dazzling golden days.
    I, too, look forward to
    what I might behold.

  5. #4
    .::SCHiM::.'s Avatar
    Join Date
    Sep 2010
    Gender
    male
    Posts
    733
    Reputation
    180
    Thanks
    880
    My Mood
    Twisted
    If you want to read the bytes at that position you can just do so with a DWORD* pointer. The bytes will turn up in the right order (01f8b054).

    EDIT:

    I meant you can just use the bytes like you see them. The signature will be:

    "\xa2\x54\xn0\xf8\x10" xxxxx
    Last edited by .::SCHiM::.; 08-19-2012 at 11:29 AM.

    I'm SCHiM

    Morals derive from the instinct to survive. Moral behavior is survival behavior above the individual level.

    Polymorphic engine
    Interprocess callback class
    SIN
    Infinite-precision arithmetic
    Hooking dynamic linkage
    (sloppy)Kernel mode Disassembler!!!

    Semi debugger




  6. The Following User Says Thank You to .::SCHiM::. For This Useful Post:

    Jabberwock (08-19-2012)

  7. #5
    Jabberwock's Avatar
    Join Date
    Jun 2012
    Gender
    male
    Posts
    1,735
    Reputation
    191
    Thanks
    15,701
    My Mood
    Relaxed
    And how I convert them to unsigned long?

    Look, I have access to the bytes.
    A_bytes[length] will output 54
    A_bytes[length+1] will output BO

    And so on.

    What I need to do is reverse the bytes and return them as unsigned long, meaning the address.
    Last edited by Jabberwock; 08-19-2012 at 12:03 PM.
    Even familiar landscapes will
    reveal a different kind of beauty
    if you change your viewpoint.
    Where these new encounters
    and new bonds will lead you...
    Such dazzling golden days.
    I, too, look forward to
    what I might behold.

  8. #6
    .::SCHiM::.'s Avatar
    Join Date
    Sep 2010
    Gender
    male
    Posts
    733
    Reputation
    180
    Thanks
    880
    My Mood
    Twisted
    unsinged long* s = (unsigned long*)&a_Bytes[ offset ];

    There you have them. The bytes are 'reversed' to the right order by the mov instruction, this is hardware related there is no reason to try and reverse them in software. You should just use them as you see them. For more info search for big endian format, or little endian format.

    I'm SCHiM

    Morals derive from the instinct to survive. Moral behavior is survival behavior above the individual level.

    Polymorphic engine
    Interprocess callback class
    SIN
    Infinite-precision arithmetic
    Hooking dynamic linkage
    (sloppy)Kernel mode Disassembler!!!

    Semi debugger




  9. The Following User Says Thank You to .::SCHiM::. For This Useful Post:

    Jabberwock (08-19-2012)

  10. #7
    Jabberwock's Avatar
    Join Date
    Jun 2012
    Gender
    male
    Posts
    1,735
    Reputation
    191
    Thanks
    15,701
    My Mood
    Relaxed
    Your code give me the address to the container of 54.


    OK I understood what to do. Thanks
    Last edited by Jabberwock; 08-19-2012 at 12:46 PM.
    Even familiar landscapes will
    reveal a different kind of beauty
    if you change your viewpoint.
    Where these new encounters
    and new bonds will lead you...
    Such dazzling golden days.
    I, too, look forward to
    what I might behold.

  11. #8
    radnomguywfq3's Avatar
    Join Date
    Jan 2007
    Gender
    male
    Location
    J:\E\T\A\M\A\Y.exe
    Posts
    8,858
    Reputation
    381
    Thanks
    1,823
    My Mood
    Sad
    Windows is a little endian system, which is why it interprets dwords as a series of bytes where the last byte is the higher address and the first is the lower address. On a big endian system (some linux operating systems) it would be the other way around.



    There are two types of tragedies in life. One is not getting what you want, the other is getting it.

    If you wake up at a different time in a different place, could you wake up as a different person?


  12. #9
    .::SCHiM::.'s Avatar
    Join Date
    Sep 2010
    Gender
    male
    Posts
    733
    Reputation
    180
    Thanks
    880
    My Mood
    Twisted
    Linux uses that horrible at&t syntax too, it feels so counter intuitive to me :/ It's like doing:

    5 = a int;

    I'm SCHiM

    Morals derive from the instinct to survive. Moral behavior is survival behavior above the individual level.

    Polymorphic engine
    Interprocess callback class
    SIN
    Infinite-precision arithmetic
    Hooking dynamic linkage
    (sloppy)Kernel mode Disassembler!!!

    Semi debugger




  13. #10
    radnomguywfq3's Avatar
    Join Date
    Jan 2007
    Gender
    male
    Location
    J:\E\T\A\M\A\Y.exe
    Posts
    8,858
    Reputation
    381
    Thanks
    1,823
    My Mood
    Sad
    Quote Originally Posted by .::SCHiM::. View Post
    Linux uses that horrible at&t syntax too, it feels so counter intuitive to me :/ It's like doing:

    5 = a int;
    Yeah I agree, I don't see the appeal of AT&T syntax :S



    There are two types of tragedies in life. One is not getting what you want, the other is getting it.

    If you wake up at a different time in a different place, could you wake up as a different person?


  14. #11
    .::SCHiM::.'s Avatar
    Join Date
    Sep 2010
    Gender
    male
    Posts
    733
    Reputation
    180
    Thanks
    880
    My Mood
    Twisted
    It's probably only because of GAS that everyone uses at&t in that crowd. Our preferences are basically determined by our experiences. Or maybe it's because all other assemblers were closed source

    I'm SCHiM

    Morals derive from the instinct to survive. Moral behavior is survival behavior above the individual level.

    Polymorphic engine
    Interprocess callback class
    SIN
    Infinite-precision arithmetic
    Hooking dynamic linkage
    (sloppy)Kernel mode Disassembler!!!

    Semi debugger




  15. #12
    ntKid's Avatar
    Join Date
    Mar 2009
    Gender
    male
    Posts
    9
    Reputation
    10
    Thanks
    87
    Code:
    DWORD ReverseDWORD( DWORD Original )
    {
    	BYTE Inv[ 4 ] = { 
    		( Original >> 24 ) & 0xFF, 
    		( Original >> 16 ) & 0xFF, 
    		( Original >> 8 ) & 0xFF, 
    		( Original >> 0 ) & 0xFF 
    	};
    	return *( PDWORD )Inv;
    }
    DWORD Add = ReverseDWORD( 0xAABBCCDD ); //output is 0xDDCCBBAA



    ---- Here is a more reduced way of doing it inline with a macro.
    Code:
    #define INVERSE_DWORD( Original ) ( ( DWORD )( ( ( ( ( Original >> 0 ) & 0xFF ) & 0xFF ) << 24 )|( ( ( ( Original >> 8 ) & 0xFF ) & 0xFF ) << 16 )|( ( ( ( Original >> 16 ) & 0xFF ) & 0xFF ) << 8 )|( ( ( Original >> 24 ) & 0xFF ) & 0xFF ) ) )
    DWORD Add = INVERSE_DWORD( 0xAABBCCDD );//output is 0xDDCCBBAA
    Last edited by ntKid; 08-19-2012 at 05:43 PM.

  16. The Following User Says Thank You to ntKid For This Useful Post:

    Jabberwock (08-20-2012)

  17. #13
    'Bruno's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Portugal
    Posts
    2,883
    Reputation
    290
    Thanks
    1,036
    My Mood
    Busy
    I used AT&T Syntax for some time on university projects, and tbh I cant be bothered to switch to Intel syntax.

    Its like you say, "Our preferences are basically determined by our experiences.".

    Not saying it is better or worst.
    Light travels faster than sound. That's why most people seem bright until you hear them speak.

  18. #14
    Jabberwock's Avatar
    Join Date
    Jun 2012
    Gender
    male
    Posts
    1,735
    Reputation
    191
    Thanks
    15,701
    My Mood
    Relaxed
    You can close the thread now.
    Last edited by Jabberwock; 08-20-2012 at 08:53 AM.
    Even familiar landscapes will
    reveal a different kind of beauty
    if you change your viewpoint.
    Where these new encounters
    and new bonds will lead you...
    Such dazzling golden days.
    I, too, look forward to
    what I might behold.

  19. #15
    'Bruno's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Portugal
    Posts
    2,883
    Reputation
    290
    Thanks
    1,036
    My Mood
    Busy
    Closed and marked solved as requested.
    Light travels faster than sound. That's why most people seem bright until you hear them speak.

Similar Threads

  1. Replies: 3
    Last Post: 03-20-2012, 09:40 AM
  2. [Discussion] [Concept] Application Execution via Memory Stacking * Buffer Overflow
    By xephora in forum C++/C Programming
    Replies: 5
    Last Post: 02-04-2012, 12:54 PM
  3. Replies: 3
    Last Post: 01-04-2006, 09:52 PM
  4. Direct Memory Access (DMA) to Static Memory Addresses
    By Dave84311 in forum Game Hacking Tutorials
    Replies: 0
    Last Post: 12-31-2005, 08:18 PM
  5. i need short icq number pls and hack to wr..
    By BoneXDBreaker in forum WarRock - International Hacks
    Replies: 1
    Last Post: 12-26-2005, 05:08 PM