Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions cmd/cli/carve.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ func listCarves(c *cli.Context) error {
}
case prettyFormat:
table := tablewriter.NewWriter(os.Stdout)
table.SetHeader(header)
table.Header(stringSliceToAnySlice(header)...)
if len(cs) > 0 {
fmt.Printf("Existing carves (%d):\n", len(cs))
data := carvesToData(cs, nil)
table.AppendBulk(data)
table.Bulk(data)
} else {
fmt.Println("No carves")
}
Expand Down Expand Up @@ -182,11 +182,11 @@ func listCarveQueries(c *cli.Context) error {
}
case prettyFormat:
table := tablewriter.NewWriter(os.Stdout)
table.SetHeader(header)
table.Header(stringSliceToAnySlice(header)...)
if len(qs) > 0 {
fmt.Printf("Existing %s carve queries (%d):\n", target, len(qs))
data := queriesToData(qs, nil)
table.AppendBulk(data)
table.Bulk(data)
} else {
fmt.Printf("No %s carve queries\n", target)
}
Expand Down
10 changes: 2 additions & 8 deletions cmd/cli/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,13 +302,7 @@ func listEnvironment(c *cli.Context) error {
}
}
table := tablewriter.NewWriter(os.Stdout)
table.SetHeader([]string{
"UUID",
"Name",
"Type",
"Hostname",
"DebugHTTP?",
})
table.Header("UUID", "Name", "Type", "Hostname", "DebugHTTP?")
if len(envAll) > 0 {
data := [][]string{}
for _, env := range envAll {
Expand All @@ -321,7 +315,7 @@ func listEnvironment(c *cli.Context) error {
}
data = append(data, e)
}
table.AppendBulk(data)
table.Bulk(data)
table.Render()
} else {
fmt.Printf("No environments\n")
Expand Down
8 changes: 4 additions & 4 deletions cmd/cli/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ func listNodes(c *cli.Context) error {
}
case prettyFormat:
table := tablewriter.NewWriter(os.Stdout)
table.SetHeader(header)
table.Header(stringSliceToAnySlice(header)...)
if len(nds) > 0 {
fmt.Printf("Existing %s nodes (%d):\n", target, len(nds))
data := nodesToData(nds, nil)
table.AppendBulk(data)
table.Bulk(data)
} else {
fmt.Printf("No %s nodes\n", target)
}
Expand Down Expand Up @@ -217,9 +217,9 @@ func _showNode(node nodes.OsqueryNode) error {
}
case prettyFormat:
table := tablewriter.NewWriter(os.Stdout)
table.SetHeader(header)
table.Header(stringSliceToAnySlice(header)...)
data := nodeToData(node, nil)
table.AppendBulk(data)
table.Bulk(data)
table.Render()
}
return nil
Expand Down
8 changes: 4 additions & 4 deletions cmd/cli/permission.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ func showPermissions(c *cli.Context) error {
}
case prettyFormat:
table := tablewriter.NewWriter(os.Stdout)
table.SetHeader(header)
table.Header(stringSliceToAnySlice(header)...)
data := accessToData(userAccess, envName, nil)
table.AppendBulk(data)
table.Bulk(data)
table.Render()
}
return nil
Expand Down Expand Up @@ -238,9 +238,9 @@ func allPermissions(c *cli.Context) error {
}
case prettyFormat:
table := tablewriter.NewWriter(os.Stdout)
table.SetHeader(header)
table.Header(stringSliceToAnySlice(header)...)
data := permissionsToData(existingAccess, nil)
table.AppendBulk(data)
table.Bulk(data)
table.Render()
}
return nil
Expand Down
4 changes: 2 additions & 2 deletions cmd/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@ func listQueries(c *cli.Context) error {
}
case formatFlag == prettyFormat:
table := tablewriter.NewWriter(os.Stdout)
table.SetHeader(header)
table.Header(stringSliceToAnySlice(header)...)
if len(qs) > 0 {
fmt.Printf("Existing %s queries (%d):\n", target, len(qs))
data := queriesToData(qs, nil)
table.AppendBulk(data)
table.Bulk(data)
} else {
fmt.Printf("No %s queries\n", target)
}
Expand Down
12 changes: 2 additions & 10 deletions cmd/cli/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,7 @@ func listConfiguration(c *cli.Context) error {
return err
}
table := tablewriter.NewWriter(os.Stdout)
table.SetHeader([]string{
"Name",
"Service",
"Type",
"String",
"Integer",
"Boolean",
"Info",
})
table.Header("Name", "Service", "Type", "String", "Integer", "Boolean", "Info")
if len(values) > 0 {
data := [][]string{}
for _, v := range values {
Expand All @@ -39,7 +31,7 @@ func listConfiguration(c *cli.Context) error {
}
data = append(data, _v)
}
table.AppendBulk(data)
table.Bulk(data)
table.Render()
} else {
fmt.Printf("No configuration values\n")
Expand Down
4 changes: 2 additions & 2 deletions cmd/cli/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,11 @@ func helperListTags(tgs []tags.AdminTag, m environments.MapEnvByID) error {
}
case prettyFormat:
table := tablewriter.NewWriter(os.Stdout)
table.SetHeader(header)
table.Header(stringSliceToAnySlice(header)...)
if len(tgs) > 0 {
fmt.Printf("Existing tags (%d):\n", len(tgs))
data := tagsToData(tgs, m, nil)
table.AppendBulk(data)
table.Bulk(data)
} else {
fmt.Println("No tags")
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/cli/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,11 @@ func listUsers(c *cli.Context) error {
}
case prettyFormat:
table := tablewriter.NewWriter(os.Stdout)
table.SetHeader(header)
table.Header(stringSliceToAnySlice(header)...)
if len(usrs) > 0 {
fmt.Printf("Existing users (%d):\n", len(usrs))
data := usersToData(usrs, nil)
table.AppendBulk(data)
table.Bulk(data)
} else {
fmt.Println("No users")
}
Expand Down Expand Up @@ -235,9 +235,9 @@ func showUser(c *cli.Context) error {
}
case prettyFormat:
table := tablewriter.NewWriter(os.Stdout)
table.SetHeader(header)
table.Header(stringSliceToAnySlice(header)...)
data := userToData(usr, nil)
table.AppendBulk(data)
table.Bulk(data)
table.Render()
}
return nil
Expand Down
8 changes: 8 additions & 0 deletions cmd/cli/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,13 @@ func stringifyBool(b bool) string {
// Helper to get what is the last seen time for a node
func nodeLastSeen(n nodes.OsqueryNode) string {
return utils.PastFutureTimes(n.LastSeen)
}

// Helper to prepare the header for output
func stringSliceToAnySlice(header []string) []any {
result := make([]any, len(header))
for i, v := range header {
result[i] = v
}
return result
}
109 changes: 56 additions & 53 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,67 +4,68 @@ go 1.24.3

require (
github.com/DATA-DOG/go-sqlmock v1.5.2
github.com/aws/aws-sdk-go v1.55.6
github.com/aws/aws-sdk-go-v2 v1.36.3
github.com/aws/aws-sdk-go-v2/config v1.29.11
github.com/aws/aws-sdk-go-v2/credentials v1.17.64
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.68
github.com/aws/aws-sdk-go-v2/service/s3 v1.78.2
github.com/crewjam/saml v0.4.14
github.com/aws/aws-sdk-go v1.55.8
github.com/aws/aws-sdk-go-v2 v1.37.2
github.com/aws/aws-sdk-go-v2/config v1.30.3
github.com/aws/aws-sdk-go-v2/credentials v1.18.3
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.18.3
github.com/aws/aws-sdk-go-v2/service/s3 v1.86.0
github.com/crewjam/saml v0.5.1
github.com/elastic/go-elasticsearch v0.0.0
github.com/elastic/go-elasticsearch/v8 v8.17.1
github.com/elastic/go-elasticsearch/v8 v8.19.0
github.com/go-redis/redis/v8 v8.11.5
github.com/golang-jwt/jwt/v4 v4.5.2
github.com/google/uuid v1.6.0
github.com/gorilla/securecookie v1.1.2
github.com/gorilla/sessions v1.4.0
github.com/olekukonko/tablewriter v0.0.5
github.com/prometheus/client_golang v1.21.1
github.com/olekukonko/tablewriter v1.0.9
github.com/prometheus/client_golang v1.23.0
github.com/rs/zerolog v1.34.0
github.com/segmentio/ksuid v1.0.4
github.com/spf13/viper v1.20.1
github.com/stretchr/testify v1.10.0
github.com/twmb/franz-go v1.18.1
github.com/twmb/franz-go v1.19.5
github.com/twmb/tlscfg v1.2.1
github.com/urfave/cli/v2 v2.27.6
golang.org/x/crypto v0.36.0
golang.org/x/term v0.30.0
github.com/urfave/cli/v2 v2.27.7
golang.org/x/crypto v0.41.0
golang.org/x/term v0.34.0
gopkg.in/natefinch/lumberjack.v2 v2.2.1
gorm.io/driver/postgres v1.5.11
gorm.io/driver/postgres v1.6.0
gorm.io/driver/sqlite v1.5.7
gorm.io/gorm v1.25.12
gorm.io/gorm v1.30.1
)

require (
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.10 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.30 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.34 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.34 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.0 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.2 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.2 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.2 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.34 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.3 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.7.0 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.15 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.15 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.25.2 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.29.2 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.33.17 // indirect
github.com/aws/smithy-go v1.22.3 // indirect
github.com/beevik/etree v1.5.0 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.2 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.0 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.8.2 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.2 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.2 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.27.0 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.32.0 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.36.0 // indirect
github.com/aws/smithy-go v1.22.5 // indirect
github.com/beevik/etree v1.5.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.6 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
github.com/crewjam/httperr v0.2.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/elastic/elastic-transport-go/v8 v8.6.1 // indirect
github.com/fsnotify/fsnotify v1.8.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/elastic/elastic-transport-go/v8 v8.7.0 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/pgx/v5 v5.7.4 // indirect
github.com/jackc/pgx/v5 v5.7.5 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
Expand All @@ -77,32 +78,34 @@ require (
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/mattn/go-sqlite3 v1.14.24 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
github.com/olekukonko/errors v1.1.0 // indirect
github.com/olekukonko/ll v0.0.9 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/pierrec/lz4/v4 v4.1.22 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.63.0 // indirect
github.com/prometheus/procfs v0.16.0 // indirect
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/common v0.65.0 // indirect
github.com/prometheus/procfs v0.17.0 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/russellhaering/goxmldsig v1.5.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sagikazarmark/locafero v0.8.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/sagikazarmark/locafero v0.10.0 // indirect
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
github.com/spf13/afero v1.14.0 // indirect
github.com/spf13/cast v1.7.1 // indirect
github.com/spf13/pflag v1.0.6 // indirect
github.com/spf13/cast v1.9.2 // indirect
github.com/spf13/pflag v1.0.7 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/twmb/franz-go/pkg/kmsg v1.9.0 // indirect
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
github.com/twmb/franz-go/pkg/kmsg v1.11.2 // indirect
github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/otel v1.35.0 // indirect
go.opentelemetry.io/otel/metric v1.35.0 // indirect
go.opentelemetry.io/otel/trace v1.35.0 // indirect
go.opentelemetry.io/otel v1.37.0 // indirect
go.opentelemetry.io/otel/metric v1.37.0 // indirect
go.opentelemetry.io/otel/trace v1.37.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/sync v0.12.0 // indirect
golang.org/x/sys v0.31.0 // indirect
golang.org/x/text v0.23.0 // indirect
google.golang.org/protobuf v1.36.6 // indirect
golang.org/x/sync v0.16.0 // indirect
golang.org/x/sys v0.35.0 // indirect
golang.org/x/text v0.28.0 // indirect
google.golang.org/protobuf v1.36.7 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading
Loading