RTFC.org.uk
Kev Sheldrake
Home
Cliapi - Command Line Interface / Application Programming Interface
Download
Tool: cliapi.0.7.tgz |
cliapi.0.6.tgz
Slides: cliapi.0.6.pdf
Overview
The idea is to be able to run any function in a library or an exe from the
command line without having to write code. You know how it is; the thing
you're hacking does some complex manipulation that you could simulate either
by writing code or stringing together a stack of cli programs, but you can't
help thinking that there should be some way of just running the function,
without having to do it manually in gdb. Well that's what cliapi was written
to address.
Cliapi can load an exe or a shared library, it can list the functions it finds
in the (non-stripped) symbol table together with start addresses, it can take
a set of arguments and run a single function within the exe or shared library,
and it can return the return value as its exit code.
If it's an exe then there is the option to break either at the start of main()
(default) or at the start of some other function or a specific address. You
can also specify command line arguments for the exe that get passed to it when
it starts up that might be needed if you break it after the start of main().
Cliapi also has an option to start it up as a pipe server. This means that it
will break on main() (or the specified break function) and then wait for
commands over the specified pipe. Cliapi can then be run again as a pipe
client to tell the pipe server to run a specific function with specified
arguments. This can be repeated over and again to run one function after
another while retaining the exe in memory and any state that it may create or
manipulate.
There's also lots of things cliapi can't do; most notably, it's probably not
ported to your architecture. For that, and everything else, there is C.
Feel free to use this code as a base for your crazy project but don't expect
any support for your insanity.
Supported platforms
- 32bit x86 (Arch) linux
- 32bit ARM (Arch) linux with thumb support
- 32bit MIPSEL (Debian7) linux
Expecting it to work on any other platforms is very optimistic of you.
888 .d888 888 .d8888888b. d8b 888
888 d88P" 888 d88P" "Y88b Y8P 888
888 888 888 888 d8b 888 888
888d888 888888 888888 .d8888b .d88b. .d88888 .d88b. 888 888 888 .d88b. 88888b.d88b. 8888b. 888 888 .d8888b .d88b. 88888b.d88b.
888P" 888 888 d88P" d88""88b d88" 888 d8P Y8b 888 888bd88P d88P"88b 888 "888 "88b "88b 888 888 d88P" d88""88b 888 "888 "88b
888 888 888 888 888 888 888 888 88888888 888 Y8888P" 888 888 888 888 888 .d888888 888 888 888 888 888 888 888 888
888 Y88b. 888 Y88b. Y88..88P Y88b 888 Y8b. Y88b. .d8 Y88b 888 888 888 888 888 888 888 888 d8b Y88b. Y88..88P 888 888 888
888 "Y888 888 "Y8888P "Y88P" "Y88888 "Y8888 "Y88888888P" "Y88888 888 888 888 "Y888888 888 888 Y8P "Y8888P "Y88P" 888 888 888
888
Y8b d88P
"Y88P"