-
Notifications
You must be signed in to change notification settings - Fork 181
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
Add Shodan Command-Line Interface Plugin #400
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution! I've left a few questions.
plugins/shodan/api_key.go
Outdated
} | ||
|
||
func TryShodanConfigFile() sdk.Importer { | ||
return importer.TryFile("~/.config/shodan/api_key", func(ctx context.Context, contents importer.FileContents, in sdk.ImportInput, out *sdk.ImportAttempt) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For many tools, the equivalent of ~/.config from Linux on MacOS is ~/Library/Application Support.
Is this the case here too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After checking the source code of the CLI tool (https://github.com/achillean/shodan-python/blob/master/shodan/cli/settings.py), it seems that the OS does not matter and the configuration file is stored in ~/.shodan/config
if the ~/.shodan/
directory exists. Otherwise, it is stored in ~/.config/shodan/
.
I modified the importers to try reading from both locations, and changed the provisioner to use the ~/.shodan/
directory.
plugins/shodan/api_key.go
Outdated
func APIKey() schema.CredentialType { | ||
return schema.CredentialType{ | ||
Name: credname.APIKey, | ||
DocsURL: sdk.URL("https://developer.shodan.io/api/requirements"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks to refer to the API, could we replace this by https://cli.shodan.io/?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I replaced the link with the one you provided.
needsauth.NotForHelpOrVersion(), | ||
needsauth.NotWithoutArgs(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shall we also exclude shodan init
from here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appended needsauth.NotForExactArgs("init")
to the arguments of needsauth.IfAll()
.
@hculea Thank you for your review and suggestions! I have addressed them. Please let me know if the changes are satisfactory or if there are any other modifications I should make. |
Overview
Add Plugin for Shodan Command-Line Interface.
Type of change
Related Issue(s)
How To Test
op plugin init shodan
shodan info
Changelog
Authenticate the Shodan Command-Line Interface using Touch ID and other unlock options with 1Password Shell Plugins.