Jump to content
Tuts 4 You

How to set command line arguments when writing OllyPlugin ?


kgh0701

Recommended Posts

I want to write a plugin that can set command line.


The executable have some dynamic arguments ,so i decided to write a plugin.


I browsed some apis from ollydbg plugin help, couldnot find .Or i missed something .


Any hint , so appreciated .


Thanks.


Link to comment

There's no official API for that.

You could implement _ODBG_Pluginreset callback function and put the required command line into the appropriate buffer in Olly memory. Then OllyDbg will create process with the command line you wanted.

Quick Delphi Code I used to test the idea (requires ImmPlugin.PAS and OllyDbg 1.10 Final):

function PluginReset() : integer; cdecl;var   target : pointer;   source : pchar;begin   target := pointer($4D5D88);  // this is where the command line is stored in Olly memory   source := pchar('Hello world!');     // this is the command line I want to have.   CopyMemory(target, source, strlen(source)+1);  // +1 to put trailing zero after the commandline   result := 0;end;
Of course, real plugin code should check the debugged process name, handle more than one Olly version, check for errors, etc, etc..
  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...