onyphe 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.solargraph.yml +11 -0
- data/README.md +1 -0
- data/exe/onyphe +8 -0
- data/lib/onyphe/cli.rb +85 -0
- data/lib/onyphe/client.rb +1 -0
- data/lib/onyphe/clients/ctl.rb +2 -0
- data/lib/onyphe/clients/forward.rb +2 -0
- data/lib/onyphe/clients/geoloc.rb +2 -0
- data/lib/onyphe/clients/inetnum.rb +2 -0
- data/lib/onyphe/clients/ip.rb +2 -0
- data/lib/onyphe/clients/md5.rb +2 -0
- data/lib/onyphe/clients/onionscan.rb +2 -0
- data/lib/onyphe/clients/pastries.rb +2 -0
- data/lib/onyphe/clients/reverse.rb +2 -0
- data/lib/onyphe/clients/sniffer.rb +2 -0
- data/lib/onyphe/clients/synscan.rb +2 -0
- data/lib/onyphe/clients/threatlist.rb +2 -0
- data/lib/onyphe/validator.rb +33 -0
- data/lib/onyphe/version.rb +1 -1
- data/lib/onyphe.rb +4 -0
- data/onyphe.gemspec +1 -0
- metadata +22 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eedd7834c45c588f45486458d135dc85154dbc155a53c5a59fc03db87936468a
|
4
|
+
data.tar.gz: 11adb31384bbc4289c80c8485ea5fa3fba952fe7e5b017bfe9609a8cf4f72d77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9edbed09d396675da7511a869cb68d0f5a652ffcb9f02930ad8756662bb31b6b82284353026f732a6a96c47be979a3f2784c040dd046b7668258d9ecadc2ffc7
|
7
|
+
data.tar.gz: 47dd2abbd5a760def7bc340f4b974f61139c76fd0a2cd836ee5a06f8e36d6dfb7ac61d456a19669257525d827b335083fdcb6bab95e40a2c8c32409f0fa9fea3
|
data/.solargraph.yml
ADDED
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# Onyphe-rb
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/onyphe.svg)](https://badge.fury.io/rb/onyphe)
|
3
4
|
[![Build Status](https://travis-ci.org/ninoseki/onyphe-rb.svg?branch=master)](https://travis-ci.org/ninoseki/onyphe-rb)
|
4
5
|
[![Coverage Status](https://coveralls.io/repos/github/ninoseki/onyphe-rb/badge.svg?branch=master)](https://coveralls.io/github/ninoseki/onyphe-rb?branch=master)
|
5
6
|
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/c4afca9e0ff94d11a53332c0598b868f)](https://www.codacy.com/app/ninoseki/onyphe-rb)
|
data/exe/onyphe
ADDED
data/lib/onyphe/cli.rb
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require "thor"
|
5
|
+
|
6
|
+
module Onyphe
|
7
|
+
class CLI < Thor
|
8
|
+
desc "ctl DOMAIN", "It will return information for the given domain name X509 certificate information from CTLs with history of changes"
|
9
|
+
def ctl(domain)
|
10
|
+
with_error_handling { puts api.ctl(domain).to_h.to_json }
|
11
|
+
end
|
12
|
+
|
13
|
+
desc "datascan IP/STRING", "It will return datascan information for the given IPv{4,6} address or string with history of changes"
|
14
|
+
def datascan(query)
|
15
|
+
with_error_handling { puts api.datascan(query).to_h.to_json }
|
16
|
+
end
|
17
|
+
|
18
|
+
desc "forward IP", "It will return forward DNS lookup information for the given IPv{4,6} address with history of changes"
|
19
|
+
def forward(ip)
|
20
|
+
with_error_handling { puts api.forward(ip).to_h.to_json }
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "geoloc IP", "It will return geolocation information for the given IPv{4,6} address"
|
24
|
+
def geoloc(ip)
|
25
|
+
with_error_handling { puts api.geoloc(ip).to_h.to_json }
|
26
|
+
end
|
27
|
+
|
28
|
+
desc "inetnum IP", "It will return inetnum information for the given IPv{4,6} address with history of changes"
|
29
|
+
def inetnum(ip)
|
30
|
+
with_error_handling { puts api.inetnum(ip).to_h.to_json }
|
31
|
+
end
|
32
|
+
|
33
|
+
desc "ip IP", "It will return a summary of all information for the given IPv{4,6} address"
|
34
|
+
def ip(ip)
|
35
|
+
with_error_handling { puts api.ip(ip).to_h.to_json }
|
36
|
+
end
|
37
|
+
|
38
|
+
desc "md5 MD5", "It will return information for the given datamd5 filter from datascan information category with history of changes"
|
39
|
+
def md5(md5)
|
40
|
+
with_error_handling { puts api.md5(md5).to_h.to_json }
|
41
|
+
end
|
42
|
+
|
43
|
+
desc "onionscan ONION", "It will return information for the given onion domain with history of changes"
|
44
|
+
def onionscan(onion)
|
45
|
+
with_error_handling { puts api.onionscan(onion).to_h.to_json }
|
46
|
+
end
|
47
|
+
|
48
|
+
desc "pastries IP", "It will return pastries information for the given IPv{4,6} address with history of changes"
|
49
|
+
def pastries(ip)
|
50
|
+
with_error_handling { puts api.pastries(ip).to_h.to_json }
|
51
|
+
end
|
52
|
+
|
53
|
+
desc "reverse IP", "It will return reverse DNS lookup information for the given IPv{4,6} address with history of changes"
|
54
|
+
def reverse(ip)
|
55
|
+
with_error_handling { puts api.reverse(ip).to_h.to_json }
|
56
|
+
end
|
57
|
+
|
58
|
+
desc "sniffer IP", "It will return information for the given IP address with history of changes"
|
59
|
+
def sniffer(ip)
|
60
|
+
with_error_handling { puts api.sniffer(ip).to_h.to_json }
|
61
|
+
end
|
62
|
+
|
63
|
+
desc "synscan IP", "It will return synscan information for the given IPv{4,6} address with history of changes."
|
64
|
+
def synscan(ip)
|
65
|
+
with_error_handling { puts api.synscan(ip).to_h.to_json }
|
66
|
+
end
|
67
|
+
|
68
|
+
desc "threattlist IP", "It will return threatlist information for the given IPv{4,6} address with history of change"
|
69
|
+
def threatlist(ip)
|
70
|
+
with_error_handling { puts api.threatlist(ip).to_h.to_json }
|
71
|
+
end
|
72
|
+
|
73
|
+
no_commands do
|
74
|
+
def with_error_handling
|
75
|
+
yield
|
76
|
+
rescue StandardError => e
|
77
|
+
puts "Warning: #{e}"
|
78
|
+
end
|
79
|
+
|
80
|
+
def api
|
81
|
+
@api ||= API.new
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
data/lib/onyphe/client.rb
CHANGED
data/lib/onyphe/clients/ctl.rb
CHANGED
data/lib/onyphe/clients/ip.rb
CHANGED
data/lib/onyphe/clients/md5.rb
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "ipaddr"
|
4
|
+
require "uri"
|
5
|
+
|
6
|
+
module Onyphe
|
7
|
+
class Validator
|
8
|
+
def self.valid_ip?(ip)
|
9
|
+
IPAddr.new ip
|
10
|
+
true
|
11
|
+
rescue IPAddr::InvalidAddressError => _
|
12
|
+
false
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.valid_domain?(domain)
|
16
|
+
uri = URI("https://#{domain}")
|
17
|
+
uri.hostname == domain && domain.include?(".") && !valid_ip?(domain)
|
18
|
+
rescue ArgumentError => _
|
19
|
+
false
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.valid_onion_domain?(domain)
|
23
|
+
uri = URI("https://#{domain}")
|
24
|
+
uri.hostname == domain && domain.end_with?(".onion")
|
25
|
+
rescue ArgumentError => _
|
26
|
+
false
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.valid_md5?(md5)
|
30
|
+
md5.to_s.match?(/^[a-f0-9]{32}$/)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/onyphe/version.rb
CHANGED
data/lib/onyphe.rb
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
require "onyphe/response"
|
4
4
|
require "onyphe/api"
|
5
5
|
|
6
|
+
require "onyphe/validator"
|
7
|
+
|
6
8
|
require "onyphe/client"
|
7
9
|
require "onyphe/clients/ctl"
|
8
10
|
require "onyphe/clients/datascan"
|
@@ -19,6 +21,8 @@ require "onyphe/clients/synscan"
|
|
19
21
|
require "onyphe/clients/threatlist"
|
20
22
|
require "onyphe/clients/search"
|
21
23
|
|
24
|
+
require "onyphe/cli"
|
25
|
+
|
22
26
|
require "onyphe/version"
|
23
27
|
|
24
28
|
module Onyphe
|
data/onyphe.gemspec
CHANGED
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.require_paths = ["lib"]
|
26
26
|
|
27
27
|
spec.add_dependency "addressable", "~> 2.5"
|
28
|
+
spec.add_dependency "thor", "~> 0.19"
|
28
29
|
|
29
30
|
spec.add_development_dependency "bundler", "~> 1.17"
|
30
31
|
spec.add_development_dependency "coveralls", "~> 0.8"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onyphe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manabu Niseki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: thor
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.19'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.19'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -125,12 +139,14 @@ dependencies:
|
|
125
139
|
description: ONYPHE API wrapper for Ruby
|
126
140
|
email:
|
127
141
|
- manabu.niseki@gmail.com
|
128
|
-
executables:
|
142
|
+
executables:
|
143
|
+
- onyphe
|
129
144
|
extensions: []
|
130
145
|
extra_rdoc_files: []
|
131
146
|
files:
|
132
147
|
- ".gitignore"
|
133
148
|
- ".rspec"
|
149
|
+
- ".solargraph.yml"
|
134
150
|
- ".travis.yml"
|
135
151
|
- Gemfile
|
136
152
|
- LICENSE
|
@@ -138,8 +154,10 @@ files:
|
|
138
154
|
- Rakefile
|
139
155
|
- bin/console
|
140
156
|
- bin/setup
|
157
|
+
- exe/onyphe
|
141
158
|
- lib/onyphe.rb
|
142
159
|
- lib/onyphe/api.rb
|
160
|
+
- lib/onyphe/cli.rb
|
143
161
|
- lib/onyphe/client.rb
|
144
162
|
- lib/onyphe/clients/ctl.rb
|
145
163
|
- lib/onyphe/clients/datascan.rb
|
@@ -156,6 +174,7 @@ files:
|
|
156
174
|
- lib/onyphe/clients/synscan.rb
|
157
175
|
- lib/onyphe/clients/threatlist.rb
|
158
176
|
- lib/onyphe/response.rb
|
177
|
+
- lib/onyphe/validator.rb
|
159
178
|
- lib/onyphe/version.rb
|
160
179
|
- onyphe.gemspec
|
161
180
|
homepage: https://github.com/ninoseki/onyphe-rb
|