ronin-support 1.0.0 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +14 -0
  3. data/.rubocop.yml +109 -0
  4. data/ChangeLog.md +33 -1
  5. data/Gemfile +8 -4
  6. data/README.md +1 -1
  7. data/Rakefile +2 -2
  8. data/examples/ssl_proxy.rb +2 -1
  9. data/examples/tcp_proxy.rb +6 -4
  10. data/lib/ronin/support/archive/core_ext/file.rb +43 -0
  11. data/lib/ronin/support/archive/core_ext.rb +1 -1
  12. data/lib/ronin/support/archive/tar/writer.rb +2 -2
  13. data/lib/ronin/support/archive/tar.rb +4 -4
  14. data/lib/ronin/support/archive/zip/reader.rb +2 -2
  15. data/lib/ronin/support/binary/array.rb +5 -8
  16. data/lib/ronin/support/binary/bit_flip.rb +7 -1
  17. data/lib/ronin/support/binary/buffer.rb +25 -25
  18. data/lib/ronin/support/binary/byte_slice.rb +17 -17
  19. data/lib/ronin/support/binary/core_ext.rb +2 -0
  20. data/lib/ronin/support/binary/cstring.rb +50 -4
  21. data/lib/ronin/support/binary/ctypes/arch/arm/big_endian.rb +4 -0
  22. data/lib/ronin/support/binary/ctypes/arch/arm.rb +3 -0
  23. data/lib/ronin/support/binary/ctypes/arch/arm64/big_endian.rb +4 -0
  24. data/lib/ronin/support/binary/ctypes/arch/arm64.rb +3 -0
  25. data/lib/ronin/support/binary/ctypes/arch/mips/little_endian.rb +4 -0
  26. data/lib/ronin/support/binary/ctypes/arch/mips.rb +3 -0
  27. data/lib/ronin/support/binary/ctypes/arch/mips64/little_endian.rb +4 -0
  28. data/lib/ronin/support/binary/ctypes/arch/mips64.rb +3 -0
  29. data/lib/ronin/support/binary/ctypes/arch/ppc.rb +3 -0
  30. data/lib/ronin/support/binary/ctypes/arch/ppc64.rb +3 -0
  31. data/lib/ronin/support/binary/ctypes/arch/x86.rb +3 -0
  32. data/lib/ronin/support/binary/ctypes/arch/x86_64.rb +3 -0
  33. data/lib/ronin/support/binary/ctypes/array_type.rb +2 -2
  34. data/lib/ronin/support/binary/ctypes/big_endian.rb +3 -0
  35. data/lib/ronin/support/binary/ctypes/enum_type.rb +2 -2
  36. data/lib/ronin/support/binary/ctypes/little_endian.rb +3 -0
  37. data/lib/ronin/support/binary/ctypes/native.rb +3 -0
  38. data/lib/ronin/support/binary/ctypes/os/bsd.rb +1 -1
  39. data/lib/ronin/support/binary/ctypes/scalar_type.rb +2 -2
  40. data/lib/ronin/support/binary/ctypes/struct_type.rb +3 -3
  41. data/lib/ronin/support/binary/ctypes/type_resolver.rb +7 -8
  42. data/lib/ronin/support/binary/ctypes/unbounded_array_type.rb +2 -2
  43. data/lib/ronin/support/binary/ctypes/union_type.rb +3 -3
  44. data/lib/ronin/support/binary/ctypes.rb +3 -3
  45. data/lib/ronin/support/binary/memory.rb +2 -2
  46. data/lib/ronin/support/binary/packet.rb +80 -0
  47. data/lib/ronin/support/binary/stack.rb +6 -7
  48. data/lib/ronin/support/binary/struct/member.rb +5 -3
  49. data/lib/ronin/support/binary/struct.rb +81 -79
  50. data/lib/ronin/support/binary/template.rb +2 -5
  51. data/lib/ronin/support/binary/unhexdump/parser.rb +11 -11
  52. data/lib/ronin/support/binary/union.rb +22 -22
  53. data/lib/ronin/support/binary.rb +1 -0
  54. data/lib/ronin/support/cli/ansi.rb +0 -1
  55. data/lib/ronin/support/cli/io_shell/core_ext/io.rb +1 -1
  56. data/lib/ronin/support/cli/io_shell.rb +4 -4
  57. data/lib/ronin/support/cli/printing.rb +3 -3
  58. data/lib/ronin/support/compression/core_ext/file.rb +16 -0
  59. data/lib/ronin/support/compression/zlib.rb +1 -1
  60. data/lib/ronin/support/core_ext/enumerable.rb +0 -2
  61. data/lib/ronin/support/core_ext/file.rb +1 -1
  62. data/lib/ronin/support/core_ext/kernel.rb +6 -9
  63. data/lib/ronin/support/core_ext/string.rb +2 -2
  64. data/lib/ronin/support/crypto/cert.rb +11 -15
  65. data/lib/ronin/support/crypto/cert_chain.rb +1 -1
  66. data/lib/ronin/support/crypto/cipher/aes.rb +3 -0
  67. data/lib/ronin/support/crypto/cipher/aes128.rb +4 -1
  68. data/lib/ronin/support/crypto/cipher/aes256.rb +4 -1
  69. data/lib/ronin/support/crypto/cipher.rb +1 -1
  70. data/lib/ronin/support/crypto/core_ext/file.rb +33 -1
  71. data/lib/ronin/support/crypto/core_ext/string.rb +34 -2
  72. data/lib/ronin/support/crypto/key/methods.rb +4 -1
  73. data/lib/ronin/support/crypto/key.rb +5 -2
  74. data/lib/ronin/support/crypto/openssl.rb +1 -1
  75. data/lib/ronin/support/crypto.rb +0 -1
  76. data/lib/ronin/support/encoding/base16.rb +2 -2
  77. data/lib/ronin/support/encoding/base32.rb +29 -18
  78. data/lib/ronin/support/encoding/c/core_ext/integer.rb +1 -1
  79. data/lib/ronin/support/encoding/c/core_ext/string.rb +1 -1
  80. data/lib/ronin/support/encoding/c.rb +6 -6
  81. data/lib/ronin/support/encoding/core_ext/string.rb +2 -2
  82. data/lib/ronin/support/encoding/hex/core_ext/string.rb +1 -1
  83. data/lib/ronin/support/encoding/hex.rb +4 -4
  84. data/lib/ronin/support/encoding/js/core_ext/integer.rb +1 -1
  85. data/lib/ronin/support/encoding/js.rb +5 -5
  86. data/lib/ronin/support/encoding/powershell/core_ext/integer.rb +2 -2
  87. data/lib/ronin/support/encoding/powershell.rb +5 -6
  88. data/lib/ronin/support/encoding/quoted_printable.rb +3 -1
  89. data/lib/ronin/support/encoding/ruby.rb +5 -5
  90. data/lib/ronin/support/encoding/shell/core_ext/integer.rb +2 -2
  91. data/lib/ronin/support/encoding/shell.rb +3 -3
  92. data/lib/ronin/support/encoding/sql.rb +1 -1
  93. data/lib/ronin/support/encoding/uuencoding.rb +3 -1
  94. data/lib/ronin/support/encoding/xml.rb +3 -3
  95. data/lib/ronin/support/encoding.rb +95 -0
  96. data/lib/ronin/support/network/asn/list.rb +6 -1
  97. data/lib/ronin/support/network/asn/record.rb +3 -0
  98. data/lib/ronin/support/network/asn/record_set.rb +3 -0
  99. data/lib/ronin/support/network/asn.rb +167 -6
  100. data/lib/ronin/support/network/dns/mixin.rb +2 -10
  101. data/lib/ronin/support/network/dns/resolver.rb +3 -0
  102. data/lib/ronin/support/network/domain.rb +21 -21
  103. data/lib/ronin/support/network/email_address.rb +1 -5
  104. data/lib/ronin/support/network/esmtp/mixin.rb +1 -0
  105. data/lib/ronin/support/network/ftp/mixin.rb +1 -1
  106. data/lib/ronin/support/network/host.rb +75 -47
  107. data/lib/ronin/support/network/http/core_ext/uri/http.rb +8 -0
  108. data/lib/ronin/support/network/http/core_ext.rb +1 -1
  109. data/lib/ronin/support/network/http.rb +317 -80
  110. data/lib/ronin/support/network/ip.rb +49 -23
  111. data/lib/ronin/support/network/ip_range/cidr.rb +1 -5
  112. data/lib/ronin/support/network/ip_range/glob.rb +1 -0
  113. data/lib/ronin/support/network/ip_range/range.rb +1 -1
  114. data/lib/ronin/support/network/ip_range.rb +5 -7
  115. data/lib/ronin/support/network/proxy.rb +4 -4
  116. data/lib/ronin/support/network/public_suffix/list.rb +10 -8
  117. data/lib/ronin/support/network/public_suffix/suffix_set.rb +3 -0
  118. data/lib/ronin/support/network/public_suffix.rb +9 -4
  119. data/lib/ronin/support/network/smtp/email.rb +0 -9
  120. data/lib/ronin/support/network/smtp/mixin.rb +2 -2
  121. data/lib/ronin/support/network/ssl/local_cert.rb +1 -3
  122. data/lib/ronin/support/network/ssl/mixin.rb +13 -13
  123. data/lib/ronin/support/network/ssl/openssl.rb +1 -1
  124. data/lib/ronin/support/network/ssl/proxy.rb +14 -16
  125. data/lib/ronin/support/network/ssl.rb +4 -2
  126. data/lib/ronin/support/network/tcp/proxy.rb +3 -3
  127. data/lib/ronin/support/network/tcp.rb +10 -12
  128. data/lib/ronin/support/network/telnet/mixin.rb +14 -14
  129. data/lib/ronin/support/network/tld/list.rb +2 -1
  130. data/lib/ronin/support/network/tld.rb +7 -4
  131. data/lib/ronin/support/network/tls/proxy.rb +1 -1
  132. data/lib/ronin/support/network/tls.rb +0 -2
  133. data/lib/ronin/support/network/udp/proxy.rb +5 -5
  134. data/lib/ronin/support/network/udp.rb +14 -16
  135. data/lib/ronin/support/path.rb +4 -4
  136. data/lib/ronin/support/text/erb/mixin.rb +3 -0
  137. data/lib/ronin/support/text/homoglyph/core_ext/string.rb +33 -0
  138. data/lib/ronin/support/text/homoglyph/table.rb +3 -3
  139. data/lib/ronin/support/text/patterns/credentials.rb +2 -2
  140. data/lib/ronin/support/text/patterns/crypto.rb +1 -1
  141. data/lib/ronin/support/text/patterns/file_system.rb +3 -4
  142. data/lib/ronin/support/text/patterns/network.rb +21 -21
  143. data/lib/ronin/support/text/patterns/numeric.rb +1 -1
  144. data/lib/ronin/support/text/patterns/source_code.rb +2 -2
  145. data/lib/ronin/support/text/random/mixin.rb +17 -17
  146. data/lib/ronin/support/text/random.rb +25 -25
  147. data/lib/ronin/support/text/typo/core_ext/string.rb +24 -0
  148. data/lib/ronin/support/text/typo/generator.rb +2 -2
  149. data/lib/ronin/support/version.rb +1 -1
  150. data/ronin-support.gemspec +6 -5
  151. metadata +3 -2
