File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
1
2
require 'sys/proctable'
2
3
3
- procs = Sys ::ProcTable . ps ( )
4
+ procs = Sys ::ProcTable . ps
4
5
5
- print " Do you want to save the log file? (Y/N): "
6
+ print ' Do you want to save the log file? (Y/N): '
6
7
save_log = gets . chomp . downcase == 'y'
7
8
8
9
if save_log
10
+ puts 'This process might take a minute or so. Please wait...'
9
11
log_file_path = File . join ( File . expand_path ( '~/Desktop' ) , 'processes.log' )
10
12
File . open ( log_file_path , 'w' ) do |f |
11
13
procs . each do |p |
16
18
f . write ( "Port(s) used: #{ ports } \n " )
17
19
18
20
f . write ( "---------------------\n " )
19
- puts "Done"
20
21
end
21
22
end
22
23
23
24
puts "Log file saved to #{ log_file_path } "
24
25
else
25
- puts " Log not saved"
26
+ puts ' Log not saved'
26
27
end
28
+
29
+ print 'Do you want to run a ClamAV scan and quarantine any viruses found? (Y/N): '
30
+ run_clamav = gets . chomp . downcase == 'y'
31
+
32
+ if run_clamav
33
+ print 'Please enter your password for sudo: '
34
+ password = gets . chomp
35
+
36
+ puts 'Running ClamAV scan. This might take a while. Please wait...'
37
+ `echo "#{ password } " | sudo -S clamscan --move=/home/user/quarantine -r /`
38
+ end
You can’t perform that action at this time.
0 commit comments