rex-text 0.2.61 → 0.2.62
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
- data/lib/rex/text/block_api.rb +11 -8
- data/lib/rex/text/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ff5c4fff124662318b5e72b8b7eb43bc8f4bdb9545699d089450aafa57eab599
|
|
4
|
+
data.tar.gz: d4441d13382bdfb8104687e37ac66ac92ee0545cc581c0b645bbc5069c08bf52
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 47e22f78346f6cc3cd3e102dab705df958c48a907d42ab15c155802ee63c6ff02748a1f73a87581d7c402390a4e67ac7492456db6eb2e48afe5c765eefc650e9
|
|
7
|
+
data.tar.gz: 8664319a14b2933ac154b87d185978caa014ee2c1c07a6cddf8bf6db6896ba192423bd662bb3cb41f838475cd311e5e99beb818689a599a601d4887f76572ec9
|
data/lib/rex/text/block_api.rb
CHANGED
|
@@ -11,22 +11,25 @@ module Rex
|
|
|
11
11
|
#
|
|
12
12
|
# @param mod [String] The name of the module containing the target function.
|
|
13
13
|
# @param fun [String] The name of the function.
|
|
14
|
+
# @param iv [Integer] The 32-bit initialization vector (IV) to use for the hash operation
|
|
14
15
|
#
|
|
15
16
|
# @return [String] The hash of the mod/fun pair in string format
|
|
16
|
-
def self.block_api_hash(mod, func)
|
|
17
|
-
unicode_mod = (mod.upcase
|
|
18
|
-
mod_hash = self.ror13_hash(unicode_mod)
|
|
19
|
-
fun_hash = self.ror13_hash(func + "\x00")
|
|
20
|
-
"0x#{(
|
|
17
|
+
def self.block_api_hash(mod, func, iv: 0)
|
|
18
|
+
unicode_mod = (mod.upcase).unpack('C*').pack('v*')
|
|
19
|
+
mod_hash = self.ror13_hash(unicode_mod, iv: iv)
|
|
20
|
+
fun_hash = self.ror13_hash(func + "\x00", iv: mod_hash)
|
|
21
|
+
"0x#{(fun_hash & 0xFFFFFFFF).to_s(16)}"
|
|
21
22
|
end
|
|
22
23
|
|
|
23
24
|
#
|
|
24
25
|
# Calculate the ROR13 hash of a given string
|
|
26
|
+
# @param string [String] The string to hash
|
|
27
|
+
# @param iv [Integer] The 32-bit initialization vector (IV) to use for the hash operation
|
|
25
28
|
#
|
|
26
29
|
# @return [Integer]
|
|
27
|
-
def self.ror13_hash(
|
|
28
|
-
hash =
|
|
29
|
-
|
|
30
|
+
def self.ror13_hash(string, iv: 0)
|
|
31
|
+
hash = (iv & 0xFFFFFFFF)
|
|
32
|
+
string.unpack("C*").each {|c| hash = ror(hash, 13); hash += c }
|
|
30
33
|
hash
|
|
31
34
|
end
|
|
32
35
|
end
|
data/lib/rex/text/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rex-text
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.62
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Metasploit Hackers
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-04-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|