def _tutorial()

in ftw_compatible_tool/user_interface.py [0:0]


    def _tutorial(self):
        tutorials = (
            ("Add this rule into the head of SecRule(Optional, for white-box testing)\n" +
             self._ctx.delimiter.get_delimiter_rule(), ),
            (
                "Import testcases, "
                "if database has imported some testcases, "
                "the old testcases would not be overwritten",
                "load <PATH of testcases>",
                "load ./OWASP-CRS-regressions",
            ),
            (
                "Generate .pkt file,"
                "you can specify which testcases you want to test by SQL script("
                "default is \"" + sql.SQL_QUERY_REQUEST.strip() + "\")",
                "gen [SQL]",
                "gen",
            ),
            (
                "Start test, send request to server",
                "start [hostname]",
                "start localhost:18080",
            ),
            ("Import server log, copy or mount server log to local.(Optional, for white-box testing)",
             "import <PATH of log>",
             "import ~/testbed/default-nginx-1.11.5-ModSecurity-original/logs/error.log"
             ),
            (
                "Report test result",
                "report",
                "report",
            ),
            (
                "Exit program",
                "exit",
                "exit",
            ),
        )
        print("FTW-compatible-tool include %d steps:" % (len(tutorials), ))

        for i in range(len(tutorials)):
            if len(tutorials[i]) == 1:
                tutorial_format = "{step}. {description}\n"
                print(tutorial_format.format(
                    step=i + 1,
                    description=tutorials[i][0],
                ))
            elif len(tutorials[i]) == 3:
                tutorial_format = "{step}. {description}\n   command : {command}\n   e.g. : " + \
                    CLI.STYLE.UNDERLINE + "{example}" + CLI.STYLE.RESET + "\n"
                print(tutorial_format.format(
                    step=i + 1,
                    description=tutorials[i][0],
                    command=tutorials[i][1],
                    example=tutorials[i][2],
                ))