shodanz 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 48a791b83185c4a828cc55edfe28e5fb29580e968b4608d0e3e595032fc6c25f
4
- data.tar.gz: 24416f67e74472a918a59393b353a65a88e42c15cac113650ffa3bbc8458de61
3
+ metadata.gz: 27e38f509164ad306e776ee41ba0c51c89a356faa14509624db69afedecded7f
4
+ data.tar.gz: 71e6a66e3e5203dd03e8c5402698db4c3d48094d218227fc80f28f6466bdf3fa
5
5
  SHA512:
6
- metadata.gz: 040646faeb25075f1e6c76824825e35ea84fd22059857a0ec921117d23fe2ed2964ecfe23764ebb4068f597a52570f2a169136438406f2d852d91ecbf56924d8
7
- data.tar.gz: 3931188b212c414005f88dedad8b8a7467c080cfc4ef00b0e37947c41491e471c2aa560664dc2148dd26c75f2712a99e98a5941fa9ce1303f72e858dafb5a6e2
6
+ metadata.gz: 56811bcfb9af3c46b83d2cd871e78f5a93c74b5e21727b6a7e2b2551122193036695e8fbc1b01e3d89389b9d133de00db6721548b36795e0539dcab71fe644fb
7
+ data.tar.gz: bcbe2fe02bcf4aa59a248a607a19e82e9a6c7db3e6a0b14ab762caf0d523dd1923b623e448d14b4aa6561e7fba7e3b10d0055617fe0dd561b668f6fa37e2e1a2
data/README.md CHANGED
@@ -11,8 +11,9 @@ A modern Ruby [gem](https://rubygems.org/) for [Shodan](https://www.shodan.io/),
11
11
  ```ruby
12
12
  require "shodanz"
13
13
 
14
- client = Shodanz.client.new
14
+ client = Shodanz.client.new(key: "YOUR_API_KEY")
15
15
  ```
16
+ > You can also set the `SHODAN_API_KEY` environment variable instead of passing the API key as an argument when creating a client.
16
17
 
17
18
  ## REST API
18
19
 
@@ -13,10 +13,19 @@ module Shodanz
13
13
  attr_reader :exploits_api
14
14
 
15
15
  # Create a new client to connect to any of the APIs.
16
- def initialize
17
- @rest_api = Shodanz.api.rest.new
18
- @streaming_api = Shodanz.api.streaming.new
19
- @exploits_api = Shodanz.api.exploits.new
16
+ #
17
+ # Optionally provide your shodan API key, or the environment
18
+ # variable SHODAN_API_KEY will be used.
19
+ def initialize(key: ENV['SHODAN_API_KEY'])
20
+ raise "No API key has been found or provided! ( setup your SHODAN_API_KEY environment varialbe )" if key.nil?
21
+ # pass the given API key to each of the underlying clients
22
+ #
23
+ # Note: you can optionally change these API keys later, if you
24
+ # had multiple for whatever reason. ;)
25
+ #
26
+ @rest_api = Shodanz.api.rest.new(key: key)
27
+ @streaming_api = Shodanz.api.streaming.new(key: key)
28
+ @exploits_api = Shodanz.api.exploits.new(key: key)
20
29
  end
21
30
  end
22
31
  end
@@ -1,3 +1,3 @@
1
1
  module Shodanz
2
- VERSION = '1.0.4'.freeze
2
+ VERSION = '1.0.5'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shodanz
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kent 'picatz' Gruber
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-27 00:00:00.000000000 Z
11
+ date: 2018-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unirest