diff --git a/Rakefile b/Rakefile index ed55af9..babbf91 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,8 @@ require 'rbconfig' require 'fileutils' require 'find' +require 'open3' +require 'pathname' require 'pp' task :default => :help @@ -94,6 +96,15 @@ task :unpack do } } + File.open("payload.txt") do |f| + f.each_line do |i| + i.chomp! + if File.exist? i + File.unlink "#{LATEST_DIR}/#{i}" + puts "removed: #{i}" + end + end + end end task :index => :index_codesearch @@ -132,13 +143,25 @@ def fix_permission(dir) } end +RB_EXT_NAMES = %w(.rb .ru .gemspec .rake .cmd .gemfile .thor) +C_EXT_NAMES = %w(.c .h .cpp .hpp) def clean_files(dir) return unless File.exist? dir Find.find(dir) {|fn| st = File.lstat(fn) if st.file? - if fn.end_with?('.ri') + if C_EXT_NAMES.any?{|ext| fn.end_with?(ext)} + next + elsif !(RB_EXT_NAMES.any?{|ext| fn.end_with?(ext)} || Pathname(fn).extname.empty?) File.unlink fn + puts "removed: #{fn}" + next + else + _, _, _, wait_thr = *Open3.popen3("ruby -c #{fn}") + if wait_thr.value.exitstatus != 0 + File.unlink fn + puts "removed: #{fn}" + end end end } diff --git a/payload.txt b/payload.txt new file mode 100644 index 0000000..2f98ba0 --- /dev/null +++ b/payload.txt @@ -0,0 +1,12 @@ +EICAR-0.0.6/bin/eicar.com +clamd-1.0.1/spec/fixtures/virus +clamrb-0.0.3/test/files/eicar.txt +clamav-0.4.1/spec/clamav-testfiles/eicar.com +clamav-0.4.1/spec/clamav-testfiles/test.txt +metasploit-payloads-1.3.60/data/java/metasploit/RMILoader.class +meterpreter_bins-0.0.22/meterpreter/metsrv.x64.dll +meterpreter_bins-0.0.22/meterpreter/ext_server_priv.x86.dll +metasploit-payloads-1.3.60/data/java/metasploit/Payload.class +warp-clamav-0.3.1/spec/clamav-testfiles/eicar.com +warp-clamav-0.3.1/spec/clamav-testfiles/test.txt +video_to_ascii-0.0.3/bin/wacaw