I am attempting to call a .vbs file, passing a single argument (a string), and getting the result. I am simply failing on all sorts of levels.
What I want to do:
Host program:
a) Takes in a string
b) Sends it to the .vbs file
The .vbs file:
a) Interprets the string (may or may not already be a query, ie "search 'apple'" will be converted into "select * from log where message = 'apple' order by id desc limit 1")
b) Executes a query for MySQL
c) Formats the result for output
d) Sends the result to the host program
Host program:
a) Outputs the returned result.
My attempt:
Since I read you can't get results directly, I decided to try to use environmental variables, but I think the values are being stored/read locally within the program and haven't really figured out how to fix that. Besides that, whenever I use spawnl my program just freezes.
1 2 3
|
_putenv(("MySQL=" + Payload).c_str());
_spawnl( P_WAIT, "cscript \"C:\\Users\\LiQuiD\\Desktop\\MySQL.vbs\"", NULL );
CONSOLE_Print(getenv("MySQL"));
|
So, what's not working:
1) The environmental variable %MySQL% simply isn't doing what I want (and it appears to be on the C++ end as I can do exactly what I want within VBS).
2) _spawnl freezes whatever I do (even if I simply put notepad, the file path directly, wscript, etc); system() ruins the CLI and is unusable (unless fixed somehow).
I ONLY need help with the "Host program" sections.
Thank you for your time.