@@ -152,12 +152,12 @@ module Ronin
152
152
  attr_reader :headers
153
153
 
154
154
  # The HTTP Baic-Auth user to add to every request.
155
- #
155
+ #
156
156
  # @return [String, nil]
157
157
  attr_reader :user
158
158
 
159
159
  # The HTTP Baic-Auth password to add to every request.
160
- #
160
+ #
161
161
  # @return [String, nil]
162
162
  attr_reader :password
163
163
 
@@ -276,7 +276,7 @@ module Ronin
276
276
  end
277
277
 
278
278
  case ssl
279
- when true then initialize_ssl()
279
+ when true then initialize_ssl
280
280
  when Hash then initialize_ssl(**ssl)
281
281
  end
282
282
 
@@ -364,7 +364,7 @@ module Ronin
364
364
  @http.extra_chain_cert = extra_chain_cert if extra_chain_cert
365
365
  @http.key = key if key
366
366
 
367
- @http.ssl_timeout = timeout if timeout
367
+ @http.ssl_timeout = timeout if timeout
368
368
  @http.ssl_version = SSL::VERSIONS.fetch(version,version) if version
369
369
  @http.min_version = min_version if min_version
370
370
  @http.max_version = max_version if max_version
@@ -505,21 +505,39 @@ module Ronin
505
505
  #
