Tuesday, June 29, 2010

Silver Theatre Ottawa

Spamassassin plugin - part 2 How to write

As promised, we are the second and final round of this series.
inform you immediately that simple rules can be written directly into the configuration file. Within the plugin should be made more complex rules or based on data that changes frequently.

First you need to inherit from the base class Plugin
  package Mail:: SpamAssassin:: Plugin:: myPlugin; 
use Mail:: SpamAssassin:: Plugin;
use DBI;
our @ISA = qw(Mail::SpamAssassin::Plugin);

sub new {
my ($class, $mailsa) = @_;

# the usual perlobj boilerplate to create a subclass object
$class = ref($class) At this point we need to put the new rule that we want to introduce into the tool.
In the code snippet above we also important DBI libraries that allow us to query the database with a comfortable Object Model.

Here's an example of implementing a rule-based DB.


sub check_myplugin_header


{my ($ self, $ pms) = @ _;

# Extract informations from desidered
mail header $ head = $ pms-> get ('CustomHeader');

$ result = 0;
study;

chomp ($ head);
$ head = ~ s /;//;

$ dbh = DBI-> connect ("DBI: mysql: spamassassindb", "user", "pass ");
        
if(!defined $dbh)
{
die "Connessione al database non riuscita: $DBI::errstrn";
}

$query = "SELECT count(accepted_headers) FROM headers WHERE accepted_headers = $head";

# Insert query into database instructions
$sth = $dbh->prepare($query);

# Database query execution
$sth->execute;

$count = $sth->fetchrow();


if($count eq 0)
{
# Report error
$result = 1;
}

# Disconnect from database
$dbh->disconnect();

return $result;
}



Questo frammento di codice è piuttosto semplice e fa una query al db, tramite DBI, dopo aver bonificato la stringa da passare.
Una cosa sicuramente da notare è il paramtro $pms che consente di accedere a tutti gli headers della mail.
Forniamo allora questo messaggio


From god@heaven.com Thu Jun 17 21:33:41 2010
Return-Path: <god@heaven.com>
X-Original-To: account@post-server
Delivered-To: account@post-server
Received: from post-server (host [127.0.0.1])
by post-server (Postfix) with SMTP id B66E9424F5
for \u0026lt;account@post-server>; Thu, 30 Jun 2010 21:33:20 +0200 (BST)
CustomHeader: blablabla
Subject: Try this
Simple mail to test my plugin.



to spamassassin and have two different behaviors:
  
If the string "blablabla" is contained in the database, the rule will not add to the points defined in the configuration file (2.0 from the previous post)

If the string " blablabla "is not included then the rule will have a hit that will add 2 points to total score. In the latter case, if this score does exceed the threshold (defined always in the various configuration files) then the message will identified as SPAM!



is a rather vast topic that takes time to be assimilated. This is just one input that wants to stimulate interest. I hope I was clear and are available for on-line help, as I do.

Have fun;)

Sunday, June 27, 2010

Silvercity Phone Brampton Prices

Spamassassin plugin - Part 1 Google

I have come to a good project for a university examination (which will be published once delivered) covering a subject on which I found very little material.
We are talking of writing a plugin to assess a complex rule on an e-mail, to determine whether it is spam or not.
  • It took a long tempo per raggiungere qualcosa di funzionante ma ora che ho fra le mani un po' di codice che gira posso scrivere un articolo come questo e colmare la lacuna che il web mi ha mostrato. (I'll translate this article soon for international usage)
Cominciamo con installare tutto quello che serve (a parte una VM con sopra Ubuntu):
Documentazione Ubuntu - Mail Server


A questo punto il plugin ha bisogno di due cose: Un file di configurazione che permetta di richiamare la regola e le assegni un punteggio.

Una classe Perl che implementi l'interfaccia Plugin e che definisca precisamente la regola che si vuole aggiungere a Spamassassin.
In questa prima parte we will focus on the configuration file. In the next article we will discuss how to write. Pm that queries a database for the evaluation of a header.

The configuration file that must be deposited in the dial directory system
/ etc / spamassassin . We can go to write it directly with the following command: sudo gedit


