Skip to content

Setup JSON output for domains scripts #184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Edznux
Copy link

@Edznux Edznux commented Oct 28, 2017

Hi,

I've started to add some custom output (JSON) for standalone scripts to address the issue #174.
It should be easy to plug other outputs formats like HTML, XML or maybe CSV....

Is this the correct way to implement this ?
I have only done 2 of the domain script to be sure that's the right thing to do before commiting more.

Each of theses scripts got one new arg : the output format. (only applicable if using them as standalone atm. Passing this argument to the runner should probably be implemented after that)

By default, it is set to console, with colors outputs and ascii arts enabled.
You can set it to json to get a clean json output (pipeable into jq for example)

Example usage :

root@ce7d518eee74:/opt/datasploit# python domain/domain_whois.py example.com json
{"updated_date": "1502694243", "status": ["clientDeleteProhibited https://icann.org/epp#clientDeleteProhibited", "clientTransferProhibited https://icann.org/epp#clientTransferProhibited", "clientUpdateProhibited https://icann.org/epp#clientUpdateProhibited"], "zipcode": "None", "name": "None", "dnssec": "signedDelegation", "city": "None", "expiration_date": "1534132800", "domain_name": "EXAMPLE.COM", "creation_date": "808372800", "whois_server": "whois.iana.org", "state": "None", "registrar": "RESERVED-Internet Assigned Numbers Authority", "referral_url": "None", "address": "None", "name_servers": ["A.IANA-SERVERS.NET", "B.IANA-SERVERS.NET"], "org": "None", "country": "None", "emails": "None"}

Feedback very welcome !

@upgoingstar
Copy link
Member

Will the scripts run even when no arguments are passed? And why not use argparse for doing the same?
Remember we don't want the user to give an explicit argument each time. Sometimes they might not be looking for json outputs at all.

@Edznux
Copy link
Author

Edznux commented Nov 1, 2017

By default, it will use the "console" output. (Check domain/domain_whois.py line 12 and 31 for example)
I could use argparse indeed. What should be the argument's name "output_format", "format" other?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants