2021-10-04 15:14:52 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"fmt"
|
|
|
|
"math"
|
|
|
|
"os"
|
|
|
|
"path/filepath"
|
|
|
|
"strings"
|
2023-12-13 16:45:56 +00:00
|
|
|
"text/template"
|
2021-10-04 15:14:52 +00:00
|
|
|
|
|
|
|
"github.com/AlecAivazis/survey/v2"
|
|
|
|
"github.com/enescakir/emoji"
|
2022-10-13 10:28:24 +00:00
|
|
|
"github.com/fatih/color"
|
2021-10-04 15:14:52 +00:00
|
|
|
log "github.com/sirupsen/logrus"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"gopkg.in/yaml.v2"
|
2022-10-07 09:05:35 +00:00
|
|
|
|
2022-10-17 07:24:07 +00:00
|
|
|
"github.com/crowdsecurity/crowdsec/pkg/hubtest"
|
2021-10-04 15:14:52 +00:00
|
|
|
)
|
|
|
|
|
2023-11-24 14:57:32 +00:00
|
|
|
var HubTest hubtest.HubTest
|
2023-12-07 11:21:04 +00:00
|
|
|
var HubAppsecTests hubtest.HubTest
|
|
|
|
var hubPtr *hubtest.HubTest
|
|
|
|
var isAppsecTest bool
|
2021-10-04 15:14:52 +00:00
|
|
|
|
2023-12-11 09:32:54 +00:00
|
|
|
type cliHubTest struct{}
|
|
|
|
|
|
|
|
func NewCLIHubTest() *cliHubTest {
|
|
|
|
return &cliHubTest{}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (cli cliHubTest) NewCommand() *cobra.Command {
|
2021-10-04 15:14:52 +00:00
|
|
|
var hubPath string
|
|
|
|
var crowdsecPath string
|
|
|
|
var cscliPath string
|
|
|
|
|
2023-12-11 09:32:54 +00:00
|
|
|
cmd := &cobra.Command{
|
2022-05-24 13:46:48 +00:00
|
|
|
Use: "hubtest",
|
|
|
|
Short: "Run functional tests on hub configurations",
|
|
|
|
Long: "Run functional tests on hub configurations (parsers, scenarios, collections...)",
|
2021-10-04 15:14:52 +00:00
|
|
|
Args: cobra.ExactArgs(0),
|
|
|
|
DisableAutoGenTag: true,
|
2023-12-15 14:27:22 +00:00
|
|
|
PersistentPreRunE: func(_ *cobra.Command, _ []string) error {
|
2021-10-04 15:14:52 +00:00
|
|
|
var err error
|
2023-12-07 11:21:04 +00:00
|
|
|
HubTest, err = hubtest.NewHubTest(hubPath, crowdsecPath, cscliPath, false)
|
2021-10-04 15:14:52 +00:00
|
|
|
if err != nil {
|
2023-02-20 14:05:42 +00:00
|
|
|
return fmt.Errorf("unable to load hubtest: %+v", err)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
2023-02-20 14:05:42 +00:00
|
|
|
|
2023-12-07 11:21:04 +00:00
|
|
|
HubAppsecTests, err = hubtest.NewHubTest(hubPath, crowdsecPath, cscliPath, true)
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("unable to load appsec specific hubtest: %+v", err)
|
|
|
|
}
|
|
|
|
/*commands will use the hubPtr, will point to the default hubTest object, or the one dedicated to appsec tests*/
|
|
|
|
hubPtr = &HubTest
|
|
|
|
if isAppsecTest {
|
|
|
|
hubPtr = &HubAppsecTests
|
|
|
|
}
|
2023-02-20 14:05:42 +00:00
|
|
|
return nil
|
2021-10-04 15:14:52 +00:00
|
|
|
},
|
|
|
|
}
|
2023-11-24 14:57:32 +00:00
|
|
|
|
2023-12-11 09:32:54 +00:00
|
|
|
cmd.PersistentFlags().StringVar(&hubPath, "hub", ".", "Path to hub folder")
|
|
|
|
cmd.PersistentFlags().StringVar(&crowdsecPath, "crowdsec", "crowdsec", "Path to crowdsec")
|
|
|
|
cmd.PersistentFlags().StringVar(&cscliPath, "cscli", "cscli", "Path to cscli")
|
|
|
|
cmd.PersistentFlags().BoolVar(&isAppsecTest, "appsec", false, "Command relates to appsec tests")
|
|
|
|
|
|
|
|
cmd.AddCommand(cli.NewCreateCmd())
|
|
|
|
cmd.AddCommand(cli.NewRunCmd())
|
|
|
|
cmd.AddCommand(cli.NewCleanCmd())
|
|
|
|
cmd.AddCommand(cli.NewInfoCmd())
|
|
|
|
cmd.AddCommand(cli.NewListCmd())
|
|
|
|
cmd.AddCommand(cli.NewCoverageCmd())
|
|
|
|
cmd.AddCommand(cli.NewEvalCmd())
|
|
|
|
cmd.AddCommand(cli.NewExplainCmd())
|
|
|
|
|
|
|
|
return cmd
|
2023-01-19 12:29:36 +00:00
|
|
|
}
|
|
|
|
|
2023-12-11 09:32:54 +00:00
|
|
|
func (cli cliHubTest) NewCreateCmd() *cobra.Command {
|
2021-10-04 15:14:52 +00:00
|
|
|
parsers := []string{}
|
|
|
|
postoverflows := []string{}
|
|
|
|
scenarios := []string{}
|
|
|
|
var ignoreParsers bool
|
2021-11-17 09:08:46 +00:00
|
|
|
var labels map[string]string
|
2023-01-19 12:29:36 +00:00
|
|
|
var logType string
|
2021-10-04 15:14:52 +00:00
|
|
|
|
2023-12-11 09:32:54 +00:00
|
|
|
cmd := &cobra.Command{
|
2021-10-04 15:14:52 +00:00
|
|
|
Use: "create",
|
|
|
|
Short: "create [test_name]",
|
|
|
|
Example: `cscli hubtest create my-awesome-test --type syslog
|
|
|
|
cscli hubtest create my-nginx-custom-test --type nginx
|
2021-10-05 07:52:55 +00:00
|
|
|
cscli hubtest create my-scenario-test --parsers crowdsecurity/nginx --scenarios crowdsecurity/http-probing`,
|
2021-10-04 15:14:52 +00:00
|
|
|
Args: cobra.ExactArgs(1),
|
|
|
|
DisableAutoGenTag: true,
|
2023-12-15 14:27:22 +00:00
|
|
|
RunE: func(_ *cobra.Command, args []string) error {
|
2021-10-04 15:14:52 +00:00
|
|
|
testName := args[0]
|
2023-12-07 11:21:04 +00:00
|
|
|
testPath := filepath.Join(hubPtr.HubTestPath, testName)
|
2021-10-04 15:14:52 +00:00
|
|
|
if _, err := os.Stat(testPath); os.IsExist(err) {
|
2023-02-20 14:05:42 +00:00
|
|
|
return fmt.Errorf("test '%s' already exists in '%s', exiting", testName, testPath)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
|
|
|
|
2023-12-13 16:45:56 +00:00
|
|
|
if isAppsecTest {
|
|
|
|
logType = "appsec"
|
|
|
|
}
|
|
|
|
|
2021-10-04 15:14:52 +00:00
|
|
|
if logType == "" {
|
2023-02-20 14:05:42 +00:00
|
|
|
return fmt.Errorf("please provide a type (--type) for the test")
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if err := os.MkdirAll(testPath, os.ModePerm); err != nil {
|
2023-02-20 14:05:42 +00:00
|
|
|
return fmt.Errorf("unable to create folder '%s': %+v", testPath, err)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
|
|
|
|
2023-12-07 11:21:04 +00:00
|
|
|
configFilePath := filepath.Join(testPath, "config.yaml")
|
2021-10-04 15:14:52 +00:00
|
|
|
|
2023-12-07 11:21:04 +00:00
|
|
|
configFileData := &hubtest.HubTestItemConfig{}
|
|
|
|
if logType == "appsec" {
|
|
|
|
//create empty nuclei template file
|
|
|
|
nucleiFileName := fmt.Sprintf("%s.yaml", testName)
|
|
|
|
nucleiFilePath := filepath.Join(testPath, nucleiFileName)
|
2023-12-13 16:45:56 +00:00
|
|
|
nucleiFile, err := os.OpenFile(nucleiFilePath, os.O_RDWR|os.O_CREATE, 0755)
|
2023-12-07 11:21:04 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2023-12-13 16:45:56 +00:00
|
|
|
|
|
|
|
ntpl := template.Must(template.New("nuclei").Parse(hubtest.TemplateNucleiFile))
|
|
|
|
if ntpl == nil {
|
|
|
|
return fmt.Errorf("unable to parse nuclei template")
|
|
|
|
}
|
|
|
|
ntpl.ExecuteTemplate(nucleiFile, "nuclei", struct{ TestName string }{TestName: testName})
|
2023-12-07 11:21:04 +00:00
|
|
|
nucleiFile.Close()
|
2023-12-13 16:45:56 +00:00
|
|
|
configFileData.AppsecRules = []string{"./appsec-rules/<author>/your_rule_here.yaml"}
|
2023-12-07 11:21:04 +00:00
|
|
|
configFileData.NucleiTemplate = nucleiFileName
|
|
|
|
fmt.Println()
|
|
|
|
fmt.Printf(" Test name : %s\n", testName)
|
|
|
|
fmt.Printf(" Test path : %s\n", testPath)
|
2023-12-13 16:45:56 +00:00
|
|
|
fmt.Printf(" Config File : %s\n", configFilePath)
|
|
|
|
fmt.Printf(" Nuclei Template : %s\n", nucleiFilePath)
|
2023-12-07 11:21:04 +00:00
|
|
|
} else {
|
|
|
|
// create empty log file
|
|
|
|
logFileName := fmt.Sprintf("%s.log", testName)
|
|
|
|
logFilePath := filepath.Join(testPath, logFileName)
|
|
|
|
logFile, err := os.Create(logFilePath)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
logFile.Close()
|
2021-10-04 15:14:52 +00:00
|
|
|
|
2023-12-07 11:21:04 +00:00
|
|
|
// create empty parser assertion file
|
|
|
|
parserAssertFilePath := filepath.Join(testPath, hubtest.ParserAssertFileName)
|
|
|
|
parserAssertFile, err := os.Create(parserAssertFilePath)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
parserAssertFile.Close()
|
|
|
|
// create empty scenario assertion file
|
|
|
|
scenarioAssertFilePath := filepath.Join(testPath, hubtest.ScenarioAssertFileName)
|
|
|
|
scenarioAssertFile, err := os.Create(scenarioAssertFilePath)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
scenarioAssertFile.Close()
|
2021-10-04 15:14:52 +00:00
|
|
|
|
2023-12-07 11:21:04 +00:00
|
|
|
parsers = append(parsers, "crowdsecurity/syslog-logs")
|
|
|
|
parsers = append(parsers, "crowdsecurity/dateparse-enrich")
|
2021-10-04 15:14:52 +00:00
|
|
|
|
2023-12-07 11:21:04 +00:00
|
|
|
if len(scenarios) == 0 {
|
|
|
|
scenarios = append(scenarios, "")
|
|
|
|
}
|
2021-10-04 15:14:52 +00:00
|
|
|
|
2023-12-07 11:21:04 +00:00
|
|
|
if len(postoverflows) == 0 {
|
|
|
|
postoverflows = append(postoverflows, "")
|
|
|
|
}
|
|
|
|
configFileData.Parsers = parsers
|
|
|
|
configFileData.Scenarios = scenarios
|
|
|
|
configFileData.PostOverflows = postoverflows
|
|
|
|
configFileData.LogFile = logFileName
|
|
|
|
configFileData.LogType = logType
|
|
|
|
configFileData.IgnoreParsers = ignoreParsers
|
|
|
|
configFileData.Labels = labels
|
|
|
|
fmt.Println()
|
|
|
|
fmt.Printf(" Test name : %s\n", testName)
|
|
|
|
fmt.Printf(" Test path : %s\n", testPath)
|
|
|
|
fmt.Printf(" Log file : %s (please fill it with logs)\n", logFilePath)
|
|
|
|
fmt.Printf(" Parser assertion file : %s (please fill it with assertion)\n", parserAssertFilePath)
|
|
|
|
fmt.Printf(" Scenario assertion file : %s (please fill it with assertion)\n", scenarioAssertFilePath)
|
|
|
|
fmt.Printf(" Configuration File : %s (please fill it with parsers, scenarios...)\n", configFilePath)
|
2021-10-04 15:14:52 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-11-24 14:57:32 +00:00
|
|
|
fd, err := os.Create(configFilePath)
|
2021-10-04 15:14:52 +00:00
|
|
|
if err != nil {
|
2023-02-20 14:05:42 +00:00
|
|
|
return fmt.Errorf("open: %s", err)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
|
|
|
data, err := yaml.Marshal(configFileData)
|
|
|
|
if err != nil {
|
2023-02-20 14:05:42 +00:00
|
|
|
return fmt.Errorf("marshal: %s", err)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
|
|
|
_, err = fd.Write(data)
|
|
|
|
if err != nil {
|
2023-02-20 14:05:42 +00:00
|
|
|
return fmt.Errorf("write: %s", err)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
|
|
|
if err := fd.Close(); err != nil {
|
2023-02-20 14:05:42 +00:00
|
|
|
return fmt.Errorf("close: %s", err)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
2023-02-20 14:05:42 +00:00
|
|
|
return nil
|
2021-10-04 15:14:52 +00:00
|
|
|
},
|
|
|
|
}
|
2023-11-24 14:57:32 +00:00
|
|
|
|
2023-12-11 09:32:54 +00:00
|
|
|
cmd.PersistentFlags().StringVarP(&logType, "type", "t", "", "Log type of the test")
|
|
|
|
cmd.Flags().StringSliceVarP(&parsers, "parsers", "p", parsers, "Parsers to add to test")
|
|
|
|
cmd.Flags().StringSliceVar(&postoverflows, "postoverflows", postoverflows, "Postoverflows to add to test")
|
|
|
|
cmd.Flags().StringSliceVarP(&scenarios, "scenarios", "s", scenarios, "Scenarios to add to test")
|
|
|
|
cmd.PersistentFlags().BoolVar(&ignoreParsers, "ignore-parsers", false, "Don't run test on parsers")
|
2021-10-04 15:14:52 +00:00
|
|
|
|
2023-12-11 09:32:54 +00:00
|
|
|
return cmd
|
2023-01-19 12:29:36 +00:00
|
|
|
}
|
|
|
|
|
2023-12-11 09:32:54 +00:00
|
|
|
func (cli cliHubTest) NewRunCmd() *cobra.Command {
|
2021-10-04 15:14:52 +00:00
|
|
|
var noClean bool
|
|
|
|
var runAll bool
|
|
|
|
var forceClean bool
|
2023-12-14 15:05:16 +00:00
|
|
|
var NucleiTargetHost string
|
|
|
|
var AppSecHost string
|
2023-12-11 09:32:54 +00:00
|
|
|
var cmd = &cobra.Command{
|
2021-10-04 15:14:52 +00:00
|
|
|
Use: "run",
|
|
|
|
Short: "run [test_name]",
|
|
|
|
DisableAutoGenTag: true,
|
2023-02-20 14:05:42 +00:00
|
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
2021-10-04 15:14:52 +00:00
|
|
|
if !runAll && len(args) == 0 {
|
2022-03-10 12:55:25 +00:00
|
|
|
printHelp(cmd)
|
2023-11-24 14:57:32 +00:00
|
|
|
return fmt.Errorf("please provide test to run or --all flag")
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
2023-12-14 15:05:16 +00:00
|
|
|
hubPtr.NucleiTargetHost = NucleiTargetHost
|
|
|
|
hubPtr.AppSecHost = AppSecHost
|
2021-10-04 15:14:52 +00:00
|
|
|
if runAll {
|
2023-12-07 11:21:04 +00:00
|
|
|
if err := hubPtr.LoadAllTests(); err != nil {
|
2023-02-20 14:05:42 +00:00
|
|
|
return fmt.Errorf("unable to load all tests: %+v", err)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for _, testName := range args {
|
2023-12-07 11:21:04 +00:00
|
|
|
_, err := hubPtr.LoadTestItem(testName)
|
2021-10-04 15:14:52 +00:00
|
|
|
if err != nil {
|
2023-02-20 14:05:42 +00:00
|
|
|
return fmt.Errorf("unable to load test '%s': %s", testName, err)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-11-24 14:57:32 +00:00
|
|
|
// set timezone to avoid DST issues
|
|
|
|
os.Setenv("TZ", "UTC")
|
2023-12-07 11:21:04 +00:00
|
|
|
for _, test := range hubPtr.Tests {
|
2021-10-04 15:14:52 +00:00
|
|
|
if csConfig.Cscli.Output == "human" {
|
|
|
|
log.Infof("Running test '%s'", test.Name)
|
|
|
|
}
|
|
|
|
err := test.Run()
|
|
|
|
if err != nil {
|
|
|
|
log.Errorf("running test '%s' failed: %+v", test.Name, err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-02-20 14:05:42 +00:00
|
|
|
return nil
|
2021-10-04 15:14:52 +00:00
|
|
|
},
|
2023-12-15 14:27:22 +00:00
|
|
|
PersistentPostRunE: func(_ *cobra.Command, _ []string) error {
|
2021-10-04 15:14:52 +00:00
|
|
|
success := true
|
|
|
|
testResult := make(map[string]bool)
|
2023-12-07 11:21:04 +00:00
|
|
|
for _, test := range hubPtr.Tests {
|
|
|
|
if test.AutoGen && !isAppsecTest {
|
2021-10-04 15:14:52 +00:00
|
|
|
if test.ParserAssert.AutoGenAssert {
|
|
|
|
log.Warningf("Assert file '%s' is empty, generating assertion:", test.ParserAssert.File)
|
|
|
|
fmt.Println()
|
|
|
|
fmt.Println(test.ParserAssert.AutoGenAssertData)
|
|
|
|
}
|
|
|
|
if test.ScenarioAssert.AutoGenAssert {
|
|
|
|
log.Warningf("Assert file '%s' is empty, generating assertion:", test.ScenarioAssert.File)
|
|
|
|
fmt.Println()
|
|
|
|
fmt.Println(test.ScenarioAssert.AutoGenAssertData)
|
|
|
|
}
|
|
|
|
if !noClean {
|
|
|
|
if err := test.Clean(); err != nil {
|
2023-02-20 14:05:42 +00:00
|
|
|
return fmt.Errorf("unable to clean test '%s' env: %s", test.Name, err)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
fmt.Printf("\nPlease fill your assert file(s) for test '%s', exiting\n", test.Name)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
testResult[test.Name] = test.Success
|
|
|
|
if test.Success {
|
|
|
|
if csConfig.Cscli.Output == "human" {
|
|
|
|
log.Infof("Test '%s' passed successfully (%d assertions)\n", test.Name, test.ParserAssert.NbAssert+test.ScenarioAssert.NbAssert)
|
|
|
|
}
|
|
|
|
if !noClean {
|
|
|
|
if err := test.Clean(); err != nil {
|
2023-02-20 14:05:42 +00:00
|
|
|
return fmt.Errorf("unable to clean test '%s' env: %s", test.Name, err)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
success = false
|
|
|
|
cleanTestEnv := false
|
|
|
|
if csConfig.Cscli.Output == "human" {
|
|
|
|
if len(test.ParserAssert.Fails) > 0 {
|
|
|
|
fmt.Println()
|
|
|
|
log.Errorf("Parser test '%s' failed (%d errors)\n", test.Name, len(test.ParserAssert.Fails))
|
|
|
|
for _, fail := range test.ParserAssert.Fails {
|
|
|
|
fmt.Printf("(L.%d) %s => %s\n", fail.Line, emoji.RedCircle, fail.Expression)
|
|
|
|
fmt.Printf(" Actual expression values:\n")
|
|
|
|
for key, value := range fail.Debug {
|
|
|
|
fmt.Printf(" %s = '%s'\n", key, strings.TrimSuffix(value, "\n"))
|
|
|
|
}
|
|
|
|
fmt.Println()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if len(test.ScenarioAssert.Fails) > 0 {
|
|
|
|
fmt.Println()
|
|
|
|
log.Errorf("Scenario test '%s' failed (%d errors)\n", test.Name, len(test.ScenarioAssert.Fails))
|
|
|
|
for _, fail := range test.ScenarioAssert.Fails {
|
|
|
|
fmt.Printf("(L.%d) %s => %s\n", fail.Line, emoji.RedCircle, fail.Expression)
|
|
|
|
fmt.Printf(" Actual expression values:\n")
|
|
|
|
for key, value := range fail.Debug {
|
|
|
|
fmt.Printf(" %s = '%s'\n", key, strings.TrimSuffix(value, "\n"))
|
|
|
|
}
|
|
|
|
fmt.Println()
|
|
|
|
}
|
|
|
|
}
|
2021-12-14 10:08:06 +00:00
|
|
|
if !forceClean && !noClean {
|
2021-10-04 15:14:52 +00:00
|
|
|
prompt := &survey.Confirm{
|
|
|
|
Message: fmt.Sprintf("\nDo you want to remove runtime folder for test '%s'? (default: Yes)", test.Name),
|
|
|
|
Default: true,
|
|
|
|
}
|
|
|
|
if err := survey.AskOne(prompt, &cleanTestEnv); err != nil {
|
2023-02-20 14:05:42 +00:00
|
|
|
return fmt.Errorf("unable to ask to remove runtime folder: %s", err)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if cleanTestEnv || forceClean {
|
|
|
|
if err := test.Clean(); err != nil {
|
2023-02-20 14:05:42 +00:00
|
|
|
return fmt.Errorf("unable to clean test '%s' env: %s", test.Name, err)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-11-24 14:57:32 +00:00
|
|
|
|
|
|
|
switch csConfig.Cscli.Output {
|
|
|
|
case "human":
|
2022-10-13 10:28:24 +00:00
|
|
|
hubTestResultTable(color.Output, testResult)
|
2023-11-24 14:57:32 +00:00
|
|
|
case "json":
|
2021-10-04 15:14:52 +00:00
|
|
|
jsonResult := make(map[string][]string, 0)
|
|
|
|
jsonResult["success"] = make([]string, 0)
|
|
|
|
jsonResult["fail"] = make([]string, 0)
|
|
|
|
for testName, success := range testResult {
|
|
|
|
if success {
|
|
|
|
jsonResult["success"] = append(jsonResult["success"], testName)
|
|
|
|
} else {
|
|
|
|
jsonResult["fail"] = append(jsonResult["fail"], testName)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
jsonStr, err := json.Marshal(jsonResult)
|
|
|
|
if err != nil {
|
2023-02-20 14:05:42 +00:00
|
|
|
return fmt.Errorf("unable to json test result: %s", err)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
|
|
|
fmt.Println(string(jsonStr))
|
2023-11-24 14:57:32 +00:00
|
|
|
default:
|
|
|
|
return fmt.Errorf("only human/json output modes are supported")
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if !success {
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
2023-02-20 14:05:42 +00:00
|
|
|
|
|
|
|
return nil
|
2021-10-04 15:14:52 +00:00
|
|
|
},
|
|
|
|
}
|
2023-11-24 14:57:32 +00:00
|
|
|
|
2023-12-11 09:32:54 +00:00
|
|
|
cmd.Flags().BoolVar(&noClean, "no-clean", false, "Don't clean runtime environment if test succeed")
|
|
|
|
cmd.Flags().BoolVar(&forceClean, "clean", false, "Clean runtime environment if test fail")
|
2023-12-14 15:05:16 +00:00
|
|
|
cmd.Flags().StringVar(&NucleiTargetHost, "target", hubtest.DefaultNucleiTarget, "Target for AppSec Test")
|
|
|
|
cmd.Flags().StringVar(&AppSecHost, "host", hubtest.DefaultAppsecHost, "Address to expose AppSec for hubtest")
|
2023-12-11 09:32:54 +00:00
|
|
|
cmd.Flags().BoolVar(&runAll, "all", false, "Run all tests")
|
2021-10-04 15:14:52 +00:00
|
|
|
|
2023-12-11 09:32:54 +00:00
|
|
|
return cmd
|
2023-01-19 12:29:36 +00:00
|
|
|
}
|
|
|
|
|
2023-12-11 09:32:54 +00:00
|
|
|
func (cli cliHubTest) NewCleanCmd() *cobra.Command {
|
|
|
|
var cmd = &cobra.Command{
|
2021-10-04 15:14:52 +00:00
|
|
|
Use: "clean",
|
|
|
|
Short: "clean [test_name]",
|
|
|
|
Args: cobra.MinimumNArgs(1),
|
|
|
|
DisableAutoGenTag: true,
|
2023-12-15 14:27:22 +00:00
|
|
|
RunE: func(_ *cobra.Command, args []string) error {
|
2021-10-04 15:14:52 +00:00
|
|
|
for _, testName := range args {
|
2023-12-07 11:21:04 +00:00
|
|
|
test, err := hubPtr.LoadTestItem(testName)
|
2021-10-04 15:14:52 +00:00
|
|
|
if err != nil {
|
2023-02-20 14:05:42 +00:00
|
|
|
return fmt.Errorf("unable to load test '%s': %s", testName, err)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
|
|
|
if err := test.Clean(); err != nil {
|
2023-02-20 14:05:42 +00:00
|
|
|
return fmt.Errorf("unable to clean test '%s' env: %s", test.Name, err)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
|
|
|
}
|
2023-02-20 14:05:42 +00:00
|
|
|
|
|
|
|
return nil
|
2021-10-04 15:14:52 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2023-12-11 09:32:54 +00:00
|
|
|
return cmd
|
2023-01-19 12:29:36 +00:00
|
|
|
}
|
|
|
|
|
2023-12-11 09:32:54 +00:00
|
|
|
func (cli cliHubTest) NewInfoCmd() *cobra.Command {
|
|
|
|
cmd := &cobra.Command{
|
2021-10-04 15:14:52 +00:00
|
|
|
Use: "info",
|
|
|
|
Short: "info [test_name]",
|
|
|
|
Args: cobra.MinimumNArgs(1),
|
|
|
|
DisableAutoGenTag: true,
|
2023-12-15 14:27:22 +00:00
|
|
|
RunE: func(_ *cobra.Command, args []string) error {
|
2021-10-04 15:14:52 +00:00
|
|
|
for _, testName := range args {
|
2023-12-07 11:21:04 +00:00
|
|
|
test, err := hubPtr.LoadTestItem(testName)
|
2021-10-04 15:14:52 +00:00
|
|
|
if err != nil {
|
2023-02-20 14:05:42 +00:00
|
|
|
return fmt.Errorf("unable to load test '%s': %s", testName, err)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
|
|
|
fmt.Println()
|
|
|
|
fmt.Printf(" Test name : %s\n", test.Name)
|
|
|
|
fmt.Printf(" Test path : %s\n", test.Path)
|
2023-12-07 11:21:04 +00:00
|
|
|
if isAppsecTest {
|
|
|
|
fmt.Printf(" Nuclei Template : %s\n", test.Config.NucleiTemplate)
|
|
|
|
fmt.Printf(" Appsec Rules : %s\n", strings.Join(test.Config.AppsecRules, ", "))
|
|
|
|
} else {
|
|
|
|
fmt.Printf(" Log file : %s\n", filepath.Join(test.Path, test.Config.LogFile))
|
|
|
|
fmt.Printf(" Parser assertion file : %s\n", filepath.Join(test.Path, hubtest.ParserAssertFileName))
|
|
|
|
fmt.Printf(" Scenario assertion file : %s\n", filepath.Join(test.Path, hubtest.ScenarioAssertFileName))
|
|
|
|
}
|
2021-10-04 15:14:52 +00:00
|
|
|
fmt.Printf(" Configuration File : %s\n", filepath.Join(test.Path, "config.yaml"))
|
|
|
|
}
|
2023-02-20 14:05:42 +00:00
|
|
|
|
|
|
|
return nil
|
2021-10-04 15:14:52 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2023-12-11 09:32:54 +00:00
|
|
|
return cmd
|
2023-01-19 12:29:36 +00:00
|
|
|
}
|
|
|
|
|
2023-12-11 09:32:54 +00:00
|
|
|
func (cli cliHubTest) NewListCmd() *cobra.Command {
|
|
|
|
cmd := &cobra.Command{
|
2021-10-04 15:14:52 +00:00
|
|
|
Use: "list",
|
|
|
|
Short: "list",
|
|
|
|
DisableAutoGenTag: true,
|
2023-12-15 14:27:22 +00:00
|
|
|
RunE: func(_ *cobra.Command, _ []string) error {
|
2023-12-07 11:21:04 +00:00
|
|
|
if err := hubPtr.LoadAllTests(); err != nil {
|
2023-02-20 14:05:42 +00:00
|
|
|
return fmt.Errorf("unable to load all tests: %s", err)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
|
|
|
|
2022-10-07 09:05:35 +00:00
|
|
|
switch csConfig.Cscli.Output {
|
|
|
|
case "human":
|
2023-12-07 11:21:04 +00:00
|
|
|
hubTestListTable(color.Output, hubPtr.Tests)
|
2022-10-07 09:05:35 +00:00
|
|
|
case "json":
|
2023-12-07 11:21:04 +00:00
|
|
|
j, err := json.MarshalIndent(hubPtr.Tests, " ", " ")
|
2022-10-07 09:05:35 +00:00
|
|
|
if err != nil {
|
2023-02-20 14:05:42 +00:00
|
|
|
return err
|
2022-10-07 09:05:35 +00:00
|
|
|
}
|
|
|
|
fmt.Println(string(j))
|
|
|
|
default:
|
2023-02-20 14:05:42 +00:00
|
|
|
return fmt.Errorf("only human/json output modes are supported")
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
2023-02-20 14:05:42 +00:00
|
|
|
|
|
|
|
return nil
|
2021-10-04 15:14:52 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2023-12-11 09:32:54 +00:00
|
|
|
return cmd
|
2023-01-19 12:29:36 +00:00
|
|
|
}
|
|
|
|
|
2023-12-11 09:32:54 +00:00
|
|
|
func (cli cliHubTest) NewCoverageCmd() *cobra.Command {
|
2021-10-04 15:14:52 +00:00
|
|
|
var showParserCov bool
|
|
|
|
var showScenarioCov bool
|
|
|
|
var showOnlyPercent bool
|
2023-12-07 11:21:04 +00:00
|
|
|
var showAppsecCov bool
|
2023-01-19 12:29:36 +00:00
|
|
|
|
2023-12-11 09:32:54 +00:00
|
|
|
cmd := &cobra.Command{
|
2021-10-04 15:14:52 +00:00
|
|
|
Use: "coverage",
|
|
|
|
Short: "coverage",
|
|
|
|
DisableAutoGenTag: true,
|
2023-12-15 14:27:22 +00:00
|
|
|
RunE: func(_ *cobra.Command, _ []string) error {
|
2023-12-07 11:21:04 +00:00
|
|
|
//for this one we explicitly don't do for appsec
|
2021-10-04 15:14:52 +00:00
|
|
|
if err := HubTest.LoadAllTests(); err != nil {
|
2023-02-20 14:05:42 +00:00
|
|
|
return fmt.Errorf("unable to load all tests: %+v", err)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
|
|
|
var err error
|
2023-11-24 14:57:32 +00:00
|
|
|
scenarioCoverage := []hubtest.Coverage{}
|
|
|
|
parserCoverage := []hubtest.Coverage{}
|
2023-12-07 11:21:04 +00:00
|
|
|
appsecRuleCoverage := []hubtest.Coverage{}
|
2021-10-04 15:14:52 +00:00
|
|
|
scenarioCoveragePercent := 0
|
|
|
|
parserCoveragePercent := 0
|
2023-12-07 11:21:04 +00:00
|
|
|
appsecRuleCoveragePercent := 0
|
2021-10-04 15:14:52 +00:00
|
|
|
|
2022-10-07 09:05:35 +00:00
|
|
|
// if both are false (flag by default), show both
|
2023-12-07 11:21:04 +00:00
|
|
|
showAll := !showScenarioCov && !showParserCov && !showAppsecCov
|
2021-10-04 15:14:52 +00:00
|
|
|
|
|
|
|
if showParserCov || showAll {
|
|
|
|
parserCoverage, err = HubTest.GetParsersCoverage()
|
|
|
|
if err != nil {
|
2023-02-20 14:05:42 +00:00
|
|
|
return fmt.Errorf("while getting parser coverage: %s", err)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
|
|
|
parserTested := 0
|
|
|
|
for _, test := range parserCoverage {
|
|
|
|
if test.TestsCount > 0 {
|
2023-11-24 14:57:32 +00:00
|
|
|
parserTested++
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
parserCoveragePercent = int(math.Round((float64(parserTested) / float64(len(parserCoverage)) * 100)))
|
|
|
|
}
|
|
|
|
|
|
|
|
if showScenarioCov || showAll {
|
|
|
|
scenarioCoverage, err = HubTest.GetScenariosCoverage()
|
|
|
|
if err != nil {
|
2023-02-20 14:05:42 +00:00
|
|
|
return fmt.Errorf("while getting scenario coverage: %s", err)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
2023-11-24 14:57:32 +00:00
|
|
|
|
2021-10-04 15:14:52 +00:00
|
|
|
scenarioTested := 0
|
|
|
|
for _, test := range scenarioCoverage {
|
|
|
|
if test.TestsCount > 0 {
|
2023-11-24 14:57:32 +00:00
|
|
|
scenarioTested++
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
|
|
|
}
|
2023-11-24 14:57:32 +00:00
|
|
|
|
2021-10-04 15:14:52 +00:00
|
|
|
scenarioCoveragePercent = int(math.Round((float64(scenarioTested) / float64(len(scenarioCoverage)) * 100)))
|
|
|
|
}
|
|
|
|
|
2023-12-07 11:21:04 +00:00
|
|
|
if showAppsecCov || showAll {
|
|
|
|
appsecRuleCoverage, err = HubTest.GetAppsecCoverage()
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("while getting scenario coverage: %s", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
appsecRuleTested := 0
|
|
|
|
for _, test := range appsecRuleCoverage {
|
|
|
|
if test.TestsCount > 0 {
|
|
|
|
appsecRuleTested++
|
|
|
|
}
|
|
|
|
}
|
|
|
|
appsecRuleCoveragePercent = int(math.Round((float64(appsecRuleTested) / float64(len(appsecRuleCoverage)) * 100)))
|
|
|
|
}
|
|
|
|
|
2021-10-04 15:14:52 +00:00
|
|
|
if showOnlyPercent {
|
|
|
|
if showAll {
|
2023-12-07 11:21:04 +00:00
|
|
|
fmt.Printf("parsers=%d%%\nscenarios=%d%%\nappsec_rules=%d%%", parserCoveragePercent, scenarioCoveragePercent, appsecRuleCoveragePercent)
|
2021-10-04 15:14:52 +00:00
|
|
|
} else if showParserCov {
|
|
|
|
fmt.Printf("parsers=%d%%", parserCoveragePercent)
|
|
|
|
} else if showScenarioCov {
|
|
|
|
fmt.Printf("scenarios=%d%%", scenarioCoveragePercent)
|
2023-12-07 11:21:04 +00:00
|
|
|
} else if showAppsecCov {
|
|
|
|
fmt.Printf("appsec_rules=%d%%", appsecRuleCoveragePercent)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
|
|
|
os.Exit(0)
|
|
|
|
}
|
|
|
|
|
2023-11-24 14:57:32 +00:00
|
|
|
switch csConfig.Cscli.Output {
|
|
|
|
case "human":
|
2021-10-04 15:14:52 +00:00
|
|
|
if showParserCov || showAll {
|
2022-10-13 10:28:24 +00:00
|
|
|
hubTestParserCoverageTable(color.Output, parserCoverage)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if showScenarioCov || showAll {
|
2022-10-13 10:28:24 +00:00
|
|
|
hubTestScenarioCoverageTable(color.Output, scenarioCoverage)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
2023-12-07 11:21:04 +00:00
|
|
|
|
|
|
|
if showAppsecCov || showAll {
|
|
|
|
hubTestAppsecRuleCoverageTable(color.Output, appsecRuleCoverage)
|
|
|
|
}
|
|
|
|
|
2021-10-04 15:14:52 +00:00
|
|
|
fmt.Println()
|
|
|
|
if showParserCov || showAll {
|
|
|
|
fmt.Printf("PARSERS : %d%% of coverage\n", parserCoveragePercent)
|
|
|
|
}
|
|
|
|
if showScenarioCov || showAll {
|
|
|
|
fmt.Printf("SCENARIOS : %d%% of coverage\n", scenarioCoveragePercent)
|
|
|
|
}
|
2023-12-07 11:21:04 +00:00
|
|
|
if showAppsecCov || showAll {
|
|
|
|
fmt.Printf("APPSEC RULES : %d%% of coverage\n", appsecRuleCoveragePercent)
|
|
|
|
}
|
2023-11-24 14:57:32 +00:00
|
|
|
case "json":
|
2021-10-04 15:14:52 +00:00
|
|
|
dump, err := json.MarshalIndent(parserCoverage, "", " ")
|
|
|
|
if err != nil {
|
2023-02-20 14:05:42 +00:00
|
|
|
return err
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
|
|
|
fmt.Printf("%s", dump)
|
|
|
|
dump, err = json.MarshalIndent(scenarioCoverage, "", " ")
|
|
|
|
if err != nil {
|
2023-02-20 14:05:42 +00:00
|
|
|
return err
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
|
|
|
fmt.Printf("%s", dump)
|
2023-12-07 11:21:04 +00:00
|
|
|
dump, err = json.MarshalIndent(appsecRuleCoverage, "", " ")
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
fmt.Printf("%s", dump)
|
2023-11-24 14:57:32 +00:00
|
|
|
default:
|
2023-02-20 14:05:42 +00:00
|
|
|
return fmt.Errorf("only human/json output modes are supported")
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
|
|
|
|
2023-02-20 14:05:42 +00:00
|
|
|
return nil
|
2021-10-04 15:14:52 +00:00
|
|
|
},
|
|
|
|
}
|
2023-11-24 14:57:32 +00:00
|
|
|
|
2023-12-11 09:32:54 +00:00
|
|
|
cmd.PersistentFlags().BoolVar(&showOnlyPercent, "percent", false, "Show only percentages of coverage")
|
|
|
|
cmd.PersistentFlags().BoolVar(&showParserCov, "parsers", false, "Show only parsers coverage")
|
|
|
|
cmd.PersistentFlags().BoolVar(&showScenarioCov, "scenarios", false, "Show only scenarios coverage")
|
|
|
|
cmd.PersistentFlags().BoolVar(&showAppsecCov, "appsec", false, "Show only appsec coverage")
|
2021-10-04 15:14:52 +00:00
|
|
|
|
2023-12-11 09:32:54 +00:00
|
|
|
return cmd
|
2023-01-19 12:29:36 +00:00
|
|
|
}
|
|
|
|
|
2023-12-11 09:32:54 +00:00
|
|
|
func (cli cliHubTest) NewEvalCmd() *cobra.Command {
|
2021-10-04 15:14:52 +00:00
|
|
|
var evalExpression string
|
2023-12-11 09:32:54 +00:00
|
|
|
|
|
|
|
cmd := &cobra.Command{
|
2021-10-04 15:14:52 +00:00
|
|
|
Use: "eval",
|
|
|
|
Short: "eval [test_name]",
|
|
|
|
Args: cobra.ExactArgs(1),
|
|
|
|
DisableAutoGenTag: true,
|
2023-12-15 14:27:22 +00:00
|
|
|
RunE: func(_ *cobra.Command, args []string) error {
|
2021-10-04 15:14:52 +00:00
|
|
|
for _, testName := range args {
|
2023-12-07 11:21:04 +00:00
|
|
|
test, err := hubPtr.LoadTestItem(testName)
|
2021-10-04 15:14:52 +00:00
|
|
|
if err != nil {
|
2023-02-20 14:05:42 +00:00
|
|
|
return fmt.Errorf("can't load test: %+v", err)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
2023-11-24 14:57:32 +00:00
|
|
|
|
2021-10-04 15:14:52 +00:00
|
|
|
err = test.ParserAssert.LoadTest(test.ParserResultFile)
|
|
|
|
if err != nil {
|
2023-02-20 14:05:42 +00:00
|
|
|
return fmt.Errorf("can't load test results from '%s': %+v", test.ParserResultFile, err)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
2023-11-24 14:57:32 +00:00
|
|
|
|
2021-10-04 15:14:52 +00:00
|
|
|
output, err := test.ParserAssert.EvalExpression(evalExpression)
|
|
|
|
if err != nil {
|
2023-02-20 14:05:42 +00:00
|
|
|
return err
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
2023-11-24 14:57:32 +00:00
|
|
|
|
2022-05-25 20:27:50 +00:00
|
|
|
fmt.Print(output)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
2023-02-20 14:05:42 +00:00
|
|
|
|
|
|
|
return nil
|
2021-10-04 15:14:52 +00:00
|
|
|
},
|
|
|
|
}
|
2023-11-24 14:57:32 +00:00
|
|
|
|
2023-12-11 09:32:54 +00:00
|
|
|
cmd.PersistentFlags().StringVarP(&evalExpression, "expr", "e", "", "Expression to eval")
|
2021-10-04 15:14:52 +00:00
|
|
|
|
2023-12-11 09:32:54 +00:00
|
|
|
return cmd
|
2023-01-19 12:29:36 +00:00
|
|
|
}
|
|
|
|
|
2023-12-11 09:32:54 +00:00
|
|
|
func (cli cliHubTest) NewExplainCmd() *cobra.Command {
|
|
|
|
cmd := &cobra.Command{
|
2021-10-04 15:14:52 +00:00
|
|
|
Use: "explain",
|
|
|
|
Short: "explain [test_name]",
|
|
|
|
Args: cobra.ExactArgs(1),
|
|
|
|
DisableAutoGenTag: true,
|
2023-12-15 14:27:22 +00:00
|
|
|
RunE: func(_ *cobra.Command, args []string) error {
|
2021-10-04 15:14:52 +00:00
|
|
|
for _, testName := range args {
|
|
|
|
test, err := HubTest.LoadTestItem(testName)
|
|
|
|
if err != nil {
|
2023-02-20 14:05:42 +00:00
|
|
|
return fmt.Errorf("can't load test: %+v", err)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
|
|
|
err = test.ParserAssert.LoadTest(test.ParserResultFile)
|
|
|
|
if err != nil {
|
2023-11-24 14:57:32 +00:00
|
|
|
if err = test.Run(); err != nil {
|
2023-02-20 14:05:42 +00:00
|
|
|
return fmt.Errorf("running test '%s' failed: %+v", test.Name, err)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
2023-11-24 14:57:32 +00:00
|
|
|
|
|
|
|
if err = test.ParserAssert.LoadTest(test.ParserResultFile); err != nil {
|
2023-02-20 14:05:42 +00:00
|
|
|
return fmt.Errorf("unable to load parser result after run: %s", err)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
err = test.ScenarioAssert.LoadTest(test.ScenarioResultFile, test.BucketPourResultFile)
|
|
|
|
if err != nil {
|
2023-11-24 14:57:32 +00:00
|
|
|
if err = test.Run(); err != nil {
|
2023-02-20 14:05:42 +00:00
|
|
|
return fmt.Errorf("running test '%s' failed: %+v", test.Name, err)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
2023-11-24 14:57:32 +00:00
|
|
|
|
|
|
|
if err = test.ScenarioAssert.LoadTest(test.ScenarioResultFile, test.BucketPourResultFile); err != nil {
|
2023-02-20 14:05:42 +00:00
|
|
|
return fmt.Errorf("unable to load scenario result after run: %s", err)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
|
|
|
}
|
2022-10-17 07:24:07 +00:00
|
|
|
opts := hubtest.DumpOpts{}
|
|
|
|
hubtest.DumpTree(*test.ParserAssert.TestData, *test.ScenarioAssert.PourData, opts)
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|
2023-02-20 14:05:42 +00:00
|
|
|
|
|
|
|
return nil
|
2021-10-04 15:14:52 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2023-12-11 09:32:54 +00:00
|
|
|
return cmd
|
2021-10-04 15:14:52 +00:00
|
|
|
}
|