Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get all strings entered in a submode #41

Open
dinuraj opened this issue Feb 14, 2019 · 1 comment
Open

Get all strings entered in a submode #41

dinuraj opened this issue Feb 14, 2019 · 1 comment

Comments

@dinuraj
Copy link

dinuraj commented Feb 14, 2019

I want to create a submode for the user to enter a sequence of strings. They are arbitrary strings and not predetermined keywords. The strings should be processed by a supplied function line by line. Can I do this with libcli ?

@RobSanders
Copy link
Collaborator

Yes, we do this all the time. The 'command' argument of the callback shows what libcli has parsed based on what you've registered. If you have any libcli filters in place those are handled differently. You can use 'cli->filters' to see if there are any filters (if no filters then cli->filters is NULL). The argc/argv pair of arguments show what is left. Note that 'argv[argc]' will be NULL at the end of any user entered 'words'. The following code snippet (warning, typed w/o testing) should show all user entered data after libcli has process the command itself, and will include any filters.

int myArgc;
cli_print(cli, "Libcli processed command is -> %s", command);
for (myArgc=argc; argv[myArgc]; myArgc++)
{
  cli_print(cli, "Argument %s is -> %d", myArgc, argv[myArgc]);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants