Skip to content

Instantly share code, notes, and snippets.

@honoki
Last active August 8, 2023 10:48
Show Gist options
  • Save honoki/6d6c51b5f5d4b01cb471f4d8478d2789 to your computer and use it in GitHub Desktop.
Save honoki/6d6c51b5f5d4b01cb471f4d8478d2789 to your computer and use it in GitHub Desktop.
Update the scope of your HackerOne programs
#!/bin/bash
# Update the scope of your HackerOne programs
h1name="<your-hackerone-username>"
apitoken="<your-hackerone-api-token>"
next='https://api.hackerone.com/v1/hackers/programs?page%5Bsize%5D=100'
for p in $(bbrf programs where platform is hackerone --show-empty-scope); do
h1id=$(bbrf show $p | jq -r .tags.h1id)
echo "Updating $p scope..."
(
curl -g -s 'https://api.hackerone.com/v1/hackers/programs/'$h1id -u $h1name:$apitoken | tee \
>( jq '.relationships.structured_scopes.data[].attributes | select((.asset_type == "URL" or .asset_type == "WILDCARD") and .eligible_for_bounty and .eligible_for_submission) | .asset_identifier' -r | bbrf inscope add - -p $p) \
>( jq '.relationships.structured_scopes.data[].attributes | select((.asset_type == "URL" or .asset_type == "WILDCARD") and .eligible_for_submission == false) | .asset_identifier' -r | bbrf outscope add - -p $p ) \
> /dev/null
) &
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment