ronin-support 1.1.0.rc1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d15d23b8552e6551cdacb0b4611738b1998a5b1507d9b58090dbf00554f3e00a
4
- data.tar.gz: 4c173c62b7ab356d5ecb8f33fe729d79270cbfdb9341e0ab9c854d7c1724e94e
3
+ metadata.gz: 7f1b0e8bacb6f9b93bb734ed99c62d494589eba2032a0e491a5ebc45e253b50e
4
+ data.tar.gz: ac354bfbfdf4b33bd3ee5780b9cf2d35ccd8f18d0df8d6b86229bc851f7edbc4
5
5
  SHA512:
6
- metadata.gz: 6b4df538d171d0173c1ccf666829fc16bc66ea68fe91f5b937be32d9641c64bd02daf2bb0dfc4af0a01bae33147b2934dfacfff2eba219643efeadb166ac5a42
7
- data.tar.gz: ab1651185a3f8580f0ffb30bcbc394e9e047f1954746f4b479a221ba88aedb527770bff85ecb9816f66e6ba74a4810c20a2bc5f0c9641c1954861bf4e8712660
6
+ metadata.gz: 1697424078c60509675c973d68f527963a0d93b4a69bb3c5d7bd729fc4e26792095bdc618caee10c91e829318ba44e6fd6cf4a0855ef0cdf973cf11fa67eef2a
7
+ data.tar.gz: 854e36a7f5d30a274c0fdc3be39d12223327a51f092e54103ea6c87057ca0b38dcb355d3a6c36a7cc32be50dbf81323f5c59ff56de5451bf6670957e1635e188
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-3.1
1
+ ruby-3.3
data/ChangeLog.md CHANGED
@@ -1,4 +1,4 @@
1
- ### 1.1.0 / 2024-XX-XX
1
+ ### 1.1.0 / 2024-07-22
2
2
 
3
3
  * Added {Ronin::Support::Binary::CTypes::OS::Android}.
4
4
  * Added {Ronin::Support::Binary::CTypes::OS::AppleIOS}.
@@ -109,6 +109,15 @@
109
109
  {Ronin::Support::Network::HTTP}, and
110
110
  {Ronin::Support::Network::HTTP::Mixin} methods.
111
111
 
112
+ ### 1.0.7 / 2024-07-13
113
+
114
+ * Improved the performance of {Ronin::Support::Encoding::JS.unescape} and
115
+ {String#js_unescape} by 2x.
116
+ * Correctly parse Unicode surrogate character pairs in JavaScript
117
+ strings (ex: `"\uD83D\uDE80"`) in {Ronin::Support::Encoding::JS.unescape},
118
+ {String#js_unescape}, {Ronin::Support::Encoding::JS.unquote}, and
119
+ {String#js_unquote}.
120
+
112
121
  ### 1.0.6 / 2024-06-19
113
122
 
114
123
  * Fixed error messages in {Ronin::Support::Encoding::Base64.encode} and
@@ -183,16 +183,22 @@ module Ronin
183
183
  #
184
184
  def self.unescape(data)
185
185
  unescaped = String.new(encoding: Encoding::UTF_8)
186
+ scanner = StringScanner.new(data)
186
187
 
187
- data.scan(/[\\%]u[0-9a-fA-F]{1,4}|[\\%][0-9a-fA-F]{1,2}|\\[btnfr\'\"\\]|./) do |c|
188
- unescaped << BACKSLASHED_CHARS.fetch(c) do
189
- if (c.start_with?("\\u") || c.start_with?("%u"))
190
- c[2..].to_i(16)
191
- elsif (c.start_with?("\\") || c.start_with?("%"))
192
- c[1..].to_i(16)
193
- else
194
- c
195
- end
188
+ until scanner.eos?
189
+ unescaped << if (backslash_escape = scanner.scan(/\\[btnfr'"\\]/))
190
+ BACKSLASHED_CHARS[backslash_escape]
191
+ elsif (surrogate_pair = scanner.scan(/\\u[dD][890abAB][0-9a-fA-F]{2}\\u[dD][cdefCDEF][0-9a-fA-F]{2}/))
192
+ hi = surrogate_pair[2..6].to_i(16)
193
+ lo = surrogate_pair[8..12].to_i(16)
194
+
195
+ (0x1_0000 + ((hi - 0xd800) * 0x400) + (lo - 0xdc00))
196
+ elsif (unicode_escape = scanner.scan(/[\\%]u[0-9a-fA-F]{1,4}/))
197
+ unicode_escape[2..].to_i(16)
198
+ elsif (hex_escape = scanner.scan(/[\\%][0-9a-fA-F]{1,2}/))
199
+ hex_escape[1..].to_i(16)
200
+ else
201
+ scanner.getch
196
202
  end
197
203
  end
198
204
 
@@ -19,6 +19,6 @@
19
19
  module Ronin
20
20
  module Support
21
21
  # ronin-support version
22
- VERSION = '1.1.0.rc1'
22
+ VERSION = '1.1.0'
23
23
  end
24
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ronin-support
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0.rc1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Postmodern
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-23 00:00:00.000000000 Z
11
+ date: 2024-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chars
@@ -481,7 +481,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
481
481
  - !ruby/object:Gem::Version
482
482
  version: '0'
483
483
  requirements: []
484
- rubygems_version: 3.3.27
484
+ rubygems_version: 3.5.11
485
485
  signing_key:
486
486
  specification_version: 4
487
487
  summary: A support library for ronin-rb.