Skip to content

Comments

fix JSON file output#183

Merged
Mzack9999 merged 15 commits intodevfrom
fix_json_file_output
Jan 21, 2024
Merged

fix JSON file output#183
Mzack9999 merged 15 commits intodevfrom
fix_json_file_output

Conversation

@dogancanbakir
Copy link
Member

@dogancanbakir dogancanbakir commented Sep 25, 2023

Closes #176.

$ go run asnmap.go -a AS20940 -j -o output.json

   ___   _____  __              
  / _ | / __/ |/ /_ _  ___ ____ 
 / __ |_\ \/    /  ' \/ _  / _ \
/_/ |_/___/_/|_/_/_/_/\_,_/ .__/
                         /_/ 

                projectdiscovery.io

[INF] Current asnmap version v1.0.5 (latest)

$ cat output.json | jq | head -20
[
  {
    "timestamp": "2023-09-25 11:45:02.301681257 +0000 UTC",
    "input": "AS20940",
    "as_number": "AS20940",
    "as_name": "AKAMAI-ASN1",
    "as_country": "NL",
    "as_range": [
      "2.16.0.0/23",
      "2.16.2.0/24"
    ]
  },
  {
    "timestamp": "2023-09-25 11:45:02.301777549 +0000 UTC",
    "input": "AS20940",
    "as_number": "AS20940",
    "as_name": "AKAMAI-ASN1",
    "as_country": "NL",
    "as_range": [
      "2.16.4.0/22",

@dogancanbakir dogancanbakir self-assigned this Sep 25, 2023
@Mzack9999 Mzack9999 added the Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors. label Oct 10, 2023
Copy link
Member

@Mzack9999 Mzack9999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually we do a lot of work:

Response => Result => Slice of results with manual marshaling => json line

Probably we can refactor the code so that each response mapped to a result results in a json line directly:

Response => intializeResult => Result => json line

@ehsandeep ehsandeep changed the base branch from main to dev October 10, 2023 09:21
Copy link
Member

@Mzack9999 Mzack9999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

implementation: lgtm
tests fail because API gives 502

Copy link
Member

@ehsandeep ehsandeep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • asnmap -j option write output in json format, we can update it write in json line format to keep it uniform like other pd tools.
  • when -j option is used with -o, output gets written to only file but not displayed to stdout like other pd tools, we can fix that as well.

Copy link
Member

@ehsandeep ehsandeep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CLI output gets written to file but not visible to stdout.

./asnmap -a AS20940 -o test

@Mzack9999 Mzack9999 merged commit d9c6c03 into dev Jan 21, 2024
@Mzack9999 Mzack9999 deleted the fix_json_file_output branch January 21, 2024 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

-output option is not working

3 participants