506
506
  # @since 1.0.0
507
507
  #
508
- def self.connect_uri(url, ssl: nil, **kwargs,&block)
509
- uri = case url
510
- when Addressable::URI, URI::HTTP
511
- url
512
- when String
513
- Addressable::URI.parse(url)
514
- else
515
- raise(ArgumentError,"url must be a URI::HTTP, Addressable::URI, or a String: #{url.inspect}")
516
- end
517
-
518
- host = uri.host
519
- port = uri.port
520
- ssl ||= uri.scheme == 'https'
508
+ def self.connect_uri(url, ssl: nil,
509
+ user: nil,
510
+ password: nil,
511
+ **kwargs, &block)
512
+ case url
513
+ when URI::HTTP
514
+ host = url.host
515
+ port = url.port
516
+ user ||= url.user
517
+ password ||= url.password
518
+ ssl ||= (url.scheme == 'https')
519
+ when String
520
+ uri = Addressable::URI.parse(url)
521
+
522
+ host = uri.host
523
+ port = uri.inferred_port
524
+ user ||= uri.user
525
+ password ||= uri.password
526
+ ssl ||= (uri.scheme == 'https')
527
+ when Addressable::URI
528
+ host = url.host
529
+ port = url.inferred_port
530
+ user ||= url.user
531
+ password ||= url.password
532
+ ssl ||= (url.scheme == 'https')
533
+ else
534
+ raise(ArgumentError,"url must be a URI::HTTP, Addressable::URI, or a String: #{url.inspect}")
535
+ end
521
536
 
