Skip to content
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

fix shodan comand description and variable name #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/scripts/shodan.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# SHODAN_API_KEY - Sign up at http://www.shodanhq.com/api_doc
#
# Commands:
# hubot shodan <string> - Search Shodan for any information about string
# hubot shodan <ip> - Search Shodan for any information about ip
#
# Author:
# Scott J Roberts - @sroberts
Expand All @@ -21,9 +21,9 @@ module.exports = (robot) ->
robot.respond /shodan (.*)/i, (msg) ->

if SHODAN_API_KEY?
shodan_term = msg.match[1].toLowerCase()
shodan_ip = msg.match[1].toLowerCase()

request_url = api_url + "/api/host?key=#{SHODAN_API_KEY}&ip=#{shodan_term}"
request_url = api_url + "/api/host?key=#{SHODAN_API_KEY}&ip=#{shodan_ip}"

robot.http(request_url)
.get() (err, res, body) ->
Expand All @@ -32,11 +32,11 @@ module.exports = (robot) ->
shodan_json = JSON.parse body

if shodan_json.error
shodan_profile = "No Shodan information found for #{shodan_term}"
shodan_profile = "No Shodan information found for #{shodan_ip}"

else

shodan_profile = """Shodan Result for #{shodan_term}
shodan_profile = """Shodan Result for #{shodan_ip}
--------------------------------------------
- IP: #{shodan_json.ip}
- Geo: #{shodan_json.city}, #{shodan_json.region_name}, #{shodan_json.country_name}
Expand Down