sample/trojan.rb


DEFINITIONS

This source file includes following functions.


   1  #! /usr/local/bin/ruby
   2  
   3  path = ENV['PATH'].split(File::PATH_SEPARATOR)
   4  
   5  for dir in path
   6    if File.directory?(dir)
   7      for f in d = Dir.open(dir)
   8        fpath = dir+"/"+f  
   9        if File.file?(fpath) && (File.stat(fpath).mode & 022) != 0
  10          printf("file %s is writable from other users\n", fpath)
  11        end
  12      end
  13      d.close
  14    end
  15  end