You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by aixenv <ai...@yahoo.com> on 2009/04/30 19:57:36 UTC

trying to score based on image name and image size

I notice there's a:

mx1:/usr/share/perl5/Mail/SpamAssassin/Plugin# ls -lah ImageInfo.pm 
-rw-r--r-- 1 root root 11K Aug  8  2007 ImageInfo.pm

and within that there's two subs 'image_named' and 'image_size_exact'

mx1:/usr/share/perl5/Mail/SpamAssassin/Plugin# cat ImageInfo.pm |grep
image_named
  $self->register_eval_rule ("image_named");
sub image_named {
mx1:/usr/share/perl5/Mail/SpamAssassin/Plugin# cat ImageInfo.pm |grep exact    
  $self->register_eval_rule ("image_size_exact");
sub image_size_exact {
mx1:/usr/share/perl5/Mail/SpamAssassin/Plugin# 

I am trying the following rule and it is not scoring, what am i missing?:

(this rule is in my local.cf)

# rule to block annoying viagra spam with scraped text based off image size, 
# name and having other rule hits
# 4/30/09 8:45AM
body __ZL_PNG_400_240 eval:image_size_exact('png',400,240)
body __ZL_CAM eval:image_named('/^DS[CL]\d{4}\.png$/')
meta ZL_VIAGRAIMG HTML_MESSAGE && __ZL_CAM && __ZL_PNG_400_240
describe ZL_VIAGRAIMG Includes 400x240 viagra png image
score ZL_VIAGRAIMG 1.00

any help is appreciate thanks

aixenv

-- 
View this message in context: http://www.nabble.com/trying-to-score-based-on-image-name-and-image-size-tp23321365p23321365.html
Sent from the SpamAssassin - Users mailing list archive at Nabble.com.


Re: trying to score based on image name and image size

Posted by aixenv <ai...@yahoo.com>.
aha i fixed it with the following:

# rule to block annoying viagra spam with scraped text based off image size, 
# name and having other rule hits
# 4/30/09 8:45AM
body __ZL_PNG_240_400 eval:image_size_exact('png',240,400)
body __ZL_CAM eval:image_name_regex('/^DS[CL]\d{4}\.png$/')
meta ZL_VIAGRAIMG (HTML_MESSAGE && __ZL_CAM && __ZL_PNG_240_400)
describe ZL_VIAGRAIMG Includes 240x400 viagra png image
score ZL_VIAGRAIMG 2.0

i also set in the v310.pre

loadplugin SareImageInfo SareImageInfo.pm

and I also changed the package line for the Sare ImageInfo plugin

(found here: http://www.rulesemporium.com/plugins.htm#imageinfo)

 so it wouldnt conflict with the SA version of ImageInfo

:)

tests have it working !

2.0 ZL_VIAGRAIMG           Includes 240x400 viagra png image

based on that exact image size, that reg_ex image name and it being an html
msg 




aixenv wrote:
> 
> thanks for the reply:
> 
> from the spamassassin -D plugin --lint , i got:
> 
> [20759] dbg: plugin: loading Mail::SpamAssassin::Plugin::ImageInfo from
> @INC
> 
> running -D imageinfo against the msg i get:
> 
> mx1:~/spam# cat spam6 |spamassassin -D imageinfo
> [21510] dbg: imageinfo: png image DSC5051.png is 240 x 400 pixels (96000
> pixels sq.)
> [21510] dbg: imageinfo: image name DSC5051.png found
> [21510] dbg: imageinfo: adding 240x400 to dems_all
> [21510] dbg: imageinfo: image ratio=0.0353333333333333, min=0.000
> max=0.008
> [21510] dbg: imageinfo: image ratio=0.0569270833333333, min=0.000
> max=0.015
> 
> 
> ahh it reads it as 240x400 and my rule has 400x240, i bet that's the
> issue. let me retry the rule as 240x400
> 
> 
> 
> 
> 
> Theo Van Dinter-2 wrote:
>> 
>> There could be various reasons ranging from "plugin isn't loaded"
>> (though you'd get an error w/ the rules then) to "image isn't exactly
>> that size", to "plugin can't determine width+height from image", to
>> ...
>> 
>> Assuming the plugin is loaded ("spamassassin -D plugin --lint" would
>> tell you), and you've verified that the size is what you think it is
>> using some method ...   For option 3, run the message through
>> "spamassassin -D imageinfo" and see what it spits out.  If you don't
>> see something like:
>> 
>> imageinfo: png image FOO.PNG is 400 x 240 pixels (96000 pixels sq.)
>> 
>> Then it didn't figure out the height + width.  If it does output that,
>> compare the height and width to what you expected.
>> 
>> 
>> On Thu, Apr 30, 2009 at 1:57 PM, aixenv <ai...@yahoo.com> wrote:
>>>
>>> I notice there's a:
>>>
>>> mx1:/usr/share/perl5/Mail/SpamAssassin/Plugin# ls -lah ImageInfo.pm
>>> -rw-r--r-- 1 root root 11K Aug  8  2007 ImageInfo.pm
>>>
>>> and within that there's two subs 'image_named' and 'image_size_exact'
>>>
>>> mx1:/usr/share/perl5/Mail/SpamAssassin/Plugin# cat ImageInfo.pm |grep
>>> image_named
>>>  $self->register_eval_rule ("image_named");
>>> sub image_named {
>>> mx1:/usr/share/perl5/Mail/SpamAssassin/Plugin# cat ImageInfo.pm |grep
>>> exact
>>>  $self->register_eval_rule ("image_size_exact");
>>> sub image_size_exact {
>>> mx1:/usr/share/perl5/Mail/SpamAssassin/Plugin#
>>>
>>> I am trying the following rule and it is not scoring, what am i
>>> missing?:
>>>
>>> (this rule is in my local.cf)
>>>
>>> # rule to block annoying viagra spam with scraped text based off image
>>> size,
>>> # name and having other rule hits
>>> # 4/30/09 8:45AM
>>> body __ZL_PNG_400_240 eval:image_size_exact('png',400,240)
>>> body __ZL_CAM eval:image_named('/^DS[CL]\d{4}\.png$/')
>>> meta ZL_VIAGRAIMG HTML_MESSAGE && __ZL_CAM && __ZL_PNG_400_240
>>> describe ZL_VIAGRAIMG Includes 400x240 viagra png image
>>> score ZL_VIAGRAIMG 1.00
>>>
>>> any help is appreciate thanks
>>>
>>> aixenv
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/trying-to-score-based-on-image-name-and-image-size-tp23321365p23321365.html
>>> Sent from the SpamAssassin - Users mailing list archive at Nabble.com.
>>>
>>>
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/trying-to-score-based-on-image-name-and-image-size-tp23321365p23322593.html
Sent from the SpamAssassin - Users mailing list archive at Nabble.com.


Re: trying to score based on image name and image size

Posted by aixenv <ai...@yahoo.com>.
thanks for the reply:

from the spamassassin -D plugin --lint , i got:

[20759] dbg: plugin: loading Mail::SpamAssassin::Plugin::ImageInfo from @INC

running -D imageinfo against the msg i get:

mx1:~/spam# cat spam6 |spamassassin -D imageinfo
[21510] dbg: imageinfo: png image DSC5051.png is 240 x 400 pixels (96000
pixels sq.)
[21510] dbg: imageinfo: image name DSC5051.png found
[21510] dbg: imageinfo: adding 240x400 to dems_all
[21510] dbg: imageinfo: image ratio=0.0353333333333333, min=0.000 max=0.008
[21510] dbg: imageinfo: image ratio=0.0569270833333333, min=0.000 max=0.015


ahh it reads it as 240x400 and my rule has 400x240, i bet that's the issue.
let me retry the rule as 240x400





Theo Van Dinter-2 wrote:
> 
> There could be various reasons ranging from "plugin isn't loaded"
> (though you'd get an error w/ the rules then) to "image isn't exactly
> that size", to "plugin can't determine width+height from image", to
> ...
> 
> Assuming the plugin is loaded ("spamassassin -D plugin --lint" would
> tell you), and you've verified that the size is what you think it is
> using some method ...   For option 3, run the message through
> "spamassassin -D imageinfo" and see what it spits out.  If you don't
> see something like:
> 
> imageinfo: png image FOO.PNG is 400 x 240 pixels (96000 pixels sq.)
> 
> Then it didn't figure out the height + width.  If it does output that,
> compare the height and width to what you expected.
> 
> 
> On Thu, Apr 30, 2009 at 1:57 PM, aixenv <ai...@yahoo.com> wrote:
>>
>> I notice there's a:
>>
>> mx1:/usr/share/perl5/Mail/SpamAssassin/Plugin# ls -lah ImageInfo.pm
>> -rw-r--r-- 1 root root 11K Aug  8  2007 ImageInfo.pm
>>
>> and within that there's two subs 'image_named' and 'image_size_exact'
>>
>> mx1:/usr/share/perl5/Mail/SpamAssassin/Plugin# cat ImageInfo.pm |grep
>> image_named
>>  $self->register_eval_rule ("image_named");
>> sub image_named {
>> mx1:/usr/share/perl5/Mail/SpamAssassin/Plugin# cat ImageInfo.pm |grep
>> exact
>>  $self->register_eval_rule ("image_size_exact");
>> sub image_size_exact {
>> mx1:/usr/share/perl5/Mail/SpamAssassin/Plugin#
>>
>> I am trying the following rule and it is not scoring, what am i missing?:
>>
>> (this rule is in my local.cf)
>>
>> # rule to block annoying viagra spam with scraped text based off image
>> size,
>> # name and having other rule hits
>> # 4/30/09 8:45AM
>> body __ZL_PNG_400_240 eval:image_size_exact('png',400,240)
>> body __ZL_CAM eval:image_named('/^DS[CL]\d{4}\.png$/')
>> meta ZL_VIAGRAIMG HTML_MESSAGE && __ZL_CAM && __ZL_PNG_400_240
>> describe ZL_VIAGRAIMG Includes 400x240 viagra png image
>> score ZL_VIAGRAIMG 1.00
>>
>> any help is appreciate thanks
>>
>> aixenv
>>
>> --
>> View this message in context:
>> http://www.nabble.com/trying-to-score-based-on-image-name-and-image-size-tp23321365p23321365.html
>> Sent from the SpamAssassin - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/trying-to-score-based-on-image-name-and-image-size-tp23321365p23322575.html
Sent from the SpamAssassin - Users mailing list archive at Nabble.com.


Re: trying to score based on image name and image size

Posted by Theo Van Dinter <fe...@apache.org>.
There could be various reasons ranging from "plugin isn't loaded"
(though you'd get an error w/ the rules then) to "image isn't exactly
that size", to "plugin can't determine width+height from image", to
...

Assuming the plugin is loaded ("spamassassin -D plugin --lint" would
tell you), and you've verified that the size is what you think it is
using some method ...   For option 3, run the message through
"spamassassin -D imageinfo" and see what it spits out.  If you don't
see something like:

imageinfo: png image FOO.PNG is 400 x 240 pixels (96000 pixels sq.)

Then it didn't figure out the height + width.  If it does output that,
compare the height and width to what you expected.


On Thu, Apr 30, 2009 at 1:57 PM, aixenv <ai...@yahoo.com> wrote:
>
> I notice there's a:
>
> mx1:/usr/share/perl5/Mail/SpamAssassin/Plugin# ls -lah ImageInfo.pm
> -rw-r--r-- 1 root root 11K Aug  8  2007 ImageInfo.pm
>
> and within that there's two subs 'image_named' and 'image_size_exact'
>
> mx1:/usr/share/perl5/Mail/SpamAssassin/Plugin# cat ImageInfo.pm |grep
> image_named
>  $self->register_eval_rule ("image_named");
> sub image_named {
> mx1:/usr/share/perl5/Mail/SpamAssassin/Plugin# cat ImageInfo.pm |grep exact
>  $self->register_eval_rule ("image_size_exact");
> sub image_size_exact {
> mx1:/usr/share/perl5/Mail/SpamAssassin/Plugin#
>
> I am trying the following rule and it is not scoring, what am i missing?:
>
> (this rule is in my local.cf)
>
> # rule to block annoying viagra spam with scraped text based off image size,
> # name and having other rule hits
> # 4/30/09 8:45AM
> body __ZL_PNG_400_240 eval:image_size_exact('png',400,240)
> body __ZL_CAM eval:image_named('/^DS[CL]\d{4}\.png$/')
> meta ZL_VIAGRAIMG HTML_MESSAGE && __ZL_CAM && __ZL_PNG_400_240
> describe ZL_VIAGRAIMG Includes 400x240 viagra png image
> score ZL_VIAGRAIMG 1.00
>
> any help is appreciate thanks
>
> aixenv
>
> --
> View this message in context: http://www.nabble.com/trying-to-score-based-on-image-name-and-image-size-tp23321365p23321365.html
> Sent from the SpamAssassin - Users mailing list archive at Nabble.com.
>
>