Skip to content

Get all strings entered in a submode #41

Open

Description

@dinuraj

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 ?

Activity

  1. RobSanders commented on Apr 22, 2019

    @RobSanders
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions