Skip to content

Commit

Permalink
add {{}} markers to field formatting (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
parrasajad committed Jul 28, 2022
1 parent 217cb48 commit 160538a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ CONFIG:

OUTPUT:
-o, -output string output file to write found results
-f, -field string field to display in output (ip,port,host) (default "ip:port")
-f, -field string field to display in output ({{ip}},{{port}},{{host}}) (default "{{ip}}:{{port}}")
-j, -json write output in JSONL(ines) format
-r, -raw write raw output as received by the remote api
-l, -limit int limit the number of results to return (default 100)
Expand Down Expand Up @@ -251,10 +251,10 @@ echo 51.83.59.99/24 | uncover

### Field Filters

`-f, -field` flag can be used to indicate which fields to return, currently, `ip`, `port`, and `host` are supported and can be used to return desired fields.
`-f, -field` flag can be used to indicate which fields to return, currently, `{{ip}}`, `{{port}}`, and `{{host}}` are supported and can be used to return desired fields.

```console
uncover -q jira -f host -silent
uncover -q jira -f {{host}} -silent

ec2-44-198-22-253.compute-1.amazonaws.com
ec2-18-246-31-139.us-west-2.compute.amazonaws.com
Expand All @@ -269,11 +269,11 @@ ec2-34-241-80-255.eu-west-1.compute.amazonaws.com

### Field Formatting

**uncover** has a `-f, -field` flag that can be used to customize the output format. For example, in the case of `uncover -f https://ip:port/version`, ip:port will be replaced with results in the output while keeping the format defined, It can also be used to specify a known scheme/path/file in order to prepare the output so that it can be immediately passed as input to other tools in the pipeline.
**uncover** has a `-f, -field` flag that can be used to customize the output format. For example, in the case of `uncover -f https://{{ip}}:{{port}}/version`, {{ip}}:{{port}} will be replaced with results in the output while keeping the format defined, It can also be used to specify a known scheme/path/file in order to prepare the output so that it can be immediately passed as input to other tools in the pipeline.


```console
echo kubernetes | uncover -f https://ip:port/version -silent
echo kubernetes | uncover -f https://{{ip}}:{{port}}/version -silent

https://35.222.229.38:443/version
https://52.11.181.228:443/version
Expand Down
2 changes: 1 addition & 1 deletion runner/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func ParseOptions() *Options {

flagSet.CreateGroup("output", "Output",
flagSet.StringVarP(&options.OutputFile, "output", "o", "", "output file to write found results"),
flagSet.StringVarP(&options.OutputFields, "field", "f", "ip:port", "field to display in output (ip,port,host)"),
flagSet.StringVarP(&options.OutputFields, "field", "f", "{{ip}}:{{port}}", "field to display in output ({{ip}},{{port}},{{host}})"),
flagSet.BoolVarP(&options.JSON, "json", "j", false, "write output in JSONL(ines) format"),
flagSet.BoolVarP(&options.Raw, "raw", "r", false, "write raw output as received by the remote api"),
flagSet.IntVarP(&options.Limit, "limit", "l", 100, "limit the number of results to return"),
Expand Down
6 changes: 3 additions & 3 deletions runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ func (r *Runner) Run(ctx context.Context, query ...string) error {
default:
port := fmt.Sprint(result.Port)
replacer := strings.NewReplacer(
"ip", result.IP,
"host", result.Host,
"port", port,
"{{ip}}", result.IP,
"{{host}}", result.Host,
"{{port}}", port,
)
outData := replacer.Replace(r.options.OutputFields)
searchFor := []string{result.IP, port}
Expand Down

0 comments on commit 160538a

Please sign in to comment.