ronin-support 1.0.0.beta3 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +14 -0
- data/.rubocop.yml +109 -0
- data/ChangeLog.md +12 -1
- data/Gemfile +8 -4
- data/README.md +1 -1
- data/Rakefile +2 -2
- data/examples/ssl_proxy.rb +2 -1
- data/examples/tcp_proxy.rb +6 -4
- data/lib/ronin/support/archive/tar/writer.rb +2 -2
- data/lib/ronin/support/archive/tar.rb +4 -4
- data/lib/ronin/support/archive/zip/reader.rb +2 -2
- data/lib/ronin/support/binary/array.rb +4 -7
- data/lib/ronin/support/binary/bit_flip.rb +7 -1
- data/lib/ronin/support/binary/buffer.rb +22 -22
- data/lib/ronin/support/binary/byte_slice.rb +17 -17
- data/lib/ronin/support/binary/cstring.rb +7 -4
- data/lib/ronin/support/binary/ctypes/arch/arm/big_endian.rb +4 -0
- data/lib/ronin/support/binary/ctypes/arch/arm.rb +3 -0
- data/lib/ronin/support/binary/ctypes/arch/arm64/big_endian.rb +4 -0
- data/lib/ronin/support/binary/ctypes/arch/arm64.rb +3 -0
- data/lib/ronin/support/binary/ctypes/arch/mips/little_endian.rb +4 -0
- data/lib/ronin/support/binary/ctypes/arch/mips.rb +3 -0
- data/lib/ronin/support/binary/ctypes/arch/mips64/little_endian.rb +4 -0
- data/lib/ronin/support/binary/ctypes/arch/mips64.rb +3 -0
- data/lib/ronin/support/binary/ctypes/arch/ppc.rb +3 -0
- data/lib/ronin/support/binary/ctypes/arch/ppc64.rb +3 -0
- data/lib/ronin/support/binary/ctypes/arch/x86.rb +3 -0
- data/lib/ronin/support/binary/ctypes/arch/x86_64.rb +3 -0
- data/lib/ronin/support/binary/ctypes/array_type.rb +1 -1
- data/lib/ronin/support/binary/ctypes/big_endian.rb +3 -0
- data/lib/ronin/support/binary/ctypes/enum_type.rb +2 -2
- data/lib/ronin/support/binary/ctypes/little_endian.rb +3 -0
- data/lib/ronin/support/binary/ctypes/native.rb +3 -0
- data/lib/ronin/support/binary/ctypes/scalar_type.rb +2 -2
- data/lib/ronin/support/binary/ctypes/struct_type.rb +3 -3
- data/lib/ronin/support/binary/ctypes/type_resolver.rb +7 -8
- data/lib/ronin/support/binary/ctypes/unbounded_array_type.rb +1 -1
- data/lib/ronin/support/binary/ctypes/union_type.rb +3 -3
- data/lib/ronin/support/binary/ctypes.rb +3 -3
- data/lib/ronin/support/binary/memory.rb +2 -2
- data/lib/ronin/support/binary/packet.rb +3 -0
- data/lib/ronin/support/binary/stack.rb +3 -4
- data/lib/ronin/support/binary/struct/member.rb +5 -3
- data/lib/ronin/support/binary/struct.rb +81 -79
- data/lib/ronin/support/binary/template.rb +1 -0
- data/lib/ronin/support/binary/unhexdump/parser.rb +11 -11
- data/lib/ronin/support/binary/union.rb +22 -22
- data/lib/ronin/support/cli/ansi.rb +0 -1
- data/lib/ronin/support/cli/io_shell/core_ext/io.rb +1 -1
- data/lib/ronin/support/cli/io_shell.rb +4 -4
- data/lib/ronin/support/cli/printing.rb +3 -3
- data/lib/ronin/support/compression/zlib.rb +1 -1
- data/lib/ronin/support/core_ext/enumerable.rb +0 -2
- data/lib/ronin/support/core_ext/file.rb +1 -1
- data/lib/ronin/support/core_ext/kernel.rb +6 -5
- data/lib/ronin/support/core_ext/string.rb +2 -2
- data/lib/ronin/support/crypto/cert.rb +11 -15
- data/lib/ronin/support/crypto/cert_chain.rb +1 -1
- data/lib/ronin/support/crypto/cipher/aes.rb +3 -0
- data/lib/ronin/support/crypto/cipher/aes128.rb +4 -1
- data/lib/ronin/support/crypto/cipher/aes256.rb +4 -1
- data/lib/ronin/support/crypto/cipher.rb +1 -1
- data/lib/ronin/support/crypto/core_ext/file.rb +1 -1
- data/lib/ronin/support/crypto/key/methods.rb +4 -1
- data/lib/ronin/support/crypto/key.rb +5 -2
- data/lib/ronin/support/crypto/openssl.rb +1 -1
- data/lib/ronin/support/crypto.rb +0 -1
- data/lib/ronin/support/encoding/base16.rb +1 -1
- data/lib/ronin/support/encoding/base32.rb +28 -17
- data/lib/ronin/support/encoding/c/core_ext/integer.rb +1 -1
- data/lib/ronin/support/encoding/c.rb +4 -4
- data/lib/ronin/support/encoding/hex.rb +2 -2
- data/lib/ronin/support/encoding/js/core_ext/integer.rb +1 -1
- data/lib/ronin/support/encoding/js.rb +4 -4
- data/lib/ronin/support/encoding/powershell/core_ext/integer.rb +2 -2
- data/lib/ronin/support/encoding/powershell.rb +4 -5
- data/lib/ronin/support/encoding/ruby.rb +4 -4
- data/lib/ronin/support/encoding/shell/core_ext/integer.rb +2 -2
- data/lib/ronin/support/encoding/shell.rb +3 -3
- data/lib/ronin/support/encoding/sql.rb +1 -1
- data/lib/ronin/support/encoding/xml.rb +2 -2
- data/lib/ronin/support/encoding.rb +95 -0
- data/lib/ronin/support/network/asn/list.rb +6 -1
- data/lib/ronin/support/network/asn/record.rb +3 -0
- data/lib/ronin/support/network/asn/record_set.rb +3 -0
- data/lib/ronin/support/network/asn.rb +167 -6
- data/lib/ronin/support/network/dns/resolver.rb +3 -0
- data/lib/ronin/support/network/domain.rb +21 -21
- data/lib/ronin/support/network/email_address.rb +1 -5
- data/lib/ronin/support/network/esmtp/mixin.rb +1 -0
- data/lib/ronin/support/network/ftp/mixin.rb +1 -1
- data/lib/ronin/support/network/host.rb +75 -47
- data/lib/ronin/support/network/http/core_ext.rb +1 -1
- data/lib/ronin/support/network/http.rb +317 -80
- data/lib/ronin/support/network/ip.rb +8 -10
- data/lib/ronin/support/network/ip_range/cidr.rb +1 -5
- data/lib/ronin/support/network/ip_range/glob.rb +1 -0
- data/lib/ronin/support/network/ip_range/range.rb +1 -1
- data/lib/ronin/support/network/ip_range.rb +1 -3
- data/lib/ronin/support/network/proxy.rb +4 -4
- data/lib/ronin/support/network/public_suffix/list.rb +10 -8
- data/lib/ronin/support/network/public_suffix/suffix_set.rb +3 -0
- data/lib/ronin/support/network/public_suffix.rb +9 -4
- data/lib/ronin/support/network/smtp/email.rb +0 -9
- data/lib/ronin/support/network/smtp/mixin.rb +2 -2
- data/lib/ronin/support/network/ssl/local_cert.rb +1 -3
- data/lib/ronin/support/network/ssl/mixin.rb +13 -13
- data/lib/ronin/support/network/ssl/openssl.rb +1 -1
- data/lib/ronin/support/network/ssl/proxy.rb +14 -16
- data/lib/ronin/support/network/ssl.rb +4 -2
- data/lib/ronin/support/network/tcp/proxy.rb +3 -3
- data/lib/ronin/support/network/tcp.rb +10 -12
- data/lib/ronin/support/network/telnet/mixin.rb +14 -14
- data/lib/ronin/support/network/tld/list.rb +2 -1
- data/lib/ronin/support/network/tld.rb +7 -4
- data/lib/ronin/support/network/tls/proxy.rb +1 -1
- data/lib/ronin/support/network/tls.rb +0 -2
- data/lib/ronin/support/network/udp/proxy.rb +5 -5
- data/lib/ronin/support/network/udp.rb +14 -16
- data/lib/ronin/support/path.rb +3 -3
- data/lib/ronin/support/text/erb/mixin.rb +3 -0
- data/lib/ronin/support/text/homoglyph/table.rb +3 -3
- data/lib/ronin/support/text/patterns/credentials.rb +2 -2
- data/lib/ronin/support/text/patterns/crypto.rb +1 -1
- data/lib/ronin/support/text/patterns/file_system.rb +3 -4
- data/lib/ronin/support/text/patterns/network.rb +10 -10
- data/lib/ronin/support/text/patterns/numeric.rb +1 -1
- data/lib/ronin/support/text/patterns/source_code.rb +2 -2
- data/lib/ronin/support/text/random.rb +2 -2
- data/lib/ronin/support/text/typo/generator.rb +2 -2
- data/lib/ronin/support/version.rb +1 -1
- data/ronin-support.gemspec +6 -5
- 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
|
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:
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
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:
|
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
|
-
|
1412
|
-
|
1413
|
-
|
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
|
-
|
1455
|
-
|
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
|
-
|
1498
|
-
|
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
|
-
|
1541
|
-
|
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
|
-
|
1579
|
-
|
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
|
-
|
1617
|
-
|
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
|
-
|
1660
|
-
|
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
|
-
|
1705
|
-
|
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
|
-
|
1750
|
-
|
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
|
-
|
1795
|
-
|
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
|
-
|
1834
|
-
|
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
|
-
|
1872
|
-
|
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
|
-
|
1911
|
-
|
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
|
-
|
1956
|
-
|
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
|
-
|
2001
|
-
|
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
|
-
|
2046
|
-
|
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
|
-
|
2091
|
-
|
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
|
-
|
2136
|
-
|
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
|
-
|
2175
|
-
|
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
|
-
|
2221
|
-
|
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
|
-
|
2266
|
-
|
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
|
-
|
2305
|
-
|
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
|
-
|
2344
|
-
|
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
|
-
|
2389
|
-
|
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
|
-
|
2436
|
-
|
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
|
-
|
2483
|
-
|
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
|
-
|
2528
|
-
|
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
|
-
|
2573
|
-
|
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,
|
@@ -55,10 +55,10 @@ module Ronin
|
|
55
55
|
#
|
56
56
|
# ip.asn
|
57
57
|
# # => #<Ronin::Support::Network::ASN::DNSRecord:0x00007f34142de598
|
58
|
-
#
|
59
|
-
#
|
60
|
-
#
|
61
|
-
#
|
58
|
+
# # @country_code="US",
|
59
|
+
# # @name=nil,
|
60
|
+
# # @number=15133,
|
61
|
+
# # @range=#<Ronin::Support::Network::IPRange::CIDR: 93.184.216.0/24>>
|
62
62
|
#
|
63
63
|
# @api public
|
64
64
|
#
|
@@ -99,7 +99,7 @@ module Ronin
|
|
99
99
|
|
100
100
|
begin
|
101
101
|
super(address,family)
|
102
|
-
rescue IPAddr::InvalidAddressError
|
102
|
+
rescue IPAddr::InvalidAddressError
|
103
103
|
raise(InvalidIP,"invalid IP address: #{address.inspect}")
|
104
104
|
end
|
105
105
|
|
@@ -122,6 +122,7 @@ module Ronin
|
|
122
122
|
response = begin
|
123
123
|
Net::HTTP.get_response(IPINFO_URI)
|
124
124
|
rescue
|
125
|
+
# ignore any network failures
|
125
126
|
end
|
126
127
|
|
127
128
|
if response && response.code == '200'
|
@@ -230,7 +231,7 @@ module Ronin
|
|
230
231
|
# IPAddr.extract(text,:v4) do |ip|
|
231
232
|
# puts ip
|
232
233
|
# end
|
233
|
-
#
|
234
|
+
#
|
234
235
|
def self.extract(text,version=nil,&block)
|
235
236
|
return enum_for(__method__,text,version).to_a unless block_given?
|
236
237
|
|
@@ -240,10 +241,7 @@ module Ronin
|
|
240
241
|
else Text::Patterns::IP_ADDR
|
241
242
|
end
|
242
243
|
|
243
|
-
text.scan(regexp)
|
244
|
-
yield match
|
245
|
-
end
|
246
|
-
|
244
|
+
text.scan(regexp,&block)
|
247
245
|
return nil
|
248
246
|
end
|
249
247
|
|