Reputation: 11
I want to execute winexe command through execl function call in a C program. It works if i hard code credentials and machine name in execl call as follows
execl("winexe","winexe","-U","Domain/Username%Password","//hostname","ipconfig",NULL)
But if i replace hostname or credentials with a variable, it is not working.
execl("winexe","winexe","-U",credentials_variable,hostname_variable,"ipconfig",NULL)
Output:
winexe version 1.00
This program may be freely redistributed under the terms of the GNU GPLv3
Usage: winexe [-?] [-?] [-?] [-?NP] [-?NPV] [-?|--help] [--usage] [-d|--debuglevel DEBUGLEVEL]
[--debug-stderr] [-s|--configfile CONFIGFILE] [--option=name=value]
[-l|--log-basename LOGFILEBASE] [--leak-report] [--leak-report-full]
[-R|--name-resolve NAME-RESOLVE-ORDER]
[-O|--socket-options SOCKETOPTIONS] [-n|--netbiosname NETBIOSNAME]
[-S|--signing on|off|required] [-W|--workgroup WORKGROUP]
[--realm=REALM] [-i|--scope SCOPE] [-m|--maxprotocol MAXPROTOCOL]
[-U|--user [DOMAIN/]USERNAME[%PASSWORD]] [-N|--no-pass]
[--password=STRING] [-A|--authentication-file FILE] [-P|--machine-pass]
[--simple-bind-dn=STRING] [-k|--kerberos STRING] [-V|--version]
[--uninstall] [--reinstall] [--system]
[--runas=[DOMAIN\]USERNAME%PASSWORD] [--runas-file=FILE]
[--interactive=0|1] [--ostype=0|1|2] //host command
The above output indicates that it is a syntax error. But i have used the exact string, including / and %, in the variable. Note that am reading the above variables from a file. I have passed variables as arguments to other commands using execl functions but i have no idea why winexe is not working!
Please let me know how to use variables as winexe arguments in execl function call.
Upvotes: 0
Views: 176