Skip to content

Commit c2c1ca7

Browse files
committed
v0.3.1
1 parent 568ca3f commit c2c1ca7

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

main.rb

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
# frozen_string_literal: true
12
require 'sys/proctable'
23

3-
procs = Sys::ProcTable.ps()
4+
procs = Sys::ProcTable.ps
45

5-
print "Do you want to save the log file? (Y/N): "
6+
print 'Do you want to save the log file? (Y/N): '
67
save_log = gets.chomp.downcase == 'y'
78

89
if save_log
10+
puts 'This process might take a minute or so. Please wait...'
911
log_file_path = File.join(File.expand_path('~/Desktop'), 'processes.log')
1012
File.open(log_file_path, 'w') do |f|
1113
procs.each do |p|
@@ -16,11 +18,21 @@
1618
f.write("Port(s) used: #{ports}\n")
1719

1820
f.write("---------------------\n")
19-
puts "Done"
2021
end
2122
end
2223

2324
puts "Log file saved to #{log_file_path}"
2425
else
25-
puts "Log not saved"
26+
puts 'Log not saved'
2627
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

0 commit comments

Comments
 (0)