/ etc/spamassassin/25_myplugin.cf
  1. Within this file we are going to write two things. The first is the connection of the function that we will define our class. The second is the score that the rule adds to the assessment if there is a condition defined. The content is almost
  2. as follows: Rule #


load for myPlugin
header MY_RULE eval: check_myplugin_header ()
score MY_RULE 2.0

To configure our customization is only a step: you have to load our Spamassassin plugin. It must therefore be changed any *. pre file. Open the following: sudo gedit
  
/ etc/spamassassin/v310.pre


In the bottom of this file must be added the following lines so that our plugin will be loaded next reboot.
  # load LoadPlugin myPlugin 
Mail:: SpamAssassin:: Plugin:: myPlugin

Concluded the configuration is time of writing the actual plugin but it will be subject of the next post.

Stay tuned;)
  Oh, I almost forgot: 
sudo / etc / init.d / postfix
sudo / etc / init.d / spamassassin
  

Monday, June 21, 2010

Can I Have A Baby With Viral Count Of A Million

CL: a wonderful news! Google

I had read about in recent days but Today an article of the eternal Programmazione.it
I felt certain: Google has provided a set of command line tools to interact via shell with the services offered via the google-account.




 Going on the project site , strictly googlecode, we can identify two things at once. 

The first are the tools that you can use via the command line:
$ google blogger post - title" foo "" command line posting " $ Calendar Google Calendar add "Lunch with Jim at noon tomorrow"
Contacts $ google contacts list name, email> contacts.csv Docs $ edit google docs - title "Shopping List" $
Picasa Google Picasa create - title "Cat Photos "~ / photos / cats / *. jpg $
Youtube Google youtube post - Education category killer_robots.avi"

should be added that the main project page can also find sample scripts that are to better understand the potential of this instrument.
The second thing you notice is the Python code freely available (and God forbid, I would add), that can make us better understand the use of the API and the flexibility of this programming language.

for i in {ls-l / home / myhome / pictures /} do echo i






Una cosa in particolare ha catturato la mia attenzione. A
questo link
è possibile visionare un tech talk di quasi un'ora sul nuovo linguaggio di programmazione (Go-language). Questo talk è tenuto da Russ Cox, papà del linguaggio.
La particolarità di questa presentazione è il fatto che Russ si spinge in dettagli avanzati come la gestione degli oggetti e dei tipi che sicuramente hanno bisogno di chiarimenti da parte di chi ha concepito il linguaggio.

Ma i regali di G. non finiscono qua. Sul
blog ufficiale
della sezione code di Google è possibile guardare tutti i tech talk fra cui App Engine e Wave.

Buona visione at all;)

Monday, June 7, 2010

Birthday Favor Tag Wording

I in go-lang

I installed Ubuntu 4.10 (damn I never remember the code names of various releases ...) 64-bit processor and I am faced with a freshly installed Ubuntu box.


After upgrade to version 3 I made the decision to install this LTS from scratch for the new ext4 file system and see how it goes. Here are the very first impressions of this release:

The first point is definitely dedicated to the graphical interface that has been renovated and is definitely a maturity in this release that had been lacking until now. The questionable decision to put management buttons to the left of the window's title bar found a ready explanation
today. Whether the dark theme that the theme of light (very OSX) give a modern and distinct.

It is true there is no gimp, empathy is the default messenger etc etc etc but I am all the choices can be shared and reasonable. Gimp is made in a snap to install and Empathy I find it a good client, to explore, but that has already given me many satisfactions.
The speed of the system seems increased. The only thing that weighs a little more performance is Compiz. With Compiz active applications that make intensive use of graphics, like games and 3D graphics, affected and tend to shoot.

speak instead of air you breathe. Social, Cloud and Web, the three words that seem to have dictated the writing of this release. In addition to the displacement of the control buttons are easily configured by default and all the tools for instant messaging. Empathy allows you to communicate with all major channels from msn facebook. Gwibber allows you to update your contacts social networking. Evolution mail with a new look and makes the calendar, mail and contacts seamlessly integrated within the system. All this combines the Ubuntu One service that was already present in version 9.10, which provides a touch of cloud right in these times.
One recommendation from the following: Get Ubuntu!