522
- return connect(host,port, ssl: ssl, **kwargs,&block)
537
+ return connect(host,port, ssl: ssl,
538
+ user: user,
539
+ password: password,
540
+ **kwargs, &block)
523
541
  end
524
542
 
525
543
  #
@@ -1408,9 +1426,17 @@ module Ronin
1408
1426
  password: nil,
1409
1427
  **kwargs,
1410
1428
  &block)
1411
- url = URI(url)
1412
- path = url.request_uri
1413
- http = connect_uri(url, proxy: proxy,
1429
+ uri = case url
1430
+ when Addressable::URI, URI::HTTP
1431
+ url
1432
+ when String
1433
+ Addressable::URI.parse(url)
1434
+ else
1435
+ raise(ArgumentError,"URL argument must be either a Addressable::URI, URI::HTTP, or a String: #{url.inspect}")
1436
+ end
1437
+
1438
+ path = uri.request_uri
1439
+ http = connect_uri(uri, proxy: proxy,
1414
1440
  ssl: ssl,
1415
1441
  headers: headers,
1416
1442
  user_agent: user_agent,
@@ -1451,8 +1477,16 @@ module Ronin
1451
1477
  user: nil,
1452
1478
  password: nil,
1453
1479
  **kwargs)
1454
- url = URI(url)
1455
- path = url.request_uri
1480
+ uri = case url
1481
+ when Addressable::URI, URI::HTTP
1482
+ url
1483
+ when String
1484
+ Addressable::URI.parse(url)
1485
+ else
1486
+ raise(ArgumentError,"URL argument must be either a Addressable::URI, URI::HTTP, or a String: #{url.inspect}")
1487
+ end
1488
+
1489
+ path = uri.request_uri
1456
1490
  http = connect_uri(url, proxy: proxy,
1457
1491
  ssl: ssl,
1458
1492
  headers: headers,
@@ -1494,8 +1528,16 @@ module Ronin
1494
1528
  user: nil,
1495
1529
  password: nil,
1496
1530
  **kwargs)
1497
- url = URI(url)
1498
- path = url.request_uri
1531
+ uri = case url
1532
+ when Addressable::URI, URI::HTTP
1533
+ url
1534
+ when String
1535
+ Addressable::URI.parse(url)
1536
+ else
1537
+ raise(ArgumentError,"URL argument must be either a Addressable::URI, URI::HTTP, or a String: #{url.inspect}")
1538
+ end
1539
+
1540
+ path = uri.request_uri
1499
1541
  http = connect_uri(url, proxy: proxy,
1500
1542
  ssl: ssl,
1501
1543
  headers: headers,
@@ -1537,8 +1579,16 @@ module Ronin
1537
1579
  user: nil,
1538
1580
  password: nil,
1539
1581
  **kwargs)
1540
- url = URI(url)
1541
- path = url.request_uri
1582
+ uri = case url
1583
+ when Addressable::URI, URI::HTTP
1584
+ url
1585
+ when String
1586
+ Addressable::URI.parse(url)
1587
+ else
1588
+ raise(ArgumentError,"URL argument must be either a Addressable::URI, URI::HTTP, or a String: #{url.inspect}")
1589
+ end
1590
+
1591
+ path = uri.request_uri
1542
1592
  http = connect_uri(url, proxy: proxy,
1543
1593
  ssl: ssl,
1544
1594
  headers: headers,
@@ -1575,8 +1625,16 @@ module Ronin
1575
1625
  user: nil,
1576
1626
  password: nil,
1577
1627
  **kwargs)
1578
- url = URI(url)
1579
- path = url.request_uri
1628
+ uri = case url
1629
+ when Addressable::URI, URI::HTTP
1630
+ url
1631
+ when String
1632
+ Addressable::URI.parse(url)
1633
+ else
1634
+ raise(ArgumentError,"URL argument must be either a Addressable::URI, URI::HTTP, or a String: #{url.inspect}")
1635
+ end
1636
+
1637
+ path = uri.request_uri
1580
1638
  http = connect_uri(url, proxy: proxy,
1581
1639
  ssl: ssl,
1582
1640
  headers: headers,
@@ -1613,8 +1671,16 @@ module Ronin
1613
1671
  user: nil,
1614
1672
  password: nil,
1615
1673
  **kwargs)
1616
- url = URI(url)
1617
- path = url.request_uri
1674
+ uri = case url
1675
+ when Addressable::URI, URI::HTTP
1676
+ url
1677
+ when String
1678
+ Addressable::URI.parse(url)
1679
+ else
1680
+ raise(ArgumentError,"URL argument must be either a Addressable::URI, URI::HTTP, or a String: #{url.inspect}")
1681
+ end
1682
+
1683
+ path = uri.request_uri
1618
1684
  http = connect_uri(url, proxy: proxy,
1619
1685
  ssl: ssl,
1620
1686
  headers: headers,
@@ -1656,8 +1722,16 @@ module Ronin
1656
1722
  user: nil,
1657
1723
  password: nil,
1658
1724
  **kwargs)
1659
- url = URI(url)
1660
- path = url.request_uri
1725
+ uri = case url
1726
+ when Addressable::URI, URI::HTTP
1727
+ url
1728
+ when String
1729
+ Addressable::URI.parse(url)
1730
+ else
1731
+ raise(ArgumentError,"URL argument must be either a Addressable::URI, URI::HTTP, or a String: #{url.inspect}")
1732
+ end
1733
+
1734
+ path = uri.request_uri
1661
1735
  http = connect_uri(url, proxy: proxy,
1662
1736
  ssl: ssl,
1663
1737
  headers: headers,
@@ -1701,8 +1775,16 @@ module Ronin
1701
1775
  password: nil,
1702
1776
  **kwargs,
1703
1777
  &block)
1704
- url = URI(url)
1705
- path = url.request_uri
1778
+ uri = case url
1779
+ when Addressable::URI, URI::HTTP
1780
+ url
1781
+ when String
1782
+ Addressable::URI.parse(url)
1783
+ else
1784
+ raise(ArgumentError,"URL argument must be either a Addressable::URI, URI::HTTP, or a String: #{url.inspect}")
1785
+ end
1786
+
1787
+ path = uri.request_uri
1706
1788
  http = connect_uri(url, proxy: proxy,
1707
1789
  ssl: ssl,
1708
1790
  headers: headers,
@@ -1746,8 +1828,16 @@ module Ronin
1746
1828
  password: nil,
1747
1829
  **kwargs,
1748
1830
  &block)
1749
- url = URI(url)
1750
- path = url.request_uri
1831
+ uri = case url
1832
+ when Addressable::URI, URI::HTTP
1833
+ url
1834
+ when String
1835
+ Addressable::URI.parse(url)
1836
+ else
1837
+ raise(ArgumentError,"URL argument must be either a Addressable::URI, URI::HTTP, or a String: #{url.inspect}")
1838
+ end
1839
+
1840
+ path = uri.request_uri
1751
1841
  http = connect_uri(url, proxy: proxy,
1752
1842
  ssl: ssl,
1753
1843
  headers: headers,
@@ -1791,8 +1881,16 @@ module Ronin
1791
1881
  password: nil,
1792
1882
  **kwargs,
1793
1883
  &block)
1794
- url = URI(url)
1795
- path = url.request_uri
1884
+ uri = case url
1885
+ when Addressable::URI, URI::HTTP
1886
+ url
1887
+ when String
1888
+ Addressable::URI.parse(url)
1889
+ else
1890
+ raise(ArgumentError,"URL argument must be either a Addressable::URI, URI::HTTP, or a String: #{url.inspect}")
1891
+ end
1892
+
1893
+ path = uri.request_uri
1796
1894
  http = connect_uri(url, proxy: proxy,
1797
1895
  ssl: ssl,
1798
1896
  headers: headers,
@@ -1830,8 +1928,16 @@ module Ronin
1830
1928
  user: nil,
1831
1929
  password: nil,
1832
1930
  **kwargs)
1833
- url = URI(url)
1834
- path = url.request_uri
1931
+ uri = case url
1932
+ when Addressable::URI, URI::HTTP
1933
+ url
1934
+ when String
1935
+ Addressable::URI.parse(url)
1936
+ else
1937
+ raise(ArgumentError,"URL argument must be either a Addressable::URI, URI::HTTP, or a String: #{url.inspect}")
1938
+ end
1939
+
1940
+ path = uri.request_uri
1835
1941
  http = connect_uri(url, proxy: proxy,
1836
1942
  ssl: ssl,
1837
1943
  headers: headers,
@@ -1868,8 +1974,16 @@ module Ronin
1868
1974
  user: nil,
1869
1975
  password: nil,
1870
1976
  **kwargs)
1871
- url = URI(url)
1872
- path = url.request_uri
1977
+ uri = case url
1978
+ when Addressable::URI, URI::HTTP
1979
+ url
1980
+ when String
1981
+ Addressable::URI.parse(url)
1982
+ else
1983
+ raise(ArgumentError,"URL argument must be either a Addressable::URI, URI::HTTP, or a String: #{url.inspect}")
1984
+ end
1985
+
1986
+ path = uri.request_uri
1873
1987
  http = connect_uri(url, proxy: proxy,
1874
1988
  ssl: ssl,
1875
1989
  headers: headers,
@@ -1907,8 +2021,16 @@ module Ronin
1907
2021
  user: nil,
1908
2022
  password: nil,
1909
2023
  **kwargs)
1910
- url = URI(url)
1911
- path = url.request_uri
2024
+ uri = case url
2025
+ when Addressable::URI, URI::HTTP
2026
+ url
2027
+ when String
2028
+ Addressable::URI.parse(url)
2029
+ else
2030
+ raise(ArgumentError,"URL argument must be either a Addressable::URI, URI::HTTP, or a String: #{url.inspect}")
2031
+ end
2032
+
2033
+ path = uri.request_uri
1912
2034
  http = connect_uri(url, proxy: proxy,
1913
2035
  ssl: ssl,
1914
2036
  headers: headers,
@@ -1952,8 +2074,16 @@ module Ronin
1952
2074
  password: nil,
1953
2075
  **kwargs,
1954
2076
  &block)
1955
- url = URI(url)
1956
- path = url.request_uri
2077
+ uri = case url
2078
+ when Addressable::URI, URI::HTTP
2079
+ url
2080
+ when String
2081
+ Addressable::URI.parse(url)
2082
+ else
2083
+ raise(ArgumentError,"URL argument must be either a Addressable::URI, URI::HTTP, or a String: #{url.inspect}")
2084
+ end
2085
+
2086
+ path = uri.request_uri
1957
2087
  http = connect_uri(url, proxy: proxy,
1958
2088
  ssl: ssl,
1959
2089
  headers: headers,
@@ -1997,8 +2127,16 @@ module Ronin
1997
2127
  password: nil,
1998
2128
  **kwargs,
1999
2129
  &block)
2000
- url = URI(url)
2001
- path = url.request_uri
2130
+ uri = case url
2131
+ when Addressable::URI, URI::HTTP
2132
+ url
2133
+ when String
2134
+ Addressable::URI.parse(url)
2135
+ else
2136
+ raise(ArgumentError,"URL argument must be either a Addressable::URI, URI::HTTP, or a String: #{url.inspect}")
2137
+ end
2138
+
2139
+ path = uri.request_uri
2002
2140
  http = connect_uri(url, proxy: proxy,
2003
2141
  ssl: ssl,
2004
2142
  headers: headers,
@@ -2042,8 +2180,16 @@ module Ronin
2042
2180
  password: nil,
2043
2181
  **kwargs,
2044
2182
  &block)
2045
- url = URI(url)
2046
- path = url.request_uri
2183
+ uri = case url
2184
+ when Addressable::URI, URI::HTTP
2185
+ url
2186
+ when String
2187
+ Addressable::URI.parse(url)
2188
+ else
2189
+ raise(ArgumentError,"URL argument must be either a Addressable::URI, URI::HTTP, or a String: #{url.inspect}")
2190
+ end
2191
+
2192
+ path = uri.request_uri
2047
2193
  http = connect_uri(url, proxy: proxy,
2048
2194
  ssl: ssl,
2049
2195
  headers: headers,
@@ -2087,8 +2233,16 @@ module Ronin
2087
2233
  password: nil,
2088
2234
  **kwargs,
2089
2235
  &block)
2090
- url = URI(url)
2091
- path = url.request_uri
2236
+ uri = case url
2237
+ when Addressable::URI, URI::HTTP
2238
+ url
2239
+ when String
2240
+ Addressable::URI.parse(url)
2241
+ else
2242
+ raise(ArgumentError,"URL argument must be either a Addressable::URI, URI::HTTP, or a String: #{url.inspect}")
2243
+ end
2244
+
2245
+ path = uri.request_uri
2092
2246
  http = connect_uri(url, proxy: proxy,
2093
2247
  ssl: ssl,
2094
2248
  headers: headers,
@@ -2132,8 +2286,16 @@ module Ronin
2132
2286
  password: nil,
2133
2287
  **kwargs,
2134
2288
  &block)
2135
- url = URI(url)
2136
- path = url.request_uri
2289
+ uri = case url
2290
+ when Addressable::URI, URI::HTTP
2291
+ url
2292
+ when String
2293
+ Addressable::URI.parse(url)
2294
+ else
2295
+ raise(ArgumentError,"URL argument must be either a Addressable::URI, URI::HTTP, or a String: #{url.inspect}")
2296
+ end
2297
+
2298
+ path = uri.request_uri
2137
2299
  http = connect_uri(url, proxy: proxy,
2138
2300
  ssl: ssl,
2139
2301
  headers: headers,
@@ -2171,8 +2333,16 @@ module Ronin
2171
2333
  user: nil,
2172
2334
  password: nil,
2173
2335
  **kwargs)
2174
- url = URI(url)
2175
- path = url.request_uri
2336
+ uri = case url
2337
+ when Addressable::URI, URI::HTTP
2338
+ url
2339
+ when String
2340
+ Addressable::URI.parse(url)
2341
+ else
2342
+ raise(ArgumentError,"URL argument must be either a Addressable::URI, URI::HTTP, or a String: #{url.inspect}")
2343
+ end
2344
+
2345
+ path = uri.request_uri
2176
2346
  http = connect_uri(url, proxy: proxy,
2177
2347
  ssl: ssl,
2178
2348
  headers: headers,
@@ -2184,7 +2354,6 @@ module Ronin
2184
2354
  http.allowed_methods(path,**kwargs)
2185
2355
  end
2186
2356
 
2187
-
2188
2357
  #
2189
2358
  # Performs a `PATCH` request for the given URI.
2190
2359
  #
@@ -2217,8 +2386,16 @@ module Ronin
2217
2386
  password: nil,
2218
2387
  **kwargs,
2219
2388
  &block)
2220
- url = URI(url)
2221
- path = url.request_uri
2389
+ uri = case url
2390
+ when Addressable::URI, URI::HTTP
2391
+ url
2392
+ when String
2393
+ Addressable::URI.parse(url)
2394
+ else
2395
+ raise(ArgumentError,"URL argument must be either a Addressable::URI, URI::HTTP, or a String: #{url.inspect}")
2396
+ end
2397
+
2398
+ path = uri.request_uri
2222
2399
  http = connect_uri(url, proxy: proxy,
2223
2400
  ssl: ssl,
2224
2401
  headers: headers,
@@ -2262,8 +2439,16 @@ module Ronin
2262
2439
  password: nil,
2263
2440
  **kwargs,
2264
2441
  &block)
2265
- url = URI(url)
2266
- path = url.request_uri
2442
+ uri = case url
2443
+ when Addressable::URI, URI::HTTP
2444
+ url
2445
+ when String
2446
+ Addressable::URI.parse(url)
2447
+ else
2448
+ raise(ArgumentError,"URL argument must be either a Addressable::URI, URI::HTTP, or a String: #{url.inspect}")
2449
+ end
2450
+
2451
+ path = uri.request_uri
2267
2452
  http = connect_uri(url, proxy: proxy,
2268
2453
  ssl: ssl,
2269
2454
  headers: headers,
@@ -2301,8 +2486,16 @@ module Ronin
2301
2486
  user: nil,
2302
2487
  password: nil,
2303
2488
  **kwargs)
2304
- url = URI(url)
2305
- path = url.request_uri
2489
+ uri = case url
2490
+ when Addressable::URI, URI::HTTP
2491
+ url
2492
+ when String
2493
+ Addressable::URI.parse(url)
2494
+ else
2495
+ raise(ArgumentError,"URL argument must be either a Addressable::URI, URI::HTTP, or a String: #{url.inspect}")
2496
+ end
2497
+
2498
+ path = uri.request_uri
2306
2499
  http = connect_uri(url, proxy: proxy,
2307
2500
  ssl: ssl,
2308
2501
  headers: headers,
@@ -2340,8 +2533,16 @@ module Ronin
2340
2533
  user: nil,
2341
2534
  password: nil,
2342
2535
  **kwargs)
2343
- url = URI(url)
2344
- path = url.request_uri
2536
+ uri = case url
2537
+ when Addressable::URI, URI::HTTP
2538
+ url
2539
+ when String
2540
+ Addressable::URI.parse(url)
2541
+ else
2542
+ raise(ArgumentError,"URL argument must be either a Addressable::URI, URI::HTTP, or a String: #{url.inspect}")
2543
+ end
2544
+
2545
+ path = uri.request_uri
2345
2546
  http = connect_uri(url, proxy: proxy,
2346
2547
  ssl: ssl,
2347
2548
  headers: headers,
@@ -2385,8 +2586,16 @@ module Ronin
2385
2586
  password: nil,
2386
2587
  **kwargs,
2387
2588
  &block)
2388
- url = URI(url)
2389
- path = url.request_uri
2589
+ uri = case url
2590
+ when Addressable::URI, URI::HTTP
2591
+ url
2592
+ when String
2593
+ Addressable::URI.parse(url)
2594
+ else
2595
+ raise(ArgumentError,"URL argument must be either a Addressable::URI, URI::HTTP, or a String: #{url.inspect}")
2596
+ end
2597
+
2598
+ path = uri.request_uri
2390
2599
  http = connect_uri(url, proxy: proxy,
2391
2600
  ssl: ssl,
2392
2601
  headers: headers,
@@ -2398,8 +2607,6 @@ module Ronin
2398
2607
  http.propfind(path,**kwargs,&block)
2399
2608
  end
2400
2609
 
2401
- alias prop_find propfind
2402
-
2403
2610
  #
2404
2611
  # Performs a `PROPPATCH` request for the given URI.
2405
2612
  #
@@ -2432,8 +2639,16 @@ module Ronin
2432
2639
  password: nil,
2433
2640
  **kwargs,
2434
2641
  &block)
2435
- url = URI(url)
2436
- path = url.request_uri
2642
+ uri = case url
2643
+ when Addressable::URI, URI::HTTP
2644
+ url
2645
+ when String
2646
+ Addressable::URI.parse(url)
2647
+ else
2648
+ raise(ArgumentError,"URL argument must be either a Addressable::URI, URI::HTTP, or a String: #{url.inspect}")
2649
+ end
2650
+
2651
+ path = uri.request_uri
2437
2652
  http = connect_uri(url, proxy: proxy,
2438
2653
  ssl: ssl,
2439
2654
  headers: headers,
@@ -2445,8 +2660,6 @@ module Ronin
2445
2660
  http.proppatch(path,**kwargs,&block)
2446
2661
  end
2447
2662
 
2448
- alias prop_patch proppatch
2449
-
2450
2663
  #
2451
2664
  # Performs a `PUT` request for the given URI.
2452
2665
  #
@@ -2479,8 +2692,16 @@ module Ronin
2479
2692
  password: nil,
2480
2693
  **kwargs,
2481
2694
  &block)
2482
- url = URI(url)
2483
- path = url.request_uri
2695
+ uri = case url
2696
+ when Addressable::URI, URI::HTTP
2697
+ url
2698
+ when String
2699
+ Addressable::URI.parse(url)
2700
+ else
2701
+ raise(ArgumentError,"URL argument must be either a Addressable::URI, URI::HTTP, or a String: #{url.inspect}")
2702
+ end
2703
+
2704
+ path = uri.request_uri
2484
2705
  http = connect_uri(url, proxy: proxy,
2485
2706
  ssl: ssl,
2486
2707
  headers: headers,
@@ -2524,8 +2745,16 @@ module Ronin
2524
2745
  password: nil,
2525
2746
  **kwargs,
2526
2747
  &block)
2527
- url = URI(url)
2528
- path = url.request_uri
2748
+ uri = case url
2749
+ when Addressable::URI, URI::HTTP
2750
+ url
2751
+ when String
2752
+ Addressable::URI.parse(url)
2753
+ else
2754
+ raise(ArgumentError,"URL argument must be either a Addressable::URI, URI::HTTP, or a String: #{url.inspect}")
2755
+ end
2756
+
2757
+ path = uri.request_uri
2529
2758
  http = connect_uri(url, proxy: proxy,
2530
2759
  ssl: ssl,
2531
2760
  headers: headers,
@@ -2569,8 +2798,16 @@ module Ronin
2569
2798
  password: nil,
2570
2799
  **kwargs,
2571
2800
  &block)
2572
- url = URI(url)
2573
- path = url.request_uri
2801
+ uri = case url
2802
+ when Addressable::URI, URI::HTTP
2803
+ url
2804
+ when String
2805
+ Addressable::URI.parse(url)
2806
+ else
2807
+ raise(ArgumentError,"URL argument must be either a Addressable::URI, URI::HTTP, or a String: #{url.inspect}")
2808
+ end
2809
+
2810
+ path = uri.request_uri
2574
2811
  http = connect_uri(url, proxy: proxy,
2575
2812
  ssl: ssl,
2576
2813
  headers: headers,