Skip to content

Commit 9887ca9

Browse files
authored
Updated for work with background sessions
Otherwise error like: [e(0)] meterpreter: Error running command upload: NoMethodError undefined method `print_status' for nil:NilClass
1 parent 9d0ada9 commit 9887ca9

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

scripts/meterpreter/multi_console_command.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
# Setting Arguments
1818
@@exec_opts = Rex::Parser::Arguments.new(
1919
"-h" => [ false,"Help menu." ],
20+
"-sl" => [ false,"Hide commands output for work in background sessions"],
2021
"-cl" => [ true,"Commands to execute. The command must be enclosed in double quotes and separated by a comma."],
2122
"-rc" => [ true,"Text file with list of commands, one per line."]
2223
)
@@ -25,6 +26,7 @@
2526
commands = nil
2627
script = []
2728
help = 0
29+
silence = 0
2830

2931
################## Function Declarations ##################
3032
# Function for running a list of commands stored in a array, returs string
@@ -36,7 +38,16 @@ def list_con_exec(cmdlst)
3638
next if cmd[0,1] == "#"
3739
begin
3840
print_status "\tRunning command #{cmd}"
41+
if silence == 1
42+
@client.console.disable_output = true
43+
end
44+
3945
@client.console.run_single(cmd)
46+
47+
if silence == 1
48+
@client.console.disable_output = false
49+
end
50+
4051
rescue ::Exception => e
4152
print_status("Error Running Command #{cmd}: #{e.class} #{e}")
4253
end
@@ -69,6 +80,8 @@ def usage
6980

7081
when "-h"
7182
help = 1
83+
when "-sl"
84+
silence = 1
7285
end
7386
}
7487

0 commit comments

Comments
 (0)