shodan 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +3 -0
- data/lib/shodan/api.rb +58 -1
- data/lib/shodan/version.rb +1 -1
- metadata +27 -9
data/README.md
CHANGED
data/lib/shodan/api.rb
CHANGED
@@ -16,10 +16,12 @@ module Shodan
|
|
16
16
|
class WebAPI
|
17
17
|
attr_accessor :api_key
|
18
18
|
attr_accessor :base_url
|
19
|
+
attr_accessor :exploitdb
|
19
20
|
|
20
21
|
def initialize(api_key)
|
21
22
|
@api_key = api_key
|
22
23
|
@base_url = "http://www.shodanhq.com/api/"
|
24
|
+
@exploitdb = ExploitDB.new(self)
|
23
25
|
end
|
24
26
|
|
25
27
|
# Internal method that sends out the HTTP request.
|
@@ -44,7 +46,6 @@ module Shodan
|
|
44
46
|
|
45
47
|
return data
|
46
48
|
end
|
47
|
-
private :request
|
48
49
|
|
49
50
|
# Get all available information on an IP.
|
50
51
|
#
|
@@ -67,4 +68,60 @@ module Shodan
|
|
67
68
|
end
|
68
69
|
end
|
69
70
|
|
71
|
+
# The ExploitDB class depends shouldn't be used independently,
|
72
|
+
# as it depends on the WebAPI class.
|
73
|
+
#
|
74
|
+
# Author:: achillean (mailto:jmath at surtri.com)
|
75
|
+
#
|
76
|
+
# :title:Shodan::ExploitDB
|
77
|
+
class ExploitDB
|
78
|
+
attr_accessor :api
|
79
|
+
|
80
|
+
def initialize(api)
|
81
|
+
@api = api
|
82
|
+
end
|
83
|
+
|
84
|
+
# Download the exploit code from the ExploitDB archive.
|
85
|
+
#
|
86
|
+
# Arguments:
|
87
|
+
# id -- ID of the ExploitDB entry
|
88
|
+
#
|
89
|
+
# Returns:
|
90
|
+
# A hash with the following fields:
|
91
|
+
# filename -- Name of the file
|
92
|
+
# content-type -- Mimetype
|
93
|
+
# data -- Contents of the file
|
94
|
+
def download(id)
|
95
|
+
return @api.request('exploitdb/download', {:id => "#{id}"})
|
96
|
+
end
|
97
|
+
|
98
|
+
# Search the ExploitDB archive.
|
99
|
+
#
|
100
|
+
# Arguments:
|
101
|
+
# query -- Search terms
|
102
|
+
#
|
103
|
+
# Optional arguments:
|
104
|
+
# author -- Name of the exploit submitter
|
105
|
+
# platform -- Target platform (e.g. windows, linux, hardware etc.)
|
106
|
+
# port -- Service port number
|
107
|
+
# type -- Any, dos, local, papers, remote, shellcode and webapps
|
108
|
+
#
|
109
|
+
# Returns:
|
110
|
+
# A dictionary with 2 main items: matches (list) and total (int).
|
111
|
+
# Each item in 'matches' is a dictionary with the following elements:
|
112
|
+
#
|
113
|
+
# id
|
114
|
+
# author
|
115
|
+
# date
|
116
|
+
# description
|
117
|
+
# platform
|
118
|
+
# port
|
119
|
+
# type
|
120
|
+
def search(query, params={})
|
121
|
+
params[:q] = query
|
122
|
+
return @api.request('exploitdb/search', params)
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
126
|
+
|
70
127
|
end
|
data/lib/shodan/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shodan
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 23
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- John Matherly
|
@@ -9,19 +15,25 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date: 2010-
|
18
|
+
date: 2010-11-02 00:00:00 -07:00
|
13
19
|
default_executable:
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
22
|
name: json
|
17
|
-
|
18
|
-
|
19
|
-
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
20
26
|
requirements:
|
21
27
|
- - ~>
|
22
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 11
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 4
|
33
|
+
- 6
|
23
34
|
version: 1.4.6
|
24
|
-
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
25
37
|
description: " A Ruby library to interact with the SHODAN API.\n"
|
26
38
|
email: jmath@surtri.com
|
27
39
|
executables: []
|
@@ -48,21 +60,27 @@ rdoc_options:
|
|
48
60
|
require_paths:
|
49
61
|
- lib
|
50
62
|
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
51
64
|
requirements:
|
52
65
|
- - ">="
|
53
66
|
- !ruby/object:Gem::Version
|
67
|
+
hash: 3
|
68
|
+
segments:
|
69
|
+
- 0
|
54
70
|
version: "0"
|
55
|
-
version:
|
56
71
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
57
73
|
requirements:
|
58
74
|
- - ">="
|
59
75
|
- !ruby/object:Gem::Version
|
76
|
+
hash: 3
|
77
|
+
segments:
|
78
|
+
- 0
|
60
79
|
version: "0"
|
61
|
-
version:
|
62
80
|
requirements: []
|
63
81
|
|
64
82
|
rubyforge_project:
|
65
|
-
rubygems_version: 1.3.
|
83
|
+
rubygems_version: 1.3.7
|
66
84
|
signing_key:
|
67
85
|
specification_version: 3
|
68
86
|
summary: A Ruby library to interact with the SHODAN API.
|