binaryedge 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +52 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +63 -0
- data/Rakefile +8 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/binaryedge.gemspec +33 -0
- data/lib/binaryedge.rb +25 -0
- data/lib/binaryedge/api.rb +44 -0
- data/lib/binaryedge/clients/actions/historical.rb +21 -0
- data/lib/binaryedge/clients/actions/ip.rb +20 -0
- data/lib/binaryedge/clients/actions/search.rb +28 -0
- data/lib/binaryedge/clients/actions/stats.rb +28 -0
- data/lib/binaryedge/clients/base.rb +108 -0
- data/lib/binaryedge/clients/data_leaks.rb +38 -0
- data/lib/binaryedge/clients/domains.rb +36 -0
- data/lib/binaryedge/clients/host.rb +12 -0
- data/lib/binaryedge/clients/image.rb +19 -0
- data/lib/binaryedge/clients/risk_score.rb +20 -0
- data/lib/binaryedge/clients/sensors.rb +16 -0
- data/lib/binaryedge/clients/torrent.rb +12 -0
- data/lib/binaryedge/clients/user.rb +11 -0
- data/lib/binaryedge/version.rb +5 -0
- metadata +153 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: fd0af7f87834f5f7d7894e3cb20ea7016e33cab9a33043f11fc3fc67c60f1650
|
4
|
+
data.tar.gz: 40006a067ec1ef470ea86b01faaaccca3b7e4fc5fd085231675044b92f00e74a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c544d60501f828cf835609286a2bbd987682552782e99fd9b143e7bc59649121142e439672ea450adb16c1189a30473b1af2cd826efe53489a0b00b51b9c3617
|
7
|
+
data.tar.gz: ab6aafe09646eb402115d3e0f1c967c3f928f077481ea3a1a3d8f4904820d3b585e16e1339e64fff2404afc338555e22845962915e9404cc27be17910065e2e9
|
data/.gitignore
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
## Specific to RubyMotion:
|
17
|
+
.dat*
|
18
|
+
.repl_history
|
19
|
+
build/
|
20
|
+
*.bridgesupport
|
21
|
+
build-iPhoneOS/
|
22
|
+
build-iPhoneSimulator/
|
23
|
+
|
24
|
+
## Specific to RubyMotion (use of CocoaPods):
|
25
|
+
#
|
26
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
27
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
28
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
29
|
+
#
|
30
|
+
# vendor/Pods/
|
31
|
+
|
32
|
+
## Documentation cache and generated files:
|
33
|
+
/.yardoc/
|
34
|
+
/_yardoc/
|
35
|
+
/doc/
|
36
|
+
/rdoc/
|
37
|
+
|
38
|
+
## Environment normalization:
|
39
|
+
/.bundle/
|
40
|
+
/vendor/bundle
|
41
|
+
/lib/bundler/man/
|
42
|
+
|
43
|
+
# for a library or gem, you might want to ignore these files since the code is
|
44
|
+
# intended to run in multiple environments; otherwise, check them in:
|
45
|
+
Gemfile.lock
|
46
|
+
.ruby-version
|
47
|
+
.ruby-gemset
|
48
|
+
|
49
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
50
|
+
.rvmrc
|
51
|
+
|
52
|
+
.rspec_status
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2019 Manabu Niseki
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
# BinaryEdge
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.com/ninoseki/binaryedge-rb.svg?branch=master)](https://travis-ci.com/ninoseki/binaryedge-rb)
|
4
|
+
[![Coverage Status](https://coveralls.io/repos/github/ninoseki/binaryedge-rb/badge.svg?branch=master)](https://coveralls.io/github/ninoseki/binaryedge-rb?branch=master)
|
5
|
+
[![CodeFactor](https://www.codefactor.io/repository/github/ninoseki/binaryedge-rb/badge)](https://www.codefactor.io/repository/github/ninoseki/binaryedge-rb)
|
6
|
+
|
7
|
+
[BinaryEdge](https://www.binaryedge.io/) API (v2) wrapper for Ruby.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
```bash
|
12
|
+
gem install binaryedge
|
13
|
+
```
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
# when given nothing, it tries to load your API key from ENV["BINARYEDGE_API_KEY"]
|
19
|
+
api = BinaryEdge::API.new
|
20
|
+
# or you can pass it manually
|
21
|
+
api = BinaryEdge::API.new("YOUR API KEY")
|
22
|
+
|
23
|
+
api.host.ip("1.1.1.1")
|
24
|
+
api.host.historical("1.1.1.1")
|
25
|
+
api.host.search("1.1.1.1")
|
26
|
+
api.host.stats("1.1.1.1", type: "ports", order: "desc")
|
27
|
+
|
28
|
+
# Image
|
29
|
+
api.image.ip("1.1.1.1")
|
30
|
+
api.image.search("1.1.1.1")
|
31
|
+
api.image.tags
|
32
|
+
|
33
|
+
# Risk score
|
34
|
+
api.risk_score.ip("1.1.1.1")
|
35
|
+
api.risk_score.cve("1.1.1.1")
|
36
|
+
|
37
|
+
# Sensors
|
38
|
+
api.sensors.ip("1.1.1.1"
|
39
|
+
api.sensors.search("1.1.1.1")
|
40
|
+
api.sensors.stats("1.1.1.1", type: "ports", order: "desc")
|
41
|
+
api.sensors.tag("MALICIOUS")
|
42
|
+
|
43
|
+
# Torrent
|
44
|
+
api.torrent.ip("139.162.190.235")
|
45
|
+
api.torrent.historical("1.1.1.1")
|
46
|
+
api.torrent.search("1.1.1.1")
|
47
|
+
api.torrent.stats("1.1.1.1", type: "ports", order: "desc")
|
48
|
+
|
49
|
+
# Domains
|
50
|
+
api.domains.ip("1.1.1.1")
|
51
|
+
api.domains.search("example.com")
|
52
|
+
api.domains.subdomain("example.com")
|
53
|
+
api.domains.dns("example.com")
|
54
|
+
|
55
|
+
# Data leaks
|
56
|
+
api.data_leaks.email("test@example.com")
|
57
|
+
api.data_leaks.organization("example.com")
|
58
|
+
api.data_leaks.info
|
59
|
+
```
|
60
|
+
|
61
|
+
## License
|
62
|
+
|
63
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "binaryedge"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/binaryedge.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require "binaryedge/version"
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = "binaryedge"
|
9
|
+
spec.version = BinaryEdge::VERSION
|
10
|
+
spec.authors = ["Manabu Niseki"]
|
11
|
+
spec.email = ["manabu.niseki@gmail.com"]
|
12
|
+
|
13
|
+
spec.summary = "BinaryEdge API wrapper for Ruby"
|
14
|
+
spec.description = "BinaryEdge API wrapper for Ruby"
|
15
|
+
spec.homepage = "https://github.com/ninoseki/binaryedge-rb"
|
16
|
+
spec.license = "MIT"
|
17
|
+
|
18
|
+
# Specify which files should be added to the gem when it is released.
|
19
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
20
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
21
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
|
+
end
|
23
|
+
spec.bindir = "exe"
|
24
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
|
+
spec.require_paths = ["lib"]
|
26
|
+
|
27
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
28
|
+
spec.add_development_dependency "coveralls", "~> 0.8"
|
29
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
30
|
+
spec.add_development_dependency "rspec", "~> 3.9"
|
31
|
+
spec.add_development_dependency "vcr", "~> 5.0"
|
32
|
+
spec.add_development_dependency "webmock", "~> 3.7"
|
33
|
+
end
|
data/lib/binaryedge.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "binaryedge/version"
|
4
|
+
|
5
|
+
require "binaryedge/clients/actions/ip"
|
6
|
+
require "binaryedge/clients/actions/historical"
|
7
|
+
require "binaryedge/clients/actions/search"
|
8
|
+
require "binaryedge/clients/actions/stats"
|
9
|
+
|
10
|
+
require "binaryedge/clients/base"
|
11
|
+
|
12
|
+
require "binaryedge/clients/data_leaks"
|
13
|
+
require "binaryedge/clients/domains"
|
14
|
+
require "binaryedge/clients/host"
|
15
|
+
require "binaryedge/clients/image"
|
16
|
+
require "binaryedge/clients/risk_score"
|
17
|
+
require "binaryedge/clients/sensors"
|
18
|
+
require "binaryedge/clients/torrent"
|
19
|
+
require "binaryedge/clients/user"
|
20
|
+
|
21
|
+
require "binaryedge/api"
|
22
|
+
|
23
|
+
module BinaryEdge
|
24
|
+
class Error < StandardError; end
|
25
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BinaryEdge
|
4
|
+
class API
|
5
|
+
attr_reader :api_key
|
6
|
+
|
7
|
+
def initialize(api_key = ENV["BINARYEDGE_API_KEY"])
|
8
|
+
@api_key = api_key
|
9
|
+
raise ArgumentError, "No API key has been found or provided!" unless api_key
|
10
|
+
end
|
11
|
+
|
12
|
+
def user
|
13
|
+
@user ||= Client::User.new(api_key)
|
14
|
+
end
|
15
|
+
|
16
|
+
def host
|
17
|
+
@host ||= Client::Host.new(api_key)
|
18
|
+
end
|
19
|
+
|
20
|
+
def image
|
21
|
+
@image ||= Client::Image.new(api_key)
|
22
|
+
end
|
23
|
+
|
24
|
+
def data_leaks
|
25
|
+
@data_leaks ||= Client::DataLeaks.new(api_key)
|
26
|
+
end
|
27
|
+
|
28
|
+
def torrent
|
29
|
+
@torrent ||= Client::Torrent.new(api_key)
|
30
|
+
end
|
31
|
+
|
32
|
+
def risk_score
|
33
|
+
@risk_score ||= Client::RiskScore.new(api_key)
|
34
|
+
end
|
35
|
+
|
36
|
+
def domains
|
37
|
+
@domains ||= Client::Domains.new(api_key)
|
38
|
+
end
|
39
|
+
|
40
|
+
def sensors
|
41
|
+
@sensors ||= Client::Sensors.new(api_key)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BinaryEdge
|
4
|
+
module Client
|
5
|
+
module Action
|
6
|
+
module Historical
|
7
|
+
#
|
8
|
+
# Details about an object, with data up to 6 months.
|
9
|
+
#
|
10
|
+
# @param [String] target target IP address
|
11
|
+
#
|
12
|
+
# @return [Hash]
|
13
|
+
#
|
14
|
+
def historical(target)
|
15
|
+
path = base_path == "query" ? "/query/ip/historical/#{target}" : "/#{base_path}/historical/#{target}"
|
16
|
+
_get(path) { |json| json }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BinaryEdge
|
4
|
+
module Client
|
5
|
+
module Action
|
6
|
+
module IP
|
7
|
+
#
|
8
|
+
# Details about an object
|
9
|
+
#
|
10
|
+
# @param [String] target target IP address or CIDR up to /24
|
11
|
+
#
|
12
|
+
# @return [Hash]
|
13
|
+
#
|
14
|
+
def ip(target)
|
15
|
+
_get("/#{base_path}/ip/#{target}") { |json| json }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BinaryEdge
|
4
|
+
module Client
|
5
|
+
module Action
|
6
|
+
module Search
|
7
|
+
#
|
8
|
+
# Events based on a Query.
|
9
|
+
#
|
10
|
+
# @param [String] query String used to query our data
|
11
|
+
# @param [Integer] page Default 1, Maximum: 500
|
12
|
+
# @param [Integer, nil] only_ips If selected, only output IP addresses, ports and protocols.
|
13
|
+
#
|
14
|
+
# @return [Hash]
|
15
|
+
#
|
16
|
+
def search(query, page: 1, only_ips: nil)
|
17
|
+
params = {
|
18
|
+
query: query,
|
19
|
+
page: page,
|
20
|
+
only_ips: only_ips
|
21
|
+
}.compact
|
22
|
+
|
23
|
+
_get("/#{base_path}/search", params) { |json| json }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BinaryEdge
|
4
|
+
module Client
|
5
|
+
module Action
|
6
|
+
module Stats
|
7
|
+
#
|
8
|
+
# Statistics of recent events for the given query.
|
9
|
+
#
|
10
|
+
# @param [String] query String used to query our data.
|
11
|
+
# @param [String] type Type of statistic we want to obtain.
|
12
|
+
# @param [String] order Whether to sort descendently or ascendently to get the top.
|
13
|
+
#
|
14
|
+
# @return [Array]
|
15
|
+
#
|
16
|
+
def stats(query, type:, order:)
|
17
|
+
params = {
|
18
|
+
query: query,
|
19
|
+
type: type,
|
20
|
+
order: order
|
21
|
+
}
|
22
|
+
|
23
|
+
_get("/#{base_path}/search/stats", params) { |json| json }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require "net/https"
|
5
|
+
require "uri"
|
6
|
+
|
7
|
+
module BinaryEdge
|
8
|
+
module Client
|
9
|
+
class Base
|
10
|
+
HOST = "api.binaryedge.io"
|
11
|
+
VERSION = "v2"
|
12
|
+
BASE_URL = "https://#{HOST}/#{VERSION}"
|
13
|
+
|
14
|
+
attr_reader :api_key
|
15
|
+
|
16
|
+
def initialize(api_key)
|
17
|
+
@api_key = api_key
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def url_for(path)
|
23
|
+
URI(BASE_URL + path)
|
24
|
+
end
|
25
|
+
|
26
|
+
def https_options
|
27
|
+
if proxy = ENV["HTTPS_PROXY"] || ENV["https_proxy"]
|
28
|
+
uri = URI(proxy)
|
29
|
+
{
|
30
|
+
proxy_address: uri.hostname,
|
31
|
+
proxy_port: uri.port,
|
32
|
+
proxy_from_env: false,
|
33
|
+
use_ssl: true
|
34
|
+
}
|
35
|
+
else
|
36
|
+
{ use_ssl: true }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def default_headers
|
41
|
+
{ "X-Key": api_key }
|
42
|
+
end
|
43
|
+
|
44
|
+
def make_request(req)
|
45
|
+
Net::HTTP.start(HOST, 443, https_options) do |http|
|
46
|
+
response = http.request(req)
|
47
|
+
|
48
|
+
code = response.code.to_i
|
49
|
+
body = response.body
|
50
|
+
json = JSON.parse(body)
|
51
|
+
|
52
|
+
case code
|
53
|
+
when 200
|
54
|
+
yield json
|
55
|
+
else
|
56
|
+
error = json.dig("message") || body
|
57
|
+
raise Error, "Unsupported response code returned: #{code} - #{error}"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def build_request(type: "GET", path:, params: {})
|
63
|
+
uri = url_for(path)
|
64
|
+
uri.query = URI.encode_www_form(params) if type == "GET"
|
65
|
+
|
66
|
+
request = case type
|
67
|
+
when "GET"
|
68
|
+
Net::HTTP::Get.new(uri, default_headers)
|
69
|
+
when "POST"
|
70
|
+
Net::HTTP::Post.new(uri, default_headers)
|
71
|
+
else
|
72
|
+
raise ArgumentError, "#{type} HTTP method is not supported"
|
73
|
+
end
|
74
|
+
|
75
|
+
request.body = JSON.generate(params) unless type == "GET"
|
76
|
+
request
|
77
|
+
end
|
78
|
+
|
79
|
+
def _get(path, params = {}, &block)
|
80
|
+
request = build_request(type: "GET", path: path, params: params)
|
81
|
+
make_request(request, &block)
|
82
|
+
end
|
83
|
+
|
84
|
+
def _post(path, params = {}, &block)
|
85
|
+
request = build_request(type: "POST", path: path, params: params)
|
86
|
+
make_request(request, &block)
|
87
|
+
end
|
88
|
+
|
89
|
+
CONVERT_TABLE = {
|
90
|
+
domains: "domains",
|
91
|
+
host: nil,
|
92
|
+
image: "image",
|
93
|
+
riskscore: "score",
|
94
|
+
sensors: "sensors",
|
95
|
+
torrent: "torrent",
|
96
|
+
}.freeze
|
97
|
+
|
98
|
+
def klass
|
99
|
+
self.class.to_s.split("::").last.to_s.downcase.to_sym
|
100
|
+
end
|
101
|
+
|
102
|
+
def base_path
|
103
|
+
name = CONVERT_TABLE.fetch(klass)
|
104
|
+
["query", name].compact.join("/")
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BinaryEdge
|
4
|
+
module Client
|
5
|
+
class DataLeaks < Base
|
6
|
+
#
|
7
|
+
# Verify how many dataleaks affected an specific email address.
|
8
|
+
#
|
9
|
+
# @param [String] email Verify which dataleaks affect the target email.
|
10
|
+
#
|
11
|
+
# @return [Hash]
|
12
|
+
#
|
13
|
+
def email(email)
|
14
|
+
_get("/query/dataleaks/email/#{email}") { |json| json }
|
15
|
+
end
|
16
|
+
|
17
|
+
#
|
18
|
+
# Verify how many emails are affected by dataleaks for a specific domain
|
19
|
+
#
|
20
|
+
# @param [String] domain Verify which dataleaks affect the target domain.
|
21
|
+
#
|
22
|
+
# @return [Hash]
|
23
|
+
#
|
24
|
+
def organization(domain)
|
25
|
+
_get("/query/dataleaks/organization/#{domain}") { |json| json }
|
26
|
+
end
|
27
|
+
|
28
|
+
#
|
29
|
+
# Get all available information about the dataleaks our platform keeps track.
|
30
|
+
#
|
31
|
+
# @return [Hash]
|
32
|
+
#
|
33
|
+
def info
|
34
|
+
_get("/query/dataleaks/info") { |json| json }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BinaryEdge
|
4
|
+
module Client
|
5
|
+
class Domains < Base
|
6
|
+
include Action::IP
|
7
|
+
include Action::Search
|
8
|
+
|
9
|
+
#
|
10
|
+
# Return list of subdomains known from the target domains
|
11
|
+
#
|
12
|
+
# @param [String] target Domain you want to get list of known subdomains.
|
13
|
+
# @param [Integer] page Default 1, Maximum: 500
|
14
|
+
#
|
15
|
+
# @return [Hash]
|
16
|
+
#
|
17
|
+
def subdomain(target, page: 1)
|
18
|
+
params = { page: page }
|
19
|
+
_get("/query/domains/subdomain/#{target}", params) { |json| json }
|
20
|
+
end
|
21
|
+
|
22
|
+
#
|
23
|
+
# Return list of known DNS results for the target domain.
|
24
|
+
#
|
25
|
+
# @param [String] Domain you want to get DNS related data.
|
26
|
+
# @param [Integer] page Default 1, Maximum: 500
|
27
|
+
#
|
28
|
+
# @return [Hash]
|
29
|
+
#
|
30
|
+
def dns(target, page: 1)
|
31
|
+
params = { page: page }
|
32
|
+
_get("/query/domains/dns/#{target}", params) { |json| json }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BinaryEdge
|
4
|
+
module Client
|
5
|
+
class Image < Base
|
6
|
+
include Action::IP
|
7
|
+
include Action::Search
|
8
|
+
|
9
|
+
#
|
10
|
+
# Get the list of possible tags for the images.
|
11
|
+
#
|
12
|
+
# @return [Array]
|
13
|
+
#
|
14
|
+
def tags
|
15
|
+
_get("/query/image/tags") { |json| json }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BinaryEdge
|
4
|
+
module Client
|
5
|
+
class RiskScore < Base
|
6
|
+
include Action::IP
|
7
|
+
|
8
|
+
#
|
9
|
+
# Get list of CVEs that migh affect a specific IP.
|
10
|
+
#
|
11
|
+
# @param [String] target target IP address
|
12
|
+
#
|
13
|
+
# @return [Hash]
|
14
|
+
#
|
15
|
+
def cve(target)
|
16
|
+
_get("/query/cve/ip/#{target}") { |json| json }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BinaryEdge
|
4
|
+
module Client
|
5
|
+
class Sensors < Base
|
6
|
+
include Action::IP
|
7
|
+
include Action::Search
|
8
|
+
include Action::Stats
|
9
|
+
|
10
|
+
def tag(target, days: 1)
|
11
|
+
params = { days: days }
|
12
|
+
_get("/query/sensors/tag/#{target}", params) { |json| json }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,153 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: binaryedge
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Manabu Niseki
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-10-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: coveralls
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.8'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.8'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '13.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '13.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.9'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.9'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: vcr
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '5.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '5.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: webmock
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.7'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.7'
|
97
|
+
description: BinaryEdge API wrapper for Ruby
|
98
|
+
email:
|
99
|
+
- manabu.niseki@gmail.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".rspec"
|
106
|
+
- ".travis.yml"
|
107
|
+
- Gemfile
|
108
|
+
- LICENSE
|
109
|
+
- README.md
|
110
|
+
- Rakefile
|
111
|
+
- bin/console
|
112
|
+
- bin/setup
|
113
|
+
- binaryedge.gemspec
|
114
|
+
- lib/binaryedge.rb
|
115
|
+
- lib/binaryedge/api.rb
|
116
|
+
- lib/binaryedge/clients/actions/historical.rb
|
117
|
+
- lib/binaryedge/clients/actions/ip.rb
|
118
|
+
- lib/binaryedge/clients/actions/search.rb
|
119
|
+
- lib/binaryedge/clients/actions/stats.rb
|
120
|
+
- lib/binaryedge/clients/base.rb
|
121
|
+
- lib/binaryedge/clients/data_leaks.rb
|
122
|
+
- lib/binaryedge/clients/domains.rb
|
123
|
+
- lib/binaryedge/clients/host.rb
|
124
|
+
- lib/binaryedge/clients/image.rb
|
125
|
+
- lib/binaryedge/clients/risk_score.rb
|
126
|
+
- lib/binaryedge/clients/sensors.rb
|
127
|
+
- lib/binaryedge/clients/torrent.rb
|
128
|
+
- lib/binaryedge/clients/user.rb
|
129
|
+
- lib/binaryedge/version.rb
|
130
|
+
homepage: https://github.com/ninoseki/binaryedge-rb
|
131
|
+
licenses:
|
132
|
+
- MIT
|
133
|
+
metadata: {}
|
134
|
+
post_install_message:
|
135
|
+
rdoc_options: []
|
136
|
+
require_paths:
|
137
|
+
- lib
|
138
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - ">="
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '0'
|
148
|
+
requirements: []
|
149
|
+
rubygems_version: 3.0.3
|
150
|
+
signing_key:
|
151
|
+
specification_version: 4
|
152
|
+
summary: BinaryEdge API wrapper for Ruby
|
153
|
+
test_files: []
|