-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cd37302
commit e318558
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env python | ||
|
||
import sys | ||
import requests | ||
import json | ||
from urllib import quote | ||
|
||
""" | ||
NOTE: This API endpoint is extremely experimental and likely to break. | ||
This code is just scaffolding. It's literally four lines. | ||
Plz file bugs to https://github.com/GreyNoise-Intelligence/gnql | ||
TODO: | ||
- Incorporate into pygreynoise | ||
- COLORS / ANIMATIONS | ||
- Field selection | ||
- Clean up grammar | ||
- Make forward slashes less of a pain in the ass | ||
- Multiple output options (JSON, CSV, Plaintext, XML) | ||
- Pagination | ||
""" | ||
|
||
# Insert your GreyNoise Enterprise / Research Tools key here | ||
GREYNOISE_API_KEY = "aksjdhkajsdhkasjhd" | ||
|
||
if len(sys.argv) <= 1: | ||
print("[+] Usage: ./gnql yourqueryhere") | ||
sys.exit(1) | ||
|
||
# Smash args together | ||
query = " ".join(sys.argv[1:]) | ||
|
||
# Issue request against API | ||
r = requests.get("https://research.api.greynoise.io/v2/experimental/gnql", params={"query": query}, headers={"key": GREYNOISE_API_KEY}) | ||
|
||
# Print the results | ||
print(r.text.encode("utf-8")) |