Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Migrated off of Hoe and to Jeweler, for building/releasing shodan-ruby.

* Switched to Markdown formatted YARD docs.
  • Loading branch information...
commit e611aa54b4d4460d88d0ac37a6405f6fef89df86 1 parent 6a6cd92
Postmodern authored
1  .specopts
View
@@ -0,0 +1 @@
+--colour --format specdoc
1  .yardopts
View
@@ -0,0 +1 @@
+--markup markdown --title 'SHODAN Ruby Documentation' --protected --files ChangeLog.md,COPYING.txt
13 ChangeLog.md
View
@@ -0,0 +1,13 @@
+### 0.1.1 / 2009-12-04
+
+* Forgot to include 'lib/shodan/countries.rb' into the Manifest.txt file.
+
+### 0.1.0 / 2009-12-03
+
+* Initial release.
+ * Supports basic queries.
+ * Supports `country` search operator.
+ * Supports `hostname` search operator.
+ * Supports `net` search operator.
+ * Supports `port` search operator.
+
13 History.txt
View
@@ -1,13 +0,0 @@
-=== 0.1.1 / 2009-12-04
-
-* Forgot to include 'lib/shodan/countries.rb' into the Manifest.txt file.
-
-=== 0.1.0 / 2009-12-03
-
-* Initial release.
- * Supports basic queries.
- * Supports +country+ search operator.
- * Supports +hostname+ search operator.
- * Supports +net+ search operator.
- * Supports +port+ search operator.
-
26 Manifest.txt
View
@@ -1,26 +0,0 @@
-COPYING.txt
-History.txt
-Manifest.txt
-README.txt
-Rakefile
-lib/shodan.rb
-lib/shodan/extensions.rb
-lib/shodan/extensions/uri.rb
-lib/shodan/extensions/uri/query_params.rb
-lib/shodan/extensions/uri/http.rb
-lib/shodan/countries.rb
-lib/shodan/host.rb
-lib/shodan/page.rb
-lib/shodan/has_pages.rb
-lib/shodan/query.rb
-lib/shodan/shodan.rb
-lib/shodan/version.rb
-tasks/spec.rb
-tasks/yard.rb
-spec/spec_helper.rb
-spec/host_spec.rb
-spec/page_spec.rb
-spec/page_has_hosts_examples.rb
-spec/has_pages_examples.rb
-spec/query_spec.rb
-spec/shodan_spec.rb
51 README.txt → README.md
View
@@ -1,46 +1,47 @@
-= shodan-ruby
+# shodan-ruby
-* http://github.com/postmodern/shodan-ruby
-* http://shodan-ruby.rubyforge.org/
-* http://shodan.surtri.com/
+* [shodan-ruby.rubyforge.org](http://shodan-ruby.rubyforge.org/)
+* [github.com/postmodern/shodan-ruby](http://github.com/postmodern/shodan-ruby)
+* [github.com/postmodern/shodan-ruby/issues](http://github.com/postmodern/shodan-ruby/issues)
+* [shodan.surtri.com](http://shodan.surtri.com/)
-== DESCRIPTION:
+## DESCRIPTION:
A Ruby interface to SHODAN, a computer search engine.
-== FEATURES/PROBLEMS:
+## FEATURES/PROBLEMS:
* Supports basic queries.
-* Supports +country+ search operator.
-* Supports +hostname+ search operator.
-* Supports +net+ search operator.
-* Supports +port+ search operator.
+* Supports `country` search operator.
+* Supports `hostname` search operator.
+* Supports `net` search operator.
+* Supports `port` search operator.
* SHODAN does not support queries with non-alphanumeric characters within
them.
-== EXAMPLES:
+## EXAMPLES:
-* Basic query:
+Basic query:
require 'shodan'
q = Shodan.query(:query => 'ssh')
-* Advanced query:
+Advanced query:
q = Shodan.query(:query => 'login') do |q|
q.ports += [21, 23, 80, 25]
q.networks << '112.0.0.0/8'
end
-* Queries from URLs:
+Queries from URLs:
q = Shodan::Query.from_url('http://shodan.surtri.com/?q=login+port%3A21+port%3A23')
q.query
# => "login port:21 port:23"
-* Getting the search results:
+Getting the search results:
q.first_page.select do |host|
host.response =~ /HTTP\1.[01] 200/
@@ -54,7 +55,7 @@ A Ruby interface to SHODAN, a computer search engine.
q.first_host
-* Iterating over the hosts on a page:
+Iterating over the hosts on a page:
q.each_on_page(2) do |host|
puts host.ip
@@ -64,9 +65,9 @@ A Ruby interface to SHODAN, a computer search engine.
puts "#{host.date} #{host.ip}"
end
-* A Host object contains the IP address, Date added, Hostname, Response
- recorded and parsed HTTP version, HTTP code, HTTP status
- and HTTP headers.
+A Host object contains the IP address, Date added, Hostname, Response
+recorded and parsed HTTP version, HTTP code, HTTP status
+and HTTP headers.
page = q.page(2)
@@ -89,7 +90,7 @@ A Ruby interface to SHODAN, a computer search engine.
end
end
-* Select specific hosts from a page:
+Select specific hosts from a page:
page.hosts_with_ip(/\.1$/)
# => [...]
@@ -100,15 +101,15 @@ A Ruby interface to SHODAN, a computer search engine.
page.responses_with("Server")
# => [...]
-== REQUIREMENTS:
+## REQUIREMENTS:
-* {mechanize}[http://mechanize.rubyforge.org] >= 0.9.3
+* [mechanize](http://mechanize.rubyforge.org) >= 0.9.3
-== INSTALL:
+## INSTALL:
- $ sudo gem install shodan-ruby
+ $ sudo gem install shodan-ruby
-== LICENSE:
+## LICENSE:
shodan-ruby - A Ruby interface to SHODAN, a computer search engine.
56 Rakefile
View
@@ -1,26 +1,42 @@
-# -*- ruby -*-
-
require 'rubygems'
-require 'hoe'
-require 'hoe/signing'
-require './tasks/spec.rb'
-require './tasks/yard.rb'
+require 'rake'
+require './lib/shodan/version.rb'
-Hoe.spec('shodan-ruby') do
- self.rubyforge_name = 'shodan-ruby'
- self.developer('Postmodern', 'postmodern.mod3@gmail.com')
- self.remote_rdoc_dir = '/'
+begin
+ require 'jeweler'
+ Jeweler::Tasks.new do |gem|
+ gem.name = 'shodan'
+ gem.version = Shodan::VERSION
+ gem.summary = %Q{A Ruby interface to SHODAN, a computer search engine.}
+ gem.description = %Q{A Ruby interface to SHODAN, a computer search engine.}
+ gem.email = 'postmodern.mod3@gmail.com'
+ gem.homepage = 'http://github.com/postmodern/shodan-ruby'
+ gem.authors = ['Postmodern']
+ gem.add_dependency 'mechanize', '>= 0.9.3'
+ gem.add_development_dependency 'rspec', '>= 1.3.0'
+ gem.add_development_dependency 'yard', '>= 0.5.3'
+ gem.has_rdoc = 'yard'
+ end
+rescue LoadError
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
+end
- self.extra_deps = [
- ['mechanize', '>=0.9.3']
- ]
+require 'spec/rake/spectask'
+Spec::Rake::SpecTask.new(:spec) do |spec|
+ spec.libs += ['lib', 'spec']
+ spec.spec_files = FileList['spec/**/*_spec.rb']
+ spec.spec_opts = ['--options', '.specopts']
+end
- self.extra_dev_deps = [
- ['rspec', '>=1.2.8'],
- ['yard', '>=0.4.0']
- ]
+task :spec => :check_dependencies
+task :default => :spec
- self.spec_extras = {:has_rdoc => 'yard'}
-end
+begin
+ require 'yard'
-# vim: syntax=ruby
+ YARD::Rake::YardocTask.new
+rescue LoadError
+ task :yard do
+ abort "YARD is not available. In order to run yard, you must: gem install yard"
+ end
+end
2  lib/shodan/host.rb
View
@@ -130,7 +130,7 @@ def server_version
protected
#
- # Provides transparent access to the values in +headers+.
+ # Provides transparent access to the values in `headers`.
#
def method_missing(sym,*args,&block)
if (args.empty? && block.nil?)
82 shodan.gemspec
View
@@ -0,0 +1,82 @@
+# Generated by jeweler
+# DO NOT EDIT THIS FILE DIRECTLY
+# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
+# -*- encoding: utf-8 -*-
+
+Gem::Specification.new do |s|
+ s.name = %q{shodan}
+ s.version = "0.1.1"
+
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+ s.authors = ["Postmodern"]
+ s.date = %q{2010-02-11}
+ s.description = %q{A Ruby interface to SHODAN, a computer search engine.}
+ s.email = %q{postmodern.mod3@gmail.com}
+ s.extra_rdoc_files = [
+ "ChangeLog.md",
+ "README.md"
+ ]
+ s.files = [
+ ".gitignore",
+ ".specopts",
+ ".yardopts",
+ "COPYING.txt",
+ "ChangeLog.md",
+ "README.md",
+ "Rakefile",
+ "lib/shodan.rb",
+ "lib/shodan/countries.rb",
+ "lib/shodan/extensions.rb",
+ "lib/shodan/extensions/uri.rb",
+ "lib/shodan/extensions/uri/http.rb",
+ "lib/shodan/extensions/uri/query_params.rb",
+ "lib/shodan/has_pages.rb",
+ "lib/shodan/host.rb",
+ "lib/shodan/page.rb",
+ "lib/shodan/query.rb",
+ "lib/shodan/shodan.rb",
+ "lib/shodan/version.rb",
+ "spec/has_pages_examples.rb",
+ "spec/host_spec.rb",
+ "spec/page_has_hosts_examples.rb",
+ "spec/page_spec.rb",
+ "spec/query_spec.rb",
+ "spec/shodan_spec.rb",
+ "spec/spec_helper.rb"
+ ]
+ s.has_rdoc = %q{yard}
+ s.homepage = %q{http://github.com/postmodern/shodan-ruby}
+ s.rdoc_options = ["--charset=UTF-8"]
+ s.require_paths = ["lib"]
+ s.rubygems_version = %q{1.3.5}
+ s.summary = %q{A Ruby interface to SHODAN, a computer search engine.}
+ s.test_files = [
+ "spec/spec_helper.rb",
+ "spec/shodan_spec.rb",
+ "spec/has_pages_examples.rb",
+ "spec/query_spec.rb",
+ "spec/page_spec.rb",
+ "spec/page_has_hosts_examples.rb",
+ "spec/host_spec.rb"
+ ]
+
+ if s.respond_to? :specification_version then
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
+ s.specification_version = 3
+
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
+ s.add_runtime_dependency(%q<mechanize>, [">= 0.9.3"])
+ s.add_development_dependency(%q<rspec>, [">= 1.3.0"])
+ s.add_development_dependency(%q<yard>, [">= 0.5.3"])
+ else
+ s.add_dependency(%q<mechanize>, [">= 0.9.3"])
+ s.add_dependency(%q<rspec>, [">= 1.3.0"])
+ s.add_dependency(%q<yard>, [">= 0.5.3"])
+ end
+ else
+ s.add_dependency(%q<mechanize>, [">= 0.9.3"])
+ s.add_dependency(%q<rspec>, [">= 1.3.0"])
+ s.add_dependency(%q<yard>, [">= 0.5.3"])
+ end
+end
+
10 tasks/spec.rb
View
@@ -1,10 +0,0 @@
-require 'spec/rake/spectask'
-
-desc "Run all specifications"
-Spec::Rake::SpecTask.new(:spec) do |t|
- t.libs += ['lib', 'spec']
- t.spec_opts = ['--colour', '--format', 'specdoc']
-end
-
-task :test => :spec
-task :default => :spec
13 tasks/yard.rb
View
@@ -1,13 +0,0 @@
-require 'yard'
-
-YARD::Rake::YardocTask.new do |t|
- t.files = ['lib/**/*.rb']
- t.options = [
- '--protected',
- '--files', 'History.txt',
- '--title', 'SHODAN Ruby',
- '--quiet'
- ]
-end
-
-task :docs => :yard
Please sign in to comment.
Something went wrong with that request. Please try again.