rex-text 0.2.22 → 0.2.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/rex/text/color.rb +1 -1
- data/lib/rex/text/lang.rb +9 -1
- data/lib/rex/text/table.rb +39 -6
- data/lib/rex/text/version.rb +1 -1
- metadata +79 -74
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 322c668b2627c7abeb1d4d7cfa032e4db2ee9268cbc968ff99184b41a0dbb5cc
|
4
|
+
data.tar.gz: 1aa3470e473545171ae3753f6335e982132a653bff9e5ba31aa7bd12cf2c1e72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2508a7436df9f53708d8da0d65b192e13baf2d5c65e143ade82d14bb4767807470d459ab2a26f7e430e7fe72eff513e5cdfdb1603eecd3670733675763d74b6f
|
7
|
+
data.tar.gz: af3211dcadb3312cac7c68ce3d1c5f3d3086f2d1d655fada170d9a408cda91ae54e9a36a1b524d66d95a5be8371135f8822389a04e0740da2763431ab6c42664
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/rex/text/color.rb
CHANGED
@@ -52,7 +52,7 @@ module Color
|
|
52
52
|
def substitute_colors(msg, in_prompt = nil)
|
53
53
|
str = msg.dup
|
54
54
|
pre_color = post_color = ''
|
55
|
-
if (in_prompt)
|
55
|
+
if (in_prompt && supports_color?)
|
56
56
|
pre_color = "\x01" # RL_PROMPT_START_IGNORE
|
57
57
|
post_color = "\x02" # RL_PROMPT_END_IGNORE
|
58
58
|
end
|
data/lib/rex/text/lang.rb
CHANGED
@@ -63,7 +63,7 @@ module Rex
|
|
63
63
|
# Converts a raw string into a python buffer
|
64
64
|
#
|
65
65
|
def self.to_python(str, wrap = DefaultWrap, name = "buf")
|
66
|
-
return hexify(str, wrap, "#{name} += \"", '"', "#{name} = \"\"\n", '"')
|
66
|
+
return hexify(str, wrap, "#{name} += b\"", '"', "#{name} = b\"\"\n", '"')
|
67
67
|
end
|
68
68
|
|
69
69
|
#
|
@@ -152,5 +152,13 @@ module Rex
|
|
152
152
|
return wordwrap(str, 0, wrap, '', '# ')
|
153
153
|
end
|
154
154
|
|
155
|
+
#
|
156
|
+
# Creates a psh-style comment
|
157
|
+
#
|
158
|
+
def self.to_psh_comment(str, wrap = DefaultWrap)
|
159
|
+
return wordwrap(str, 0, wrap, '', '# ')
|
160
|
+
end
|
161
|
+
|
162
|
+
|
155
163
|
end
|
156
164
|
end
|
data/lib/rex/text/table.rb
CHANGED
@@ -57,6 +57,10 @@ class Table
|
|
57
57
|
#
|
58
58
|
# The column to sort the table on, -1 disables sorting.
|
59
59
|
#
|
60
|
+
# ColProps
|
61
|
+
#
|
62
|
+
# A hash specifying column MaxWidth, Stylers, and Formatters.
|
63
|
+
#
|
60
64
|
def initialize(opts = {})
|
61
65
|
self.header = opts['Header']
|
62
66
|
self.headeri = opts['HeaderIndent'] || 0
|
@@ -79,6 +83,8 @@ class Table
|
|
79
83
|
self.columns.length.times { |idx|
|
80
84
|
self.colprops[idx] = {}
|
81
85
|
self.colprops[idx]['MaxWidth'] = self.columns[idx].length
|
86
|
+
self.colprops[idx]['Stylers'] = []
|
87
|
+
self.colprops[idx]['Formatters'] = []
|
82
88
|
}
|
83
89
|
|
84
90
|
# ensure all our internal state gets updated with the given rows by
|
@@ -172,16 +178,19 @@ class Table
|
|
172
178
|
if fields.length != self.columns.length
|
173
179
|
raise RuntimeError, 'Invalid number of columns!'
|
174
180
|
end
|
175
|
-
fields.
|
181
|
+
formatted_fields = fields.map.with_index { |field, idx|
|
176
182
|
# Remove whitespace and ensure String format
|
177
|
-
field = field.to_s.strip
|
183
|
+
field = format_table_field(field.to_s.strip, idx)
|
184
|
+
|
178
185
|
if (colprops[idx]['MaxWidth'] < field.to_s.length)
|
179
186
|
old = colprops[idx]['MaxWidth']
|
180
187
|
colprops[idx]['MaxWidth'] = field.to_s.length
|
181
188
|
end
|
189
|
+
|
190
|
+
field
|
182
191
|
}
|
183
192
|
|
184
|
-
rows <<
|
193
|
+
rows << formatted_fields
|
185
194
|
end
|
186
195
|
|
187
196
|
def ip_cmp(a, b)
|
@@ -389,9 +398,9 @@ protected
|
|
389
398
|
# Limit wide cells
|
390
399
|
if colprops[idx]['MaxChar']
|
391
400
|
last_cell = cell.to_s[0..colprops[idx]['MaxChar'].to_i]
|
392
|
-
line << last_cell
|
401
|
+
line << style_table_field(last_cell, idx)
|
393
402
|
else
|
394
|
-
line << cell.to_s
|
403
|
+
line << style_table_field(cell.to_s, idx)
|
395
404
|
last_cell = cell
|
396
405
|
end
|
397
406
|
last_idx = idx
|
@@ -414,7 +423,12 @@ protected
|
|
414
423
|
__method__.to_s << ': String with unsupported encoding caught!'
|
415
424
|
end
|
416
425
|
utf8_buf = buf.dup.force_encoding("UTF-8")
|
417
|
-
|
426
|
+
if !utf8_buf.valid_encoding?
|
427
|
+
hans_size = 0
|
428
|
+
else
|
429
|
+
hans_size = utf8_buf.size - utf8_buf.gsub(/\p{Han}+/u, '').size
|
430
|
+
end
|
431
|
+
remainder = max - utf8_buf.length - hans_size
|
418
432
|
remainder = 0 if remainder < 0
|
419
433
|
val = chr * remainder
|
420
434
|
|
@@ -425,6 +439,25 @@ protected
|
|
425
439
|
return val
|
426
440
|
end
|
427
441
|
|
442
|
+
def format_table_field(str, idx)
|
443
|
+
str_cp = str.clone
|
444
|
+
|
445
|
+
colprops[idx]['Formatters'].each do |f|
|
446
|
+
str_cp = f.format(str_cp)
|
447
|
+
end
|
448
|
+
|
449
|
+
str_cp
|
450
|
+
end
|
451
|
+
|
452
|
+
def style_table_field(str, idx)
|
453
|
+
str_cp = str.clone
|
454
|
+
|
455
|
+
colprops[idx]['Stylers'].each do |s|
|
456
|
+
str_cp = s.style(str_cp)
|
457
|
+
end
|
458
|
+
|
459
|
+
str_cp
|
460
|
+
end
|
428
461
|
|
429
462
|
end
|
430
463
|
|
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.27
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David 'thelightcosine' Maloney
|
@@ -10,85 +10,90 @@ bindir: exe
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
13
|
+
MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBl
|
14
|
+
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
|
15
|
+
d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJv
|
16
|
+
b3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzExMTEwMDAwMDAwWjBlMQswCQYDVQQG
|
17
|
+
EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNl
|
18
|
+
cnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwggEi
|
19
|
+
MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7c
|
20
|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N1zeYDFS2ozAp
|
91
|
+
sljF/g68Y1eYs3NaFf7kQUa6vb6RdjW3J8M9AQ8gthBt7gr/guVxd/gJUYbdDdBX
|
92
|
+
cWfJJi/X7GVBOBmmvA43qoKideuhOBrVGBHvIF/yO9p23dIiUrGmW9kxXCSxgute
|
93
|
+
JI/W23RbIRksG2pioMhd4dCXq3FLLlkOV1YfCwWixNB+iIhQPPZVaPNfgPhCn4Dt
|
94
|
+
DeGjje/qA4fkLtRmOtb9PUBq3ToRDE4=
|
90
95
|
-----END CERTIFICATE-----
|
91
|
-
date:
|
96
|
+
date: 2020-07-13 00:00:00.000000000 Z
|
92
97
|
dependencies:
|
93
98
|
- !ruby/object:Gem::Dependency
|
94
99
|
name: bundler
|
@@ -193,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
193
198
|
version: '0'
|
194
199
|
requirements: []
|
195
200
|
rubyforge_project:
|
196
|
-
rubygems_version: 2.
|
201
|
+
rubygems_version: 2.7.10
|
197
202
|
signing_key:
|
198
203
|
specification_version: 4
|
199
204
|
summary: Provides Text Manipulation Methods for Exploitation
|
metadata.gz.sig
CHANGED
Binary file
|