interactsh 1.1.0 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be1823e6db4ba229cc1446a22f0fdbd69b109ddc1a97035865c9f1a1abc384e3
4
- data.tar.gz: 73f0ccab711d6f7d351517115de875bd6873f193233439424b659c4a1e3c727b
3
+ metadata.gz: 5a3ee25fb1a6699aef6beaf98ae940557eca0e91ef3779841bfefad64aaa6ccd
4
+ data.tar.gz: c2c36f8f6eb9cde02c076f6ef1dfd02d97fea6808482968edb07fb116371455f
5
5
  SHA512:
6
- metadata.gz: 1303a5ed5de123cd48ae0ef00dc82e3fea3ccd297588de65da206dc5009200b33771eea198b19b0230cfc02215e425a0ea37bf0fbacf813582ce9cfb1d91d0c4
7
- data.tar.gz: 8498cfc4845fc23366e3083804a2f4d2bf72f6c54926c0f6c8333d3ea3666c182fc8c2fc1d49054df9e538db67ccd1ba16b1801ec15b21fd6b8bdef1799f26c8
6
+ metadata.gz: dc21f7b61862b64d4a985879c87d21ec3c8ba36630f407ab93d0547698d30e470d92b2a9a146953a37a89cc83f2841ee313b2f730819c1ecd3af737bd9e80ebb
7
+ data.tar.gz: 32df333b2e45a0f3d6b2351db5ff0064aa6d479404ced3306dc94be200fffcfe1c6482e910826d7a34867a6f2cabdbf02498832c12f0126119c63e5f5af3d1d4
@@ -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 polling failed
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)
@@ -45,17 +45,25 @@ module Interactsh
45
45
  # Checks if the HTTP response was successful
46
46
  #
47
47
  # @param response [Net::HTTPResponse, nil] The HTTP response
48
- # @return [Boolean] True if response is successful, false otherwise
48
+ # @return [Boolean] True if response is successful
49
+ # @raise [PollError] If response is not successful
49
50
  def response_successful?(response)
50
- if !response || response.code.to_i != 200
51
- raise PollError, "Problem with data recovery. Response code: #{response&.code}"
52
- end
51
+ return true if response&.code&.to_i == 200
53
52
 
54
- true
53
+ handle_error_response(response)
55
54
  end
56
55
 
57
56
  private
58
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
+
59
67
  # Sets up an HTTP client
60
68
  #
61
69
  # @param uri [URI] The URI to connect to
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.1.0
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: 2025-03-18 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: jose
@@ -72,7 +71,6 @@ metadata:
72
71
  homepage_uri: https://github.com/JoshuaMart/Interactsh-Library
73
72
  github_repo: https://github.com/JoshuaMart/Interactsh-Library
74
73
  rubygems_mfa_required: 'true'
75
- post_install_message:
76
74
  rdoc_options: []
77
75
  require_paths:
78
76
  - lib
@@ -87,8 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
85
  - !ruby/object:Gem::Version
88
86
  version: '0'
89
87
  requirements: []
90
- rubygems_version: 3.5.22
91
- signing_key:
88
+ rubygems_version: 3.6.9
92
89
  specification_version: 4
93
90
  summary: Interactsh Ruby Library
94
91
  test_files: []