HACKER'S VIEW ....

I started learning assembler a few months ago;

I have a lil' experience with TPascal an QB.

I have this problem for the ASSEMBLER MASTERS:


I wanted to write a code of mine directly into a

".com" file using the HaCkEr'S vIeW decode option.

As far I wrote jmps to do something it was good...

but I had an idea..

I wanted to write a name of a generic .txt file

directly into the memory( using stos ?), and then

i wanted to delete the file from the hard disk

calling back the name of the .txt file from memory

with some load instruction.


QUESTION IS:

HOW CAN I WRITE A STRING INTO MEMORY FROM AN

ALREADY COMPILED COM/EXE FILE?


Help Me please!!!





Comments

  • Well, for COM files, to add code, the simplest way

    to do it is to add a absolute JMP opcode at the beginning

    (usually 256 bytes in) to the end of the code, execute

    what you want to there, (i.e. load the string, delete, etc.)

    execute the opcode that was replaced by inserting the

    JMP instruction, and JMP back to the instruction right after

    your original JMP.

    For EXE files it's a bit more difficult. What kind of EXE?


    MZ, PE, LE, NE?


    Matthew Gross


    URL:http://acheronx.resnet.tamu.edu

  • Thanx for the help, but the matter was

    How can I store a string directly into memory?

    I mean I still don't know how to use

    the STOSB etc. instructions.

    Can you help me?


  • : Thanx for the help, but the matter was

    : How can I store a string directly into memory?

    : I mean I still don't know how to use

    : the STOSB etc. instructions.

    : Can you help me?


    Ok, assuming that you have the segment:offset address of the

    string and the area that you want to write to:


    Use MOV commands to transfer the address of the string's current

    location in memory into DS:SI. Then, transfer the address of where

    you want it to end up at in ES:DI.


    MOV into CX the number of bytes (characters) in the string,

    plus any terminating character, i.e. 0 or 24h at the end, etc.


    Then:


    REP MOVSB


    Will do the actual moving of the procedure.


    Post back if you have problems, or if you have to load the

    string from a disk file to memory first, or you have problems

    finding the address.


    Matthew Gross

    Acheron@Hotmail.com

    http://acheronx.resnet.tamu.edu




  • I got some concepts clearer now! Thanx!

    What if I want to write a string into a

    code? I mean..

    Consider that I'm not creating an asm file

    "ex novo" but I'm just hacking into a .com file

    so that I'm NOT defining a string with the

    common:


    @String DB "this is a string",0


    but I'm about to write directly into binary

    using instructions like


    MOV somewhere, "FirstCharOfString"

    STORE somewhereElse,somewhere


    and then


    MOV somewhere ,"SecondCharOfString"

    STORE somewhereElse + 1, somewhere


    and so on...


    This is my problem.


    Help me, Master. ;)


  • A string in code just appears as:


    This is my string0


    where 0 is the null symbol. You just add the string

    to the end of the code, and point the offset to the

    first character. Make sure that your string is someplace

    where it won't get executed, either, or it'll crash the

    prog.


    Matthew Gross


    URL:http://acheronx.resnet.tamu.edu

  • I DID IT THANX MAN!!!!!







Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories