File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 17
17
# Setting Arguments
18
18
@@exec_opts = Rex ::Parser ::Arguments . new (
19
19
"-h" => [ false , "Help menu." ] ,
20
+ "-sl" => [ false , "Hide commands output for work in background sessions" ] ,
20
21
"-cl" => [ true , "Commands to execute. The command must be enclosed in double quotes and separated by a comma." ] ,
21
22
"-rc" => [ true , "Text file with list of commands, one per line." ]
22
23
)
25
26
commands = nil
26
27
script = [ ]
27
28
help = 0
29
+ silence = 0
28
30
29
31
################## Function Declarations ##################
30
32
# Function for running a list of commands stored in a array, returs string
@@ -36,7 +38,16 @@ def list_con_exec(cmdlst)
36
38
next if cmd [ 0 , 1 ] == "#"
37
39
begin
38
40
print_status "\t Running command #{ cmd } "
41
+ if silence == 1
42
+ @client . console . disable_output = true
43
+ end
44
+
39
45
@client . console . run_single ( cmd )
46
+
47
+ if silence == 1
48
+ @client . console . disable_output = false
49
+ end
50
+
40
51
rescue ::Exception => e
41
52
print_status ( "Error Running Command #{ cmd } : #{ e . class } #{ e } " )
42
53
end
@@ -69,6 +80,8 @@ def usage
69
80
70
81
when "-h"
71
82
help = 1
83
+ when "-sl"
84
+ silence = 1
72
85
end
73
86
}
74
87
You can’t perform that action at this time.
0 commit comments