Results 1 to 7 of 7

Thread: Offset writing to file binary hex

  1. #1

    Thread Starter
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335

    Offset writing to file binary hex

    How can i open a file and write to it while it not running. Lets say to change a value at a specific offset. i dont like write process memory thingy cuz the rogram has to be running. i want to do the change when the program isnt running.

    What im trying to do is test the security of a program i have. My friend is trying to teach me how to make it hard to break into. So im trying to see if its possible .
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

  2. #2
    Frenzied Member
    Join Date
    Jul 2002
    Posts
    1,370
    Lemme see. You want to take an .EXE and write something into it?

    Re-writing is trivial. Getting the re-written (patched if your intentions are honorable, hacked otherwise) to run is YOUR problem.

    Here is a C fragment
    Code:
    FILE *out;
    char *buffer="\x220\x019\x042"; // hex values - 3 bytes
    long offset = 0xbb; // this is the position in the file
    out=fopen"myfile.exe","rw");
    fseek(out,offset,SEEK_SET); // file pointer is now somewhere in the middle of the file
    fwrite(buffer,sizeof(buffer),1,out);
    fclose(out);

  3. #3
    Frenzied Member
    Join Date
    Jul 2002
    Posts
    1,370
    PS: image file headers (.EXE files) have checksums that you will have to change. You will have to learn image file structures as well.

    See PE Image Help in MSDN (Imagehlp)

  4. #4

    Thread Starter
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    thanks this isnt for any other program crack thing or such. I want to see if i can learn why programs are so easy to crack and stuff.
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

  5. #5

    Thread Starter
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    by the way the hex value why must it be 3 bytes? what if i only want to change 1 value
    Originally posted by jim mcnamara
    Lemme see. You want to take an .EXE and write something into it?

    Re-writing is trivial. Getting the re-written (patched if your intentions are honorable, hacked otherwise) to run is YOUR problem.

    Here is a C fragment
    Code:
    FILE *out;
    char *buffer="\x220\x019\x042"; // hex values - 3 bytes
    long offset = 0xbb; // this is the position in the file
    out=fopen"myfile.exe","rw");
    fseek(out,offset,SEEK_SET); // file pointer is now somewhere in the middle of the file
    fwrite(buffer,sizeof(buffer),1,out);
    fclose(out);
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Doesn't matter. jim simply wrote some random values.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  7. #7

    Thread Starter
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    oh i see thankx
    - JayWare
    Live to love. Not to Hate

    Im to busy to have a site. But I got one and still working on it.

    http://dre3k.net/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width