interactsh 1.0.1 → 1.1.1
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 +4 -4
- data/lib/interactsh/client.rb +3 -3
- data/lib/interactsh/crypto.rb +1 -2
- data/lib/interactsh/errors.rb +10 -0
- data/lib/interactsh/http_client.rb +18 -10
- metadata +4 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a3ee25fb1a6699aef6beaf98ae940557eca0e91ef3779841bfefad64aaa6ccd
|
4
|
+
data.tar.gz: c2c36f8f6eb9cde02c076f6ef1dfd02d97fea6808482968edb07fb116371455f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc21f7b61862b64d4a985879c87d21ec3c8ba36630f407ab93d0547698d30e470d92b2a9a146953a37a89cc83f2841ee313b2f730819c1ecd3af737bd9e80ebb
|
7
|
+
data.tar.gz: 32df333b2e45a0f3d6b2351db5ff0064aa6d479404ced3306dc94be200fffcfe1c6482e910826d7a34867a6f2cabdbf02498832c12f0126119c63e5f5af3d1d4
|
data/lib/interactsh/client.rb
CHANGED
@@ -36,7 +36,8 @@ module Interactsh
|
|
36
36
|
# Polls the server for interaction data for a given host
|
37
37
|
#
|
38
38
|
# @param host [String] The host to poll data for
|
39
|
-
# @return [Array] Array of interaction data or empty array if
|
39
|
+
# @return [Array] Array of interaction data or empty array if no data found
|
40
|
+
# @raise [PollError] If polling fails
|
40
41
|
def poll(host)
|
41
42
|
correlation_id = host[0..19]
|
42
43
|
response = @http_client.make_poll_request(correlation_id, secret)
|
@@ -77,10 +78,9 @@ module Interactsh
|
|
77
78
|
}
|
78
79
|
|
79
80
|
response = @http_client.make_register_request(data)
|
80
|
-
|
81
81
|
return if response && response.code.to_i == 200
|
82
82
|
|
83
|
-
|
83
|
+
raise RegistrationError, "Problem with domain registration. Response code: #{response&.code}"
|
84
84
|
end
|
85
85
|
end
|
86
86
|
end
|
data/lib/interactsh/crypto.rb
CHANGED
@@ -16,8 +16,7 @@ module Interactsh
|
|
16
16
|
decrypted_aes_key = decrypt_aes_key(aes_key)
|
17
17
|
decrypt_payload(decrypted_aes_key, enc_data)
|
18
18
|
rescue StandardError => e
|
19
|
-
|
20
|
-
{}
|
19
|
+
raise DecryptionError, "Error decrypting data: #{e.message}"
|
21
20
|
end
|
22
21
|
|
23
22
|
private
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Interactsh
|
4
|
+
# Custom exceptions for Interactsh
|
5
|
+
class Error < StandardError; end
|
6
|
+
class RegistrationError < Error; end
|
7
|
+
class PollError < Error; end
|
8
|
+
class DecryptionError < Error; end
|
9
|
+
class HTTPRequestError < Error; end
|
10
|
+
end
|
@@ -22,8 +22,7 @@ module Interactsh
|
|
22
22
|
|
23
23
|
http.request(request)
|
24
24
|
rescue StandardError => e
|
25
|
-
|
26
|
-
nil
|
25
|
+
raise HTTPRequestError, "HTTP request error: #{e.message}"
|
27
26
|
end
|
28
27
|
|
29
28
|
# Makes the HTTP request to register a correlation ID
|
@@ -40,24 +39,31 @@ module Interactsh
|
|
40
39
|
|
41
40
|
http.request(request)
|
42
41
|
rescue StandardError => e
|
43
|
-
|
44
|
-
nil
|
42
|
+
raise HTTPRequestError, "HTTP request error: #{e.message}"
|
45
43
|
end
|
46
44
|
|
47
45
|
# Checks if the HTTP response was successful
|
48
46
|
#
|
49
47
|
# @param response [Net::HTTPResponse, nil] The HTTP response
|
50
|
-
# @return [Boolean] True if response is successful
|
48
|
+
# @return [Boolean] True if response is successful
|
49
|
+
# @raise [PollError] If response is not successful
|
51
50
|
def response_successful?(response)
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
end
|
56
|
-
true
|
51
|
+
return true if response&.code&.to_i == 200
|
52
|
+
|
53
|
+
handle_error_response(response)
|
57
54
|
end
|
58
55
|
|
59
56
|
private
|
60
57
|
|
58
|
+
def handle_error_response(response)
|
59
|
+
if response&.code&.to_i == 400 &&
|
60
|
+
response&.body&.include?('could not get interactions: could not get correlation-id from cache')
|
61
|
+
raise PollError, 'Correlation ID not found in cache'
|
62
|
+
end
|
63
|
+
|
64
|
+
raise PollError, "Problem with data recovery. Response code: #{response&.code}"
|
65
|
+
end
|
66
|
+
|
61
67
|
# Sets up an HTTP client
|
62
68
|
#
|
63
69
|
# @param uri [URI] The URI to connect to
|
@@ -65,6 +71,8 @@ module Interactsh
|
|
65
71
|
def setup_http_client(uri)
|
66
72
|
http = Net::HTTP.new(uri.host, uri.port)
|
67
73
|
http.use_ssl = (uri.scheme == 'https')
|
74
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
75
|
+
http.verify_hostname = false
|
68
76
|
http
|
69
77
|
end
|
70
78
|
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: interactsh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua MARTINELLE
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: jose
|
@@ -61,6 +60,7 @@ files:
|
|
61
60
|
- lib/interactsh.rb
|
62
61
|
- lib/interactsh/client.rb
|
63
62
|
- lib/interactsh/crypto.rb
|
63
|
+
- lib/interactsh/errors.rb
|
64
64
|
- lib/interactsh/http_client.rb
|
65
65
|
- lib/interactsh/utils.rb
|
66
66
|
homepage: https://github.com/JoshuaMart/Interactsh-Library
|
@@ -71,7 +71,6 @@ metadata:
|
|
71
71
|
homepage_uri: https://github.com/JoshuaMart/Interactsh-Library
|
72
72
|
github_repo: https://github.com/JoshuaMart/Interactsh-Library
|
73
73
|
rubygems_mfa_required: 'true'
|
74
|
-
post_install_message:
|
75
74
|
rdoc_options: []
|
76
75
|
require_paths:
|
77
76
|
- lib
|
@@ -86,8 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
85
|
- !ruby/object:Gem::Version
|
87
86
|
version: '0'
|
88
87
|
requirements: []
|
89
|
-
rubygems_version: 3.
|
90
|
-
signing_key:
|
88
|
+
rubygems_version: 3.6.9
|
91
89
|
specification_version: 4
|
92
90
|
summary: Interactsh Ruby Library
|
93
91
|
test_files: []
|