Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-morris committed Oct 29, 2018
1 parent cd37302 commit e318558
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions gnql
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"))

0 comments on commit e318558

Please sign in to comment.