Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
beefproject
GitHub Repository: beefproject/beef
Path: blob/master/tools/csrf_to_beef/lib/output.rb
1154 views
1
#
2
# @note Add color to String object
3
#
4
class String
5
def colorize(color_code)
6
"\e[#{color_code}m#{self}\e[0m"
7
end
8
9
{:red => 31,
10
:green => 32,
11
:yellow => 33,
12
:blue => 34,
13
:pink => 35,
14
:cyan => 36,
15
:white => 37
16
}.each { |color, code|
17
define_method(color) { colorize(code) }
18
}
19
end
20
21
#
22
# @note handle output
23
#
24
def print_status(msg='')
25
puts '[*] '.blue + msg
26
end
27
28
def print_error(msg='')
29
puts '[!] '.red + "Error: #{msg}"
30
end
31
32
def print_good(msg='')
33
puts '[+] '.green + msg
34
end
35
36
def print_warning(msg='')
37
puts '[!] '.yellow + "Warning: #{msg}"
38
end
39
40
def print_debug(msg='')
41
puts "#{msg}" if $VERBOSE
42
end
43
44
45