ethon-impersonate 0.17.2-aarch64-darwin
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 +7 -0
- data/CHANGELOG.md +379 -0
- data/LICENSE +20 -0
- data/README.md +116 -0
- data/config/puma.rb +1 -0
- data/ethon-impersonate.gemspec +28 -0
- data/ext/libcurl-impersonate.4.dylib +0 -0
- data/lib/ethon/impersonate.rb +9 -0
- data/lib/ethon-impersonate.rb +1 -0
- data/lib/ethon_impersonate/curl.rb +90 -0
- data/lib/ethon_impersonate/curls/classes.rb +65 -0
- data/lib/ethon_impersonate/curls/codes.rb +122 -0
- data/lib/ethon_impersonate/curls/constants.rb +81 -0
- data/lib/ethon_impersonate/curls/form_options.rb +37 -0
- data/lib/ethon_impersonate/curls/functions.rb +59 -0
- data/lib/ethon_impersonate/curls/infos.rb +151 -0
- data/lib/ethon_impersonate/curls/messages.rb +19 -0
- data/lib/ethon_impersonate/curls/options.rb +503 -0
- data/lib/ethon_impersonate/curls/settings.rb +19 -0
- data/lib/ethon_impersonate/easy/callbacks.rb +149 -0
- data/lib/ethon_impersonate/easy/debug_info.rb +49 -0
- data/lib/ethon_impersonate/easy/features.rb +31 -0
- data/lib/ethon_impersonate/easy/form.rb +107 -0
- data/lib/ethon_impersonate/easy/header.rb +61 -0
- data/lib/ethon_impersonate/easy/http/actionable.rb +157 -0
- data/lib/ethon_impersonate/easy/http/custom.rb +29 -0
- data/lib/ethon_impersonate/easy/http/delete.rb +25 -0
- data/lib/ethon_impersonate/easy/http/get.rb +24 -0
- data/lib/ethon_impersonate/easy/http/head.rb +24 -0
- data/lib/ethon_impersonate/easy/http/options.rb +24 -0
- data/lib/ethon_impersonate/easy/http/patch.rb +24 -0
- data/lib/ethon_impersonate/easy/http/post.rb +26 -0
- data/lib/ethon_impersonate/easy/http/postable.rb +32 -0
- data/lib/ethon_impersonate/easy/http/put.rb +27 -0
- data/lib/ethon_impersonate/easy/http/putable.rb +25 -0
- data/lib/ethon_impersonate/easy/http.rb +68 -0
- data/lib/ethon_impersonate/easy/informations.rb +118 -0
- data/lib/ethon_impersonate/easy/mirror.rb +38 -0
- data/lib/ethon_impersonate/easy/operations.rb +64 -0
- data/lib/ethon_impersonate/easy/options.rb +50 -0
- data/lib/ethon_impersonate/easy/params.rb +29 -0
- data/lib/ethon_impersonate/easy/queryable.rb +154 -0
- data/lib/ethon_impersonate/easy/response_callbacks.rb +136 -0
- data/lib/ethon_impersonate/easy/util.rb +28 -0
- data/lib/ethon_impersonate/easy.rb +332 -0
- data/lib/ethon_impersonate/errors/ethon_error.rb +9 -0
- data/lib/ethon_impersonate/errors/global_init.rb +13 -0
- data/lib/ethon_impersonate/errors/invalid_option.rb +13 -0
- data/lib/ethon_impersonate/errors/invalid_value.rb +13 -0
- data/lib/ethon_impersonate/errors/multi_add.rb +12 -0
- data/lib/ethon_impersonate/errors/multi_fdset.rb +12 -0
- data/lib/ethon_impersonate/errors/multi_remove.rb +12 -0
- data/lib/ethon_impersonate/errors/multi_timeout.rb +13 -0
- data/lib/ethon_impersonate/errors/select.rb +13 -0
- data/lib/ethon_impersonate/errors.rb +17 -0
- data/lib/ethon_impersonate/impersonate/fingerprints.rb +16 -0
- data/lib/ethon_impersonate/impersonate/settings.rb +84 -0
- data/lib/ethon_impersonate/impersonate/targets.rb +89 -0
- data/lib/ethon_impersonate/impersonate/tls.rb +189 -0
- data/lib/ethon_impersonate/impersonate.rb +10 -0
- data/lib/ethon_impersonate/libc.rb +21 -0
- data/lib/ethon_impersonate/loggable.rb +59 -0
- data/lib/ethon_impersonate/multi/operations.rb +228 -0
- data/lib/ethon_impersonate/multi/options.rb +117 -0
- data/lib/ethon_impersonate/multi/stack.rb +49 -0
- data/lib/ethon_impersonate/multi.rb +126 -0
- data/lib/ethon_impersonate/version.rb +6 -0
- data/lib/ethon_impersonate.rb +28 -0
- metadata +123 -0
@@ -0,0 +1,126 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'ethon_impersonate/easy/util'
|
3
|
+
require 'ethon_impersonate/multi/stack'
|
4
|
+
require 'ethon_impersonate/multi/operations'
|
5
|
+
require 'ethon_impersonate/multi/options'
|
6
|
+
|
7
|
+
module EthonImpersonate
|
8
|
+
|
9
|
+
# This class represents libcurl multi.
|
10
|
+
class Multi
|
11
|
+
include EthonImpersonate::Multi::Stack
|
12
|
+
include EthonImpersonate::Multi::Operations
|
13
|
+
include EthonImpersonate::Multi::Options
|
14
|
+
|
15
|
+
# Create a new multi. Initialize curl in case
|
16
|
+
# it didn't happen before.
|
17
|
+
#
|
18
|
+
# @example Create a new Multi.
|
19
|
+
# Multi.new
|
20
|
+
#
|
21
|
+
# @param [ Hash ] options The options.
|
22
|
+
#
|
23
|
+
# @option options :socketdata [String]
|
24
|
+
# Pass a pointer to whatever you want passed to the
|
25
|
+
# curl_socket_callback's forth argument, the userp pointer. This is not
|
26
|
+
# used by libcurl but only passed-thru as-is. Set the callback pointer
|
27
|
+
# with CURLMOPT_SOCKETFUNCTION.
|
28
|
+
# @option options :pipelining [Boolean]
|
29
|
+
# Pass a long set to 1 to enable or 0 to disable. Enabling pipelining
|
30
|
+
# on a multi handle will make it attempt to perform HTTP Pipelining as
|
31
|
+
# far as possible for transfers using this handle. This means that if
|
32
|
+
# you add a second request that can use an already existing connection,
|
33
|
+
# the second request will be "piped" on the same connection rather than
|
34
|
+
# being executed in parallel. (Added in 7.16.0)
|
35
|
+
# @option options :timerfunction [Proc]
|
36
|
+
# Pass a pointer to a function matching the curl_multi_timer_callback
|
37
|
+
# prototype. This function will then be called when the timeout value
|
38
|
+
# changes. The timeout value is at what latest time the application
|
39
|
+
# should call one of the "performing" functions of the multi interface
|
40
|
+
# (curl_multi_socket_action(3) and curl_multi_perform(3)) - to allow
|
41
|
+
# libcurl to keep timeouts and retries etc to work. A timeout value of
|
42
|
+
# -1 means that there is no timeout at all, and 0 means that the
|
43
|
+
# timeout is already reached. Libcurl attempts to limit calling this
|
44
|
+
# only when the fixed future timeout time actually changes. See also
|
45
|
+
# CURLMOPT_TIMERDATA. This callback can be used instead of, or in
|
46
|
+
# addition to, curl_multi_timeout(3). (Added in 7.16.0)
|
47
|
+
# @option options :timerdata [String]
|
48
|
+
# Pass a pointer to whatever you want passed to the
|
49
|
+
# curl_multi_timer_callback's third argument, the userp pointer. This
|
50
|
+
# is not used by libcurl but only passed-thru as-is. Set the callback
|
51
|
+
# pointer with CURLMOPT_TIMERFUNCTION. (Added in 7.16.0)
|
52
|
+
# @option options :maxconnects [Integer]
|
53
|
+
# Pass a long. The set number will be used as the maximum amount of
|
54
|
+
# simultaneously open connections that libcurl may cache. Default is
|
55
|
+
# 10, and libcurl will enlarge the size for each added easy handle to
|
56
|
+
# make it fit 4 times the number of added easy handles.
|
57
|
+
# By setting this option, you can prevent the cache size from growing
|
58
|
+
# beyond the limit set by you.
|
59
|
+
# When the cache is full, curl closes the oldest one in the cache to
|
60
|
+
# prevent the number of open connections from increasing.
|
61
|
+
# This option is for the multi handle's use only, when using the easy
|
62
|
+
# interface you should instead use the CURLOPT_MAXCONNECTS option.
|
63
|
+
# (Added in 7.16.3)
|
64
|
+
# @option options :max_total_connections [Integer]
|
65
|
+
# Pass a long. The set number will be used as the maximum amount of
|
66
|
+
# simultaneously open connections in total. For each new session,
|
67
|
+
# libcurl will open a new connection up to the limit set by
|
68
|
+
# CURLMOPT_MAX_TOTAL_CONNECTIONS. When the limit is reached, the
|
69
|
+
# sessions will be pending until there are available connections.
|
70
|
+
# If CURLMOPT_PIPELINING is 1, libcurl will try to pipeline if the host
|
71
|
+
# is capable of it.
|
72
|
+
# The default value is 0, which means that there is no limit. However,
|
73
|
+
# for backwards compatibility, setting it to 0 when CURLMOPT_PIPELINING
|
74
|
+
# is 1 will not be treated as unlimited. Instead it will open only 1
|
75
|
+
# connection and try to pipeline on it.
|
76
|
+
# (Added in 7.30.0)
|
77
|
+
# @option options :execution_mode [Boolean]
|
78
|
+
# Either :perform (default) or :socket_action, specifies the usage
|
79
|
+
# method that will be used on this multi object. The default :perform
|
80
|
+
# mode provides a #perform function that uses curl_multi_perform
|
81
|
+
# behind the scenes to automatically continue execution until all
|
82
|
+
# requests have completed. The :socket_action mode provides an API
|
83
|
+
# that allows the {Multi} object to be integrated into an external
|
84
|
+
# IO loop, by calling #socket_action and responding to the
|
85
|
+
# socketfunction and timerfunction callbacks, using the underlying
|
86
|
+
# curl_multi_socket_action semantics.
|
87
|
+
#
|
88
|
+
# @return [ Multi ] The new multi.
|
89
|
+
def initialize(options = {})
|
90
|
+
Curl.init
|
91
|
+
@execution_mode = options.delete(:execution_mode) || :perform
|
92
|
+
set_attributes(options)
|
93
|
+
init_vars
|
94
|
+
end
|
95
|
+
|
96
|
+
# Set given options.
|
97
|
+
#
|
98
|
+
# @example Set options.
|
99
|
+
# multi.set_attributes(options)
|
100
|
+
#
|
101
|
+
# @raise InvalidOption
|
102
|
+
#
|
103
|
+
# @see initialize
|
104
|
+
#
|
105
|
+
# @api private
|
106
|
+
def set_attributes(options)
|
107
|
+
options.each_pair do |key, value|
|
108
|
+
unless respond_to?("#{key}=")
|
109
|
+
raise Errors::InvalidOption.new(key)
|
110
|
+
end
|
111
|
+
method("#{key}=").call(value)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
private
|
116
|
+
|
117
|
+
# Internal function to gate functions to a specific execution mode
|
118
|
+
#
|
119
|
+
# @raise ArgumentError
|
120
|
+
#
|
121
|
+
# @api private
|
122
|
+
def ensure_execution_mode(expected_mode)
|
123
|
+
raise ArgumentError, "Expected the Multi to be in #{expected_mode} but it was in #{@execution_mode}" if expected_mode != @execution_mode
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'logger'
|
3
|
+
require 'ffi'
|
4
|
+
require 'thread'
|
5
|
+
begin
|
6
|
+
require 'mime/types/columnar'
|
7
|
+
rescue LoadError
|
8
|
+
begin
|
9
|
+
require 'mime/types'
|
10
|
+
rescue LoadError
|
11
|
+
end
|
12
|
+
end
|
13
|
+
require 'tempfile'
|
14
|
+
|
15
|
+
require 'ethon_impersonate/libc'
|
16
|
+
require 'ethon_impersonate/curl'
|
17
|
+
require 'ethon_impersonate/easy'
|
18
|
+
require 'ethon_impersonate/errors'
|
19
|
+
require 'ethon_impersonate/loggable'
|
20
|
+
require 'ethon_impersonate/multi'
|
21
|
+
require 'ethon_impersonate/impersonate'
|
22
|
+
require 'ethon_impersonate/version'
|
23
|
+
|
24
|
+
# EthonImpersonate is a very simple curl-impersonate wrapper.
|
25
|
+
# It provides direct access to libcurl functionality
|
26
|
+
# as well as some helpers for doing http requests.
|
27
|
+
module EthonImpersonate
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ethon-impersonate
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.17.2
|
5
|
+
platform: aarch64-darwin
|
6
|
+
authors:
|
7
|
+
- David Sojevic
|
8
|
+
- Hans Hasselberg
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2025-04-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: ffi
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.15'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.15'
|
27
|
+
description: Realistic browser-like HTTP requests using curl-impersonate's impersonation
|
28
|
+
capabilities.
|
29
|
+
email:
|
30
|
+
- david@sojevic.com
|
31
|
+
executables: []
|
32
|
+
extensions: []
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
35
|
+
- CHANGELOG.md
|
36
|
+
- LICENSE
|
37
|
+
- README.md
|
38
|
+
- config/puma.rb
|
39
|
+
- ethon-impersonate.gemspec
|
40
|
+
- ext/libcurl-impersonate.4.dylib
|
41
|
+
- lib/ethon-impersonate.rb
|
42
|
+
- lib/ethon/impersonate.rb
|
43
|
+
- lib/ethon_impersonate.rb
|
44
|
+
- lib/ethon_impersonate/curl.rb
|
45
|
+
- lib/ethon_impersonate/curls/classes.rb
|
46
|
+
- lib/ethon_impersonate/curls/codes.rb
|
47
|
+
- lib/ethon_impersonate/curls/constants.rb
|
48
|
+
- lib/ethon_impersonate/curls/form_options.rb
|
49
|
+
- lib/ethon_impersonate/curls/functions.rb
|
50
|
+
- lib/ethon_impersonate/curls/infos.rb
|
51
|
+
- lib/ethon_impersonate/curls/messages.rb
|
52
|
+
- lib/ethon_impersonate/curls/options.rb
|
53
|
+
- lib/ethon_impersonate/curls/settings.rb
|
54
|
+
- lib/ethon_impersonate/easy.rb
|
55
|
+
- lib/ethon_impersonate/easy/callbacks.rb
|
56
|
+
- lib/ethon_impersonate/easy/debug_info.rb
|
57
|
+
- lib/ethon_impersonate/easy/features.rb
|
58
|
+
- lib/ethon_impersonate/easy/form.rb
|
59
|
+
- lib/ethon_impersonate/easy/header.rb
|
60
|
+
- lib/ethon_impersonate/easy/http.rb
|
61
|
+
- lib/ethon_impersonate/easy/http/actionable.rb
|
62
|
+
- lib/ethon_impersonate/easy/http/custom.rb
|
63
|
+
- lib/ethon_impersonate/easy/http/delete.rb
|
64
|
+
- lib/ethon_impersonate/easy/http/get.rb
|
65
|
+
- lib/ethon_impersonate/easy/http/head.rb
|
66
|
+
- lib/ethon_impersonate/easy/http/options.rb
|
67
|
+
- lib/ethon_impersonate/easy/http/patch.rb
|
68
|
+
- lib/ethon_impersonate/easy/http/post.rb
|
69
|
+
- lib/ethon_impersonate/easy/http/postable.rb
|
70
|
+
- lib/ethon_impersonate/easy/http/put.rb
|
71
|
+
- lib/ethon_impersonate/easy/http/putable.rb
|
72
|
+
- lib/ethon_impersonate/easy/informations.rb
|
73
|
+
- lib/ethon_impersonate/easy/mirror.rb
|
74
|
+
- lib/ethon_impersonate/easy/operations.rb
|
75
|
+
- lib/ethon_impersonate/easy/options.rb
|
76
|
+
- lib/ethon_impersonate/easy/params.rb
|
77
|
+
- lib/ethon_impersonate/easy/queryable.rb
|
78
|
+
- lib/ethon_impersonate/easy/response_callbacks.rb
|
79
|
+
- lib/ethon_impersonate/easy/util.rb
|
80
|
+
- lib/ethon_impersonate/errors.rb
|
81
|
+
- lib/ethon_impersonate/errors/ethon_error.rb
|
82
|
+
- lib/ethon_impersonate/errors/global_init.rb
|
83
|
+
- lib/ethon_impersonate/errors/invalid_option.rb
|
84
|
+
- lib/ethon_impersonate/errors/invalid_value.rb
|
85
|
+
- lib/ethon_impersonate/errors/multi_add.rb
|
86
|
+
- lib/ethon_impersonate/errors/multi_fdset.rb
|
87
|
+
- lib/ethon_impersonate/errors/multi_remove.rb
|
88
|
+
- lib/ethon_impersonate/errors/multi_timeout.rb
|
89
|
+
- lib/ethon_impersonate/errors/select.rb
|
90
|
+
- lib/ethon_impersonate/impersonate.rb
|
91
|
+
- lib/ethon_impersonate/impersonate/fingerprints.rb
|
92
|
+
- lib/ethon_impersonate/impersonate/settings.rb
|
93
|
+
- lib/ethon_impersonate/impersonate/targets.rb
|
94
|
+
- lib/ethon_impersonate/impersonate/tls.rb
|
95
|
+
- lib/ethon_impersonate/libc.rb
|
96
|
+
- lib/ethon_impersonate/loggable.rb
|
97
|
+
- lib/ethon_impersonate/multi.rb
|
98
|
+
- lib/ethon_impersonate/multi/operations.rb
|
99
|
+
- lib/ethon_impersonate/multi/options.rb
|
100
|
+
- lib/ethon_impersonate/multi/stack.rb
|
101
|
+
- lib/ethon_impersonate/version.rb
|
102
|
+
homepage: https://github.com/dsojevic/ethon-impersonate
|
103
|
+
licenses:
|
104
|
+
- MIT
|
105
|
+
metadata: {}
|
106
|
+
rdoc_options: []
|
107
|
+
require_paths:
|
108
|
+
- lib
|
109
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '2.7'
|
114
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: 1.3.6
|
119
|
+
requirements: []
|
120
|
+
rubygems_version: 3.6.2
|
121
|
+
specification_version: 4
|
122
|
+
summary: Impersonate browser-like HTTP requests.
|
123
|
+
test_files: []
|