Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/lib/rex/ui/text/output/socket.rb
19591 views
1
# -*- coding: binary -*-
2
3
module Rex
4
module Ui
5
module Text
6
7
###
8
#
9
# This class implements the output interface against a socket.
10
#
11
###
12
class Output::Socket < Rex::Ui::Text::Output
13
14
def initialize(sock)
15
@sock = sock
16
super()
17
end
18
19
def supports_color?
20
case config[:color]
21
when true
22
# Allow color if the user forces it on
23
return true
24
else
25
false
26
end
27
end
28
29
#
30
# Prints the supplied message to the socket.
31
#
32
def print_raw(msg = '')
33
@sock.write(msg)
34
@sock.flush
35
36
msg
37
end
38
end
39
40
end
41
end
42
end
43
44
45