rex-text 0.2.10 → 0.2.11
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.tar.gz.sig +0 -0
- data/lib/rex/text/badchars.rb +1 -1
- data/lib/rex/text/binary_manipulation.rb +2 -2
- data/lib/rex/text/block_api.rb +1 -1
- data/lib/rex/text/checksum.rb +5 -5
- data/lib/rex/text/compress.rb +2 -2
- data/lib/rex/text/hex.rb +3 -3
- data/lib/rex/text/pattern.rb +5 -5
- data/lib/rex/text/silly.rb +1 -1
- data/lib/rex/text/version.rb +1 -1
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8849750ccde97e100a88b0eb765bfd064cc695be
|
4
|
+
data.tar.gz: 4b0e04c8bbb6fd428e24f640f477b8f4c5b68c81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdb6ff6f05b44414fdb15c0d6ecc8624af322f3f116ce27baa89935bfe68bfa26448d2f1dc15569cc197d83d15f44657f042bd526b47dafe8d4785c45b80e8b8
|
7
|
+
data.tar.gz: 0bb8053e1d26cc63bfeb4ef9379303f770c93d615fc903c411b3e6fc6ea543b0d5e1e4cf32716c594cad6f5e0b187f6b114f72ecf6dd2f0fb005651fa7e8350c
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/rex/text/badchars.rb
CHANGED
@@ -12,7 +12,7 @@ module Rex
|
|
12
12
|
#
|
13
13
|
# @param data [String] The string to check for bad characters
|
14
14
|
# @param badchars [String] A list of characters considered to be bad
|
15
|
-
# @return [
|
15
|
+
# @return [Integer] Index of the first bad character if any exist in +data+
|
16
16
|
# @return [nil] If +data+ contains no bad characters
|
17
17
|
def self.badchar_index(data, badchars = '')
|
18
18
|
badchars.unpack("C*").each { |badchar|
|
@@ -73,8 +73,8 @@ module Rex
|
|
73
73
|
#
|
74
74
|
# Rotate a 32-bit value to the right by +cnt+ bits
|
75
75
|
#
|
76
|
-
# @param val [
|
77
|
-
# @param cnt [
|
76
|
+
# @param val [Integer] The value to rotate
|
77
|
+
# @param cnt [Integer] Number of bits to rotate by
|
78
78
|
def self.ror(val, cnt)
|
79
79
|
bits = [val].pack("N").unpack("B32")[0].split(//)
|
80
80
|
1.upto(cnt) do |c|
|
data/lib/rex/text/block_api.rb
CHANGED
data/lib/rex/text/checksum.rb
CHANGED
@@ -7,31 +7,31 @@ module Rex
|
|
7
7
|
# without hanging the underlying calls that we historically rely upon.
|
8
8
|
|
9
9
|
# @param str [String] Data to checksum
|
10
|
-
# @return [
|
10
|
+
# @return [Integer] 8-bit checksum
|
11
11
|
def self.checksum8(str)
|
12
12
|
(str.unpack("C*").inject(:+) || 0) % 0x100
|
13
13
|
end
|
14
14
|
|
15
15
|
# @param str [String] Little-endian data to checksum
|
16
|
-
# @return [
|
16
|
+
# @return [Integer] 16-bit checksum
|
17
17
|
def self.checksum16_le(str)
|
18
18
|
(str.unpack("v*").inject(:+) || 0) % 0x10000
|
19
19
|
end
|
20
20
|
|
21
21
|
# @param str [String] Big-endian data to checksum
|
22
|
-
# @return [
|
22
|
+
# @return [Integer] 16-bit checksum
|
23
23
|
def self.checksum16_be(str)
|
24
24
|
(str.unpack("n*").inject(:+) || 0) % 0x10000
|
25
25
|
end
|
26
26
|
|
27
27
|
# @param str [String] Little-endian data to checksum
|
28
|
-
# @return [
|
28
|
+
# @return [Integer] 32-bit checksum
|
29
29
|
def self.checksum32_le(str)
|
30
30
|
(str.unpack("V*").inject(:+) || 0) % 0x100000000
|
31
31
|
end
|
32
32
|
|
33
33
|
# @param str [String] Big-endian data to checksum
|
34
|
-
# @return [
|
34
|
+
# @return [Integer] 32-bit checksum
|
35
35
|
def self.checksum32_be(str)
|
36
36
|
(str.unpack("N*").inject(:+) || 0) % 0x100000000
|
37
37
|
end
|
data/lib/rex/text/compress.rb
CHANGED
@@ -38,7 +38,7 @@ module Rex
|
|
38
38
|
# Compresses a string using zlib
|
39
39
|
#
|
40
40
|
# @param str [String] The string to be compressed
|
41
|
-
# @param level [
|
41
|
+
# @param level [Integer] One of the Zlib compression level constants
|
42
42
|
# @return [String] The compressed version of +str+
|
43
43
|
def self.zlib_deflate(str, level = Zlib::BEST_COMPRESSION)
|
44
44
|
if self.zlib_present?
|
@@ -72,7 +72,7 @@ module Rex
|
|
72
72
|
# Compresses a string using gzip
|
73
73
|
#
|
74
74
|
# @param str (see zlib_deflate)
|
75
|
-
# @param level [
|
75
|
+
# @param level [Integer] Compression level, 1 (fast) to 9 (best)
|
76
76
|
# @return (see zlib_deflate)
|
77
77
|
def self.gzip(str, level = 9)
|
78
78
|
raise RuntimeError, "Gzip support is not present." if (!zlib_present?)
|
data/lib/rex/text/hex.rb
CHANGED
@@ -13,7 +13,7 @@ module Rex
|
|
13
13
|
#
|
14
14
|
# @param str (see to_octal)
|
15
15
|
# @param prefix (see to_octal)
|
16
|
-
# @param count [
|
16
|
+
# @param count [Integer] Number of bytes to put in each escape chunk
|
17
17
|
# @return [String] The escaped hex version of +str+
|
18
18
|
def self.to_hex(str, prefix = "\\x", count = 1)
|
19
19
|
raise ::RuntimeError, "unable to chunk into #{count} byte chunks" if ((str.length % count) > 0)
|
@@ -49,8 +49,8 @@ module Rex
|
|
49
49
|
# Converts a string to a nicely formatted hex dump
|
50
50
|
#
|
51
51
|
# @param str [String] The string to convert
|
52
|
-
# @param width [
|
53
|
-
# @param base [
|
52
|
+
# @param width [Integer] Number of bytes to convert before adding a newline
|
53
|
+
# @param base [Integer] The base address of the dump
|
54
54
|
def self.to_hex_dump(str, width=16, base=nil)
|
55
55
|
buf = ''
|
56
56
|
idx = 0
|
data/lib/rex/text/pattern.rb
CHANGED
@@ -12,7 +12,7 @@ module Rex
|
|
12
12
|
# supplied number of identifiable characters (slots). The supplied sets
|
13
13
|
# should not contain any duplicate characters or the logic will fail.
|
14
14
|
#
|
15
|
-
# @param length [
|
15
|
+
# @param length [Integer]
|
16
16
|
# @param sets [Array<(String,String,String)>] The character sets to choose
|
17
17
|
# from. Should have 3 elements, each of which must be a string containing
|
18
18
|
# no characters contained in the other sets.
|
@@ -66,14 +66,14 @@ module Rex
|
|
66
66
|
#
|
67
67
|
# @param pattern [String] The pattern to search. Usually the return value
|
68
68
|
# from {.pattern_create}
|
69
|
-
# @param value [String,
|
70
|
-
# @return [
|
69
|
+
# @param value [String,Integer]
|
70
|
+
# @return [Integer] Index of the given +value+ within +pattern+, if it exists
|
71
71
|
# @return [nil] if +pattern+ does not contain +value+
|
72
72
|
# @see pattern_create
|
73
73
|
def self.pattern_offset(pattern, value, start=0)
|
74
|
-
if
|
74
|
+
if value.kind_of?(String)
|
75
75
|
pattern.index(value, start)
|
76
|
-
elsif
|
76
|
+
elsif value.kind_of?(Integer)
|
77
77
|
pattern.index([ value ].pack('V'), start)
|
78
78
|
else
|
79
79
|
raise ::ArgumentError, "Invalid class for value: #{value.class}"
|
data/lib/rex/text/silly.rb
CHANGED
@@ -20,7 +20,7 @@ module Rex
|
|
20
20
|
# || ||
|
21
21
|
#
|
22
22
|
# @param text [String] The string to cowsay
|
23
|
-
# @param width [
|
23
|
+
# @param width [Integer] Width of the cow's cloud. Default's to cowsay(1)'s default, 39.
|
24
24
|
def self.cowsay(text, width=39)
|
25
25
|
# cowsay(1) chunks a message up into 39-byte chunks and wraps it in '| ' and ' |'
|
26
26
|
# Rex::Text.wordwrap(text, 0, 39, ' |', '| ') almost does this, but won't
|
data/lib/rex/text/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David 'thelightcosine' Maloney
|
@@ -88,7 +88,7 @@ cert_chain:
|
|
88
88
|
G+Hmcg1v810agasPdoydE0RTVZgEOOMoQ07qu7JFXVWZ9ZQpHT7qJATWL/b2csFG
|
89
89
|
8mVuTXnyJOKRJA==
|
90
90
|
-----END CERTIFICATE-----
|
91
|
-
date:
|
91
|
+
date: 2017-01-18 00:00:00.000000000 Z
|
92
92
|
dependencies:
|
93
93
|
- !ruby/object:Gem::Dependency
|
94
94
|
name: bundler
|
metadata.gz.sig
CHANGED
Binary file
|