Author Topic: Search MDL From the Firefox Searchbar  (Read 5129 times)

0 Members and 1 Guest are viewing this topic.

March 15, 2008, 12:37:15 am
Read 5129 times

Drusepth

  • Special Members
  • Full Member

  • Offline
  • *

  • 57
  • Personal Text
    Drusepth
    • Drusepth.net
I wrote this for myself a few days back, right before my laptop went down.  Unfortunately, my laptop died right before I had a stable internet connection, so I couldn't test it.  If anyone's on a linux distro, it may be interesting to try out.  If you're not on Ubuntu, you may have to change the file locations to where your files are actually at. :)

Quote from: Readme.txt
HOW TO USE THESE FILES:
   Because this is a linux-only installation, it'll be assumed that
   perl is installed and running on your computer.  To verify, open
   up a terminal and type the command "perl --version".  If perl is
   installed, this will return the version that is currently running.
   
   After verifying that perl is installed on the system, open up the
   terminal (or use the same one you just used) and navigate to the
   directory you extracted the compressed archive to.

   To install, simply type "perl install.pl" into the terminal.

   Everything else is done for you.  If you ever mess up something and
   it stops working, you can simply run install.pl again and it'll
   replace what you have with a fresh install. 

Before running it, however, save the following image as "mdl.gif" to where you're going to be running it from:


Here's install.pl:
Code: [Select]
#!/usr/bin/perl
# Malware Domain List Firefox Search Plugin Installation Script
# by Drusepth
# Tested under Ubuntu

# This script, when run, will install the Firefox Search Plugin for
# Malware Domain List, allowing the search of the MDL at the click
# of a button.

use strict;
use warnings;

# Depending on your distribution, you may need to change the following
# variables to point to different locations.
my $plugins_folder = '/usr/share/firefox/searchplugins';

my @src =
('<search',
"\tname=\"Malware Domain List\"",
"\tdescription=\"Look up a domain on the MDL\"",
"\taction=\"http://malwaredomainlist.com/mdl.php\"",
"\tsearchForm=\"http://www.malwaredomainlist.com\"",
"\tqueryEncoding=\"utf-8\"",
"\tmethod=\"GET\"",
'>',
'<input name="search" user="">',
'<input name="colsearch" value="All">',
'<input name="quantity" value="50">',
'</search>'
);

print "Making sure firefox is installed...";
if (-e $plugins_folder) {
print "yes\n";
} else {
die "no\n";
}

print "Making sure mdl.gif is in this directory...";
if (-e 'mdl.gif') {
print "yes\n";
} else {
print "no\n";
print "* No image will be used.\n";
}

open (SRC, ">$plugins_folder/mdl.src") || die "Cannot open $plugins_folder/mdl.src for writing:\n'$!'.\nCheck to make sure you're running this script as root,\nbecause usually this folder is protected.\n";
foreach my $line (@src) {
print SRC "$line\n";
}
close SRC;

`cp ./mdl.gif $plugins_folder/mdl.gif` or print "* Couldn't copy mdl.gif to $plugins_folder. $!\n";

print "\nSearch Plugin successfully installed.\nYou will need to restart firefox for it to come into effect.\n";

Please mention any problems you have with it to me so I can fix it.

Edit: Had a friend test it with an internet connection (on Kubuntu), and it works like a charm!  :D
Edit: Has also been tested on Ubuntu, and works fine.