Skip to content
Closed
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
1 change: 1 addition & 0 deletions cmd/ipdex/config/global.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package config

var (
OutputFormat string
OutputFile string
ForceRefresh bool
Yes bool
Detailed bool
Expand Down
2 changes: 1 addition & 1 deletion cmd/ipdex/config/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func GetConfigFolder() (string, error) {

func IsSupportedOutputFormat(outputFormat string) bool {
switch outputFormat {
case display.JSONFormat, display.HumanFormat:
case display.JSONFormat, display.HumanFormat, display.PDFFormat:
return true
default:
return false
Expand Down
2 changes: 1 addition & 1 deletion cmd/ipdex/file/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func FileCommand(file string, forceRefresh bool, yes bool) {
}
}
stats := reportClient.GetStats(report)
if err := reportClient.Display(report, stats, viper.GetString(config.OutputFormatOption), config.Detailed); err != nil {
if err := reportClient.Display(report, stats, viper.GetString(config.OutputFormatOption), config.Detailed, config.OutputFile); err != nil {
style.Fatal(err.Error())
}
if !reportExist && outputFormat == display.HumanFormat {
Expand Down
3 changes: 2 additions & 1 deletion cmd/ipdex/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ func init() {
rootCmd.Flags().BoolVarP(&config.ForceRefresh, "refresh", "r", false, "Force refresh an IP or all the IPs of a report")
rootCmd.Flags().BoolVarP(&config.Yes, "yes", "y", false, "Say automatically yes to the warning about the number of IPs to scan")
rootCmd.PersistentFlags().BoolVarP(&config.Detailed, "detailed", "d", false, "Show all informations about an IP or a report")
rootCmd.PersistentFlags().StringVarP(&config.OutputFormat, "output", "o", "", "Output format: human or json")
rootCmd.PersistentFlags().StringVarP(&config.OutputFormat, "output", "o", "", "Output format: human, json, or pdf")
rootCmd.PersistentFlags().StringVar(&config.OutputFile, "output-file", "", "Output file path (e.g., report.pdf, report.json)")
rootCmd.Flags().StringVarP(&config.ReportName, "name", "n", "", "Report name when scanning a file or making a search query")
rootCmd.Flags().BoolVarP(&config.Batching, "batch", "b", false, "Use batching to request the CrowdSec API. Make sure you have a premium API key to use this feature.")
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/ipdex/report/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func NewShowCommand() *cobra.Command {
} else {
style.Fatal("Please provide a report ID or file used in the report you want to show with `ipdex report show 1`")
}
if err := reportClient.Display(report, report.Stats, viper.GetString(config.OutputFormatOption), config.Detailed); err != nil {
if err := reportClient.Display(report, report.Stats, viper.GetString(config.OutputFormatOption), config.Detailed, config.OutputFile); err != nil {
style.Fatal(err.Error())
}
fmt.Println()
Expand Down
2 changes: 1 addition & 1 deletion cmd/ipdex/search/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func SearchCommand(query string, since string, maxResult int) {
style.Fatalf("unable to create report: %s", err)
}
stats := reportClient.GetStats(report)
if err := reportClient.Display(report, stats, viper.GetString(config.OutputFormatOption), config.Detailed); err != nil {
if err := reportClient.Display(report, stats, viper.GetString(config.OutputFormatOption), config.Detailed, config.OutputFile); err != nil {
style.Fatal(err.Error())
}
if outputFormat == display.HumanFormat {
Expand Down
13 changes: 13 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,25 @@ require (
atomicgo.dev/schedule v0.1.0 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/blackfireio/osinfo v1.0.5 // indirect
github.com/boombuler/barcode v1.0.1 // indirect
github.com/charmbracelet/x/ansi v0.4.2 // indirect
github.com/containerd/console v1.0.3 // indirect
github.com/crowdsecurity/go-cs-lib v0.0.16 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/f-amaral/go-async v0.3.0 // indirect
github.com/fsnotify/fsnotify v1.8.0 // indirect
github.com/glebarez/go-sqlite v1.21.2 // indirect
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gookit/color v1.5.4 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hhrutter/lzw v1.0.0 // indirect
github.com/hhrutter/tiff v1.0.1 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/johnfercher/go-tree v1.0.5 // indirect
github.com/johnfercher/maroto/v2 v2.3.3 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/kirsle/configdir v0.0.0-20170128060238-e45d2f54772f // indirect
github.com/lithammer/fuzzysearch v1.1.8 // indirect
Expand All @@ -43,7 +50,10 @@ require (
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/muesli/termenv v0.15.2 // indirect
github.com/pdfcpu/pdfcpu v0.6.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
github.com/phpdave11/gofpdf v1.4.3 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/sagikazarmark/locafero v0.7.0 // indirect
Expand All @@ -54,13 +64,16 @@ require (
github.com/spf13/cast v1.7.1 // indirect
github.com/spf13/pflag v1.0.6 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/wcharczuk/go-chart/v2 v2.1.2 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/exp v0.0.0-20250128182459-e0ece0dbea4c // indirect
golang.org/x/image v0.18.0 // indirect
golang.org/x/sys v0.31.0 // indirect
golang.org/x/term v0.30.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
modernc.org/libc v1.22.5 // indirect
modernc.org/mathutil v1.5.0 // indirect
Expand Down
Loading