Last active
November 30, 2021 21:48
-
-
Save goncalor/bcf0c58d385c9ec9fcef302716fb0a03 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Converts `masscan`'s JSON output to JSON lines that can be | |
# parsed by `jq` or `python -m json.tool --json-lines`. | |
# masscan (1.0.4) outputs an array with a trailing comma, which is invalid. | |
# This basically breaks the array into its elements, one per line. | |
# | |
# Example: | |
# [ | |
# {...}, | |
# {...}, | |
# ] | |
# | |
# to | |
# | |
# {...} | |
# {...} | |
# | |
# Usage example: | |
# cat masscan_output.json | ./masscan-json2json | jq -r .ip | |
cat - | sed -e '/^\[/d' -e '/^\]/d' -e 's/,$//' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment