shodanz 2.0.7 → 2.0.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3d92deb0585fd18e242bad0340ea6234d7660c8a2f39476f1fd38dbbf600b12f
4
- data.tar.gz: 6d6527de39e62bb02fd31121f4f18267581ebe766ffb38a8298c828ac55e4e42
3
+ metadata.gz: fce5bf7504f3db8b8457bc02bde8637ab2a2cf0ec7a39f69eba84655f11cdd59
4
+ data.tar.gz: 5afc67f0229d50dfbd0fa0b491595e3c104e068ffdcd994c54b3f11c08ec75a3
5
5
  SHA512:
6
- metadata.gz: b99faadc4515a125fc64d001a79c7e6f0147b0e184a2cdf4b885d60eccb40783285be2ae16fb765b36ffce1df4bebc319435fec7432eb2a4993d7e65900edc6a
7
- data.tar.gz: 23159690e115ea13f7e4013f9a0d2afd72d28da59830e6e675fb0c525907a2384d13fca71aac768eceaa706d33b29c810052c78ee8c4c2abbc20c8cfcb1bd978
6
+ metadata.gz: 7e5db70e545fc72c0c3f31345cfdcaef3557440fc315a2bc04e5eb48a34cd548b7ad9b728d6f7024293b851fd2053ec7cf33d76ecb09f885e240ab65beb3a6a7
7
+ data.tar.gz: 82be13e3b3cc62d3f406b10fff566d6e7596065d041c93efb8542a52d202267ed75673a200c6883bb5686779c978bcb89bd372b1aea19cc80d18de3a17402a1f
@@ -108,7 +108,7 @@ module Shodanz
108
108
  #
109
109
  # IP, IPs or netblocks (in CIDR notation) that should get crawled.
110
110
  def scan(*ips)
111
- post('shodan/scan', ips: ips.join(','))
111
+ post('shodan/scan', body: {ips: ips.join(',')})
112
112
  end
113
113
 
114
114
  # Use this method to request Shodan to crawl the Internet for a specific port.
@@ -107,20 +107,25 @@ module Shodanz
107
107
  resp&.close
108
108
  end
109
109
 
110
- def poster(path, one_shot: false, params: nil, body: nil)
110
+ def poster(path, params: nil, body: nil)
111
111
  # param keys should all be strings
112
112
  params = params.transform_keys(&:to_s)
113
113
  # and the key param is constant
114
114
  params["key"] = @key
115
115
  # encode as a URL string
116
116
  params = URI.encode_www_form(params)
117
- # optional JSON body string
118
- json_body = body.nil? ? nil : JSON.dump(body)
119
117
  # build URL path
120
- path = "/#{path}?#{params}"
118
+ path = "/#{path}?#{params}"
119
+
120
+ headers = nil
121
+
122
+ if body
123
+ body = URI.encode_www_form(body)
124
+ headers = [['Content-Type', 'application/x-www-form-urlencoded']]
125
+ end
121
126
 
122
127
  # make POST request to server
123
- resp = @client.post(path, nil, json_body)
128
+ resp = @client.post(path, headers, body)
124
129
 
125
130
  if resp.success?
126
131
  json = JSON.parse(resp.body.join)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Shodanz
4
- VERSION = '2.0.7'
4
+ VERSION = '2.0.8'
5
5
  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: 2.0.7
4
+ version: 2.0.8
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: 2023-11-05 00:00:00.000000000 Z
11
+ date: 2023-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async-http