rex-text 0.2.44 → 0.2.46
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/rex/text/lang.rb +47 -0
- data/lib/rex/text/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95af94249afe1b19de73e1090346169a280f87a8d3519838983630fb7e1cf69d
|
4
|
+
data.tar.gz: '06227846a02fc5b531e89b8114e17611a474ae231e3913adc1c2de72b53343c6'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da78d18313b0d2c43819df1c2f812fe4e0b90ba8d1b47f8ab8beabe1025014e77c1c4651b9c9e25047bfdd52b7260ac872727dc0dd6d157129ade62d62c86aee
|
7
|
+
data.tar.gz: 92ee63cde2940b9eafe27264087f97210dfdd368754f4c84905c4b941590b0c28083c01b6b5f22d3110de8d9b2bb78f6dd42255432e762af07c95bffb3da215a
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/rex/text/lang.rb
CHANGED
@@ -61,6 +61,53 @@ module Rex
|
|
61
61
|
return "/*\n" + wordwrap(str, 0, wrap, '', '') + "*/\n"
|
62
62
|
end
|
63
63
|
|
64
|
+
#
|
65
|
+
# Converts to a nim style array of bytes
|
66
|
+
#
|
67
|
+
def self.to_nim(str, wrap = DefaultWrap, name = "buf")
|
68
|
+
raise ArgumentError.new('str can not be empty') if str.empty?
|
69
|
+
|
70
|
+
ret = "var #{name}: array[#{str.length}, byte] = [\n"
|
71
|
+
ret << "byte "
|
72
|
+
str.each_char do |char|
|
73
|
+
# "0x##,".length is 5, check if we're going over the wrap boundary
|
74
|
+
ret << "\n" if ret.split("\n").last.length + 5 > wrap
|
75
|
+
ret << "0x" << char.unpack('H*')[0] << ","
|
76
|
+
end
|
77
|
+
ret = ret[0..ret.length - 2] unless str.empty? # cut off last comma
|
78
|
+
ret << "\n" if ret.split("\n").last.length + 1 > wrap
|
79
|
+
ret << "]\n"
|
80
|
+
end
|
81
|
+
|
82
|
+
#
|
83
|
+
# Creates a nim style comment
|
84
|
+
#
|
85
|
+
def self.to_nim_comment(str, wrap = DefaultWrap)
|
86
|
+
return "#[\n" + wordwrap(str, 0, wrap, '', '') + "]#\n"
|
87
|
+
end
|
88
|
+
|
89
|
+
#
|
90
|
+
# Converts to a Rust style array of bytes
|
91
|
+
#
|
92
|
+
def self.to_rust(str, wrap = DefaultWrap, name = "buf")
|
93
|
+
ret = "let #{name}: [u8; #{str.length}] = ["
|
94
|
+
str.each_char do |char|
|
95
|
+
# "0x##,".length is 5, check if we're going over the wrap boundary
|
96
|
+
ret << "\n" if ret.split("\n").last.length + 5 > wrap
|
97
|
+
ret << "0x" << char.unpack('H*')[0] << ","
|
98
|
+
end
|
99
|
+
ret = ret[0..ret.length - 2] unless str.empty? # cut off last comma
|
100
|
+
ret << "\n" if ret.split("\n").last.length + 2 > wrap
|
101
|
+
ret << "];\n"
|
102
|
+
end
|
103
|
+
|
104
|
+
#
|
105
|
+
# Creates a Rust style comment
|
106
|
+
#
|
107
|
+
def self.to_rust_comment(str, wrap = DefaultWrap)
|
108
|
+
return "/*\n" + wordwrap(str, 0, wrap, '', ' * ') + " */\n"
|
109
|
+
end
|
110
|
+
|
64
111
|
#
|
65
112
|
# Creates a c-style comment
|
66
113
|
#
|
data/lib/rex/text/version.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
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.46
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Metasploit Hackers
|
@@ -93,7 +93,7 @@ cert_chain:
|
|
93
93
|
EknWpNgVhohbot1lfVAMmIhdtOVaRVcQQixWPwprDj/ydB8ryDMDosIMcw+fkoXU
|
94
94
|
9GJsSaSRRYQ9UUkVL27b64okU8D48m8=
|
95
95
|
-----END CERTIFICATE-----
|
96
|
-
date: 2022-
|
96
|
+
date: 2022-10-31 00:00:00.000000000 Z
|
97
97
|
dependencies:
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: rake
|
metadata.gz.sig
CHANGED
Binary file
|