teuton 2.10.0 → 2.10.1
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 40bf9c2ba6d8db7f1481cd0f02714d986cf90841222564554c1e58f44f7d0d17
|
|
4
|
+
data.tar.gz: bcfbc64a4ad617a1a451a2ce807ebefb5ef7ecb57ffd34d9219cd738ed793115
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 061b1cf57432c02bba212bb103e49b473f3b3cbbfbc6c9bae269226204390dac302bccafb0995a66b1b8be5d572b9bb5b3bbac4c4ebbe3aa22e6adfa799c1688
|
|
7
|
+
data.tar.gz: 6a5d290e882a17421f8921bf61dd01fa0f6adb4e85ade68890a272089aa1f9bef0bbf48a6101dcddc4b2692e571aa327cdc98df424170783750d771a11c86036
|
data/lib/teuton/case/dsl/send.rb
CHANGED
|
@@ -32,7 +32,8 @@ module DSL
|
|
|
32
32
|
Net::SFTP.start(ip, username, password: password, port: port) do |sftp|
|
|
33
33
|
sftp.upload!(localfilepath, remotefilepath)
|
|
34
34
|
end
|
|
35
|
-
msg = Rainbow("==> [ OK ] Case #{get(:tt_members)}: report (#{remotefilepath}) copy to (#{ip})").green
|
|
35
|
+
# msg = Rainbow("==> [ OK ] Case #{get(:tt_members)}: report (#{remotefilepath}) copy to (#{ip})").green
|
|
36
|
+
msg = "==> [ OK ] Case #{get(:tt_members)}: report (#{remotefilepath}) copy to (#{ip})"
|
|
36
37
|
verboseln(msg)
|
|
37
38
|
logfile.write "#{msg}\n"
|
|
38
39
|
logfile.flush
|
|
@@ -20,13 +20,14 @@ class SendManager
|
|
|
20
20
|
threads.each(&:join)
|
|
21
21
|
|
|
22
22
|
write("Finished!", :green)
|
|
23
|
-
puts
|
|
23
|
+
puts "-" * 70
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
private
|
|
27
27
|
|
|
28
28
|
def write(msg, color)
|
|
29
|
-
puts Rainbow(msg).color(color)
|
|
29
|
+
# puts Rainbow(msg).color(color)
|
|
30
|
+
puts msg
|
|
30
31
|
@logfile.write "#{msg}\n"
|
|
31
32
|
@logfile.flush
|
|
32
33
|
end
|
|
@@ -3,17 +3,14 @@ require "rainbow"
|
|
|
3
3
|
require_relative "array"
|
|
4
4
|
|
|
5
5
|
class TXTFormatter < ArrayFormatter
|
|
6
|
-
def initialize(report,
|
|
7
|
-
@
|
|
6
|
+
def initialize(report, colorize = false)
|
|
7
|
+
@colorize = colorize
|
|
8
8
|
super(report)
|
|
9
9
|
@ext = "txt"
|
|
10
10
|
@data = {}
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
def process(options = {})
|
|
14
|
-
rainbow_state = Rainbow.enabled
|
|
15
|
-
Rainbow.enabled = @color
|
|
16
|
-
|
|
17
14
|
build_data(options)
|
|
18
15
|
process_config
|
|
19
16
|
process_logs
|
|
@@ -21,36 +18,36 @@ class TXTFormatter < ArrayFormatter
|
|
|
21
18
|
process_results
|
|
22
19
|
process_hof
|
|
23
20
|
deinit
|
|
24
|
-
|
|
25
|
-
Rainbow.enabled = rainbow_state
|
|
26
21
|
end
|
|
27
22
|
|
|
28
23
|
private
|
|
29
24
|
|
|
30
25
|
def process_config
|
|
31
|
-
w "#{
|
|
26
|
+
w "#{colorize("CONFIGURATION", :bg_blue)}\n"
|
|
32
27
|
my_screen_table = Terminal::Table.new do |st|
|
|
33
|
-
@data[:config].sort.each
|
|
28
|
+
@data[:config].sort.each do |key, value|
|
|
29
|
+
st.add_row [key.to_s, value.to_s]
|
|
30
|
+
end
|
|
34
31
|
end
|
|
35
32
|
w "#{my_screen_table}\n\n"
|
|
36
33
|
end
|
|
37
34
|
|
|
38
35
|
def process_logs
|
|
39
|
-
return if @data[:logs].
|
|
36
|
+
return if @data[:logs].empty?
|
|
40
37
|
|
|
41
|
-
w "#{
|
|
38
|
+
w "#{colorize("LOGS", :bg_blue)}\n"
|
|
42
39
|
@data[:logs].each { |line| w " #{line}\n" }
|
|
43
40
|
end
|
|
44
41
|
|
|
45
42
|
def process_groups
|
|
46
|
-
return if @data[:groups].
|
|
43
|
+
return if @data[:groups].empty?
|
|
47
44
|
|
|
48
|
-
w "\n#{
|
|
45
|
+
w "\n#{colorize("GROUPS", :bg_blue)}\n"
|
|
49
46
|
@data[:groups].each { |g| process_group g }
|
|
50
47
|
end
|
|
51
48
|
|
|
52
49
|
def process_results
|
|
53
|
-
w "\n#{
|
|
50
|
+
w "\n#{colorize("RESULTS", :bg_blue)}\n"
|
|
54
51
|
my_screen_table = Terminal::Table.new do |st|
|
|
55
52
|
@data[:results].each do |key, value|
|
|
56
53
|
st.add_row [key.to_s, value.to_s]
|
|
@@ -62,16 +59,16 @@ class TXTFormatter < ArrayFormatter
|
|
|
62
59
|
def process_hof
|
|
63
60
|
return if @data[:hall_of_fame].size < 3
|
|
64
61
|
|
|
65
|
-
w "\n#{
|
|
62
|
+
w "\n#{colorize("HALL OF FAME", :bg_blue)}\n"
|
|
66
63
|
my_screen_table = Terminal::Table.new do |st|
|
|
67
64
|
@data[:hall_of_fame].each do |line|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
text1 =
|
|
71
|
-
text2 =
|
|
65
|
+
color = :green
|
|
66
|
+
color = :red if line[0] < 50
|
|
67
|
+
text1 = colorize(line[0], color)
|
|
68
|
+
text2 = colorize(line[1], color)
|
|
72
69
|
if line[0] == @data[:results][:grade]
|
|
73
|
-
text1 = text1
|
|
74
|
-
text2 = text2
|
|
70
|
+
text1 = colorize(text1, :bright)
|
|
71
|
+
text2 = colorize(text2, :bright)
|
|
75
72
|
end
|
|
76
73
|
st.add_row [text1, text2]
|
|
77
74
|
end
|
|
@@ -83,12 +80,13 @@ class TXTFormatter < ArrayFormatter
|
|
|
83
80
|
|
|
84
81
|
def process_group(group)
|
|
85
82
|
tab = " "
|
|
86
|
-
w "- #{
|
|
83
|
+
w "- #{colorize(group[:title], :blue_bright)}\n"
|
|
87
84
|
group[:targets].each do |i|
|
|
88
85
|
color = :red
|
|
89
86
|
color = :green if i[:check]
|
|
90
87
|
w tab * 2 + format("%02d", i[:target_id].to_i)
|
|
91
|
-
|
|
88
|
+
text = "#{i[:score]}/#{i[:weight]}"
|
|
89
|
+
w " (#{colorize(text, color)})\n"
|
|
92
90
|
w "#{tab * 4}Description : #{i[:description]}\n"
|
|
93
91
|
w "#{tab * 4}Command : #{i[:command]}\n"
|
|
94
92
|
w "#{tab * 4}Output : #{i[:output]}\n"
|
|
@@ -98,4 +96,24 @@ class TXTFormatter < ArrayFormatter
|
|
|
98
96
|
w "#{tab * 4}Result : #{i[:result]}\n"
|
|
99
97
|
end
|
|
100
98
|
end
|
|
99
|
+
|
|
100
|
+
def colorize(text, option)
|
|
101
|
+
return text unless @colorize
|
|
102
|
+
|
|
103
|
+
case option
|
|
104
|
+
when :bg_blue
|
|
105
|
+
Rainbow(text).bg(:blue)
|
|
106
|
+
when :blue_bright
|
|
107
|
+
Rainbow(text).blue.bright
|
|
108
|
+
when :bright
|
|
109
|
+
Rainbow(text).bright
|
|
110
|
+
when :green
|
|
111
|
+
Rainbow(text).color(:green)
|
|
112
|
+
when :red
|
|
113
|
+
Rainbow(text).color(:red)
|
|
114
|
+
else
|
|
115
|
+
puts option
|
|
116
|
+
exit 1
|
|
117
|
+
end
|
|
118
|
+
end
|
|
101
119
|
end
|
|
@@ -16,8 +16,8 @@ module Formatter
|
|
|
16
16
|
def self.call(report, options, filename)
|
|
17
17
|
klass = get(options[:format])
|
|
18
18
|
if klass.nil?
|
|
19
|
-
puts
|
|
20
|
-
puts
|
|
19
|
+
puts "[ERROR] Unkown format <#{options[:format]}>. Fix line <export format: FORMAT>"
|
|
20
|
+
puts " Available format values: colored_text, html, json, txt, or yaml"
|
|
21
21
|
exit 1
|
|
22
22
|
end
|
|
23
23
|
formatter = klass.new(report)
|
data/lib/teuton/version.rb
CHANGED