passivetotal 1.0.2 → 1.0.3

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
  SHA1:
3
- metadata.gz: 85bce6ee916bb8a5e96cc67480e16d83c66f0cca
4
- data.tar.gz: ebd30157e8c383b021470901978b00409555c181
3
+ metadata.gz: d3c95b2a176f2d2169468d5588f6b966ab8138e1
4
+ data.tar.gz: a40c315a92542733ab1e181ac875fb85f2a03893
5
5
  SHA512:
6
- metadata.gz: d471517e4c76f369bae5db3a817ff6fd186da54bc579dbda3d6e0b468d66bea6316e827d794e7782ecda1138c4fa733e655e8e6f9ca4d6d774f3155053e1fcb3
7
- data.tar.gz: c2dfa0a1e729101bc703ad7bbe7ae9586041a2fcbf2945bf54e8d2e9125adfd6e089ee8b4ff735d61542e03acb815f265fae15de32416f8cbcac78643dd45c4a
6
+ metadata.gz: 76a3fd0c35b524a726cc57f3cb0f50feb852b1bf7bac01a02f52cccd4475063145fa1ee9d5554046abbd96eab075234545ba5f19baf346c6a30341cefb2a67af
7
+ data.tar.gz: 4058e27c7a5ffec725fc5d496983e34ceae7d143ac46250d4fe0f704cb161766f903fe4b625d85ea4bb91386aa0b3a372f7ece8cd6f8c233431bc6782fc6bd1a
@@ -176,7 +176,7 @@ module PassiveTotal # :nodoc:
176
176
  def classification(query, set=nil)
177
177
  is_valid_with_error(__method__, [:ipv4, :domain], query)
178
178
  if domain?(query)
179
- query = normalize_domain(query)
179
+ query = normalize_domain(q)
180
180
  end
181
181
  if set.nil?
182
182
  get('actions/classification', {'query' => query})
@@ -186,6 +186,22 @@ module PassiveTotal # :nodoc:
186
186
  end
187
187
  end
188
188
 
189
+ # Get the classification for a query in bulk
190
+ # query: An array of domains or IP address to query
191
+ def bulk_classification(query)
192
+ if query.class != Array
193
+ query = [query]
194
+ end
195
+ query.map do |q|
196
+ is_valid_with_error(__method__, [:ipv4, :domain], q)
197
+ if domain?(q)
198
+ q = normalize_domain(q)
199
+ end
200
+ q
201
+ end
202
+ get_with_data('actions/bulk/classification', { 'query' => query })
203
+ end
204
+
189
205
  # PassiveTotal allows users to notate if a domain or IP address have ever been compromised. These values aid in letting users know that a site may be benign, but it was used in an attack at some point in time.
190
206
  # PassiveTotal::API#ever_compromised() queries if only one argument is given, and sets if both are given
191
207
  # query: A domain or IP address to query
@@ -421,6 +437,10 @@ module PassiveTotal # :nodoc:
421
437
  url2json(:GET, "#{@endpoint}#{api}", params)
422
438
  end
423
439
 
440
+ def get_with_data(api, params={})
441
+ url2json(:GET_DATA, "#{@endpoint}#{api}", params)
442
+ end
443
+
424
444
  # helper function to perform an HTTP POST against the web API
425
445
  def post(api, params)
426
446
  url2json(:POST, "#{@endpoint}#{api}", params)
@@ -444,6 +464,11 @@ module PassiveTotal # :nodoc:
444
464
  request = nil
445
465
  if method == :GET
446
466
  request = Net::HTTP::Get.new(url.request_uri)
467
+ elsif method == :GET_DATA
468
+ request = Net::HTTP::Get.new(url.request_uri)
469
+ form_data = params.to_json
470
+ request.content_type = 'application/json'
471
+ request.body = form_data
447
472
  elsif method == :POST
448
473
  request = Net::HTTP::Post.new(url.request_uri)
449
474
  form_data = params.to_json
@@ -1,3 +1,3 @@
1
1
  module PassiveTotal
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: passivetotal
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - chrislee35
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-20 00:00:00.000000000 Z
11
+ date: 2016-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json