reaver 0.18.1 → 0.19.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
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +2 -1
- data/lib/reaver/download.rb +40 -24
- data/lib/reaver/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6834d2796f8a39032bde1bca4048096894c9eee6f86ba94827d91c602bd77472
|
|
4
|
+
data.tar.gz: 36930811fdab7dcc96659fe57d65197211111eb1b571d9a0cb17b34d3a13a503
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e6a5baf04b9dfd95ae78faff572036a085917e97b23bd6d5fb486aa46d71b6aa6f89df684038e5714ed0e6a613ef8f968bed8e2d8d418f89e48b17d4cb3c572c
|
|
7
|
+
data.tar.gz: 9063460fa6da35548ff7e1834e2e3f110c0fdc1046296a9c9b7107c4f91837ab1d9570ebb92bca1c0569c4b6959151fb01d38e7ae2200b87c677c6860449ad51
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/CHANGELOG.md
CHANGED
data/lib/reaver/download.rb
CHANGED
|
@@ -2,26 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
require 'open-uri'
|
|
4
4
|
require 'net/http'
|
|
5
|
-
require '
|
|
6
|
-
require 'fileutils'
|
|
5
|
+
require 'net/https'
|
|
7
6
|
|
|
8
7
|
# Download link
|
|
9
8
|
module Reaver
|
|
10
9
|
module_function
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
# https://github.com/ruby/open-uri/blob/master/lib/open-uri.rb
|
|
12
|
+
def download(url, name, limit = 5)
|
|
13
13
|
dest = name
|
|
14
|
-
url = URI(url)
|
|
15
|
-
raise
|
|
14
|
+
url = URI.parse(url)
|
|
15
|
+
raise ArgumentError, 'url was invalid' unless url.respond_to?(:open)
|
|
16
|
+
raise ArgumentError, 'too many HTTP redirects' if limit.zero?
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
http_object = Net::HTTP.new(url.host, url.port)
|
|
19
|
+
just_add_ssl(http_object) # if url.scheme == 'https'
|
|
20
|
+
http_object.start do |http|
|
|
21
|
+
request = Net::HTTP::Get.new(url.request_uri, { 'user-agent' => agent_list })
|
|
22
|
+
response_stuff(http, request, dest, limit)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def response_stuff(http, request, dest, limit)
|
|
27
|
+
http.read_timeout = 500
|
|
28
|
+
http.request request do |response|
|
|
29
|
+
case response
|
|
30
|
+
when Net::HTTPSuccess then get_the_file(response, dest)
|
|
31
|
+
when Net::HTTPRedirection then download(response['location'], dest, limit - 1)
|
|
32
|
+
else
|
|
33
|
+
raise response.value
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
18
37
|
|
|
38
|
+
def just_add_ssl(http_object)
|
|
39
|
+
store = OpenSSL::X509::Store.new
|
|
40
|
+
store.set_default_paths
|
|
41
|
+
http_object.use_ssl = true
|
|
42
|
+
http_object.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
|
43
|
+
http_object.cert_store = store
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def get_the_file(res, dest)
|
|
19
47
|
Whirly.start do
|
|
20
48
|
Whirly.status = "Downloading #{dest}"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
49
|
+
File.binwrite(dest, res.read_body)
|
|
50
|
+
# open(dest, 'wb') do |io|
|
|
51
|
+
# res.read_body do |chunk|
|
|
52
|
+
# io.write chunk
|
|
53
|
+
# end
|
|
54
|
+
# end
|
|
25
55
|
end
|
|
26
56
|
end
|
|
27
57
|
|
|
@@ -35,18 +65,4 @@ module Reaver
|
|
|
35
65
|
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 Trailer/93.3.8652.5']
|
|
36
66
|
ag.sample
|
|
37
67
|
end
|
|
38
|
-
|
|
39
|
-
def get_the_link(file, dest)
|
|
40
|
-
# open-uri will return a StringIO instead of a Tempfile if the filesize
|
|
41
|
-
# is less than 10 KB, so we patch this behaviour by converting it into
|
|
42
|
-
# a Tempfile.
|
|
43
|
-
if file.is_a?(StringIO)
|
|
44
|
-
tempfile = Tempfile.new('open-uri', binmode: true)
|
|
45
|
-
IO.copy_stream(file, tempfile.path)
|
|
46
|
-
FileUtils.mv tempfile.path, dest
|
|
47
|
-
else
|
|
48
|
-
IO.copy_stream(file, dest)
|
|
49
|
-
end
|
|
50
|
-
file
|
|
51
|
-
end
|
|
52
68
|
end
|
data/lib/reaver/version.rb
CHANGED
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
|
Binary file
|