The code is attached.

Regards.





From: Sylvain Beucler <[EMAIL PROTECTED]>
To: Sylvain Beucler <[EMAIL PROTECTED]>, mssxtra <[EMAIL PROTECTED]>, [email protected]
Subject: [task #7280] Submission of CASPAM
Date: Wed, 05 Sep 2007 20:06:31 +0000


Follow-up Comment #1, task #7280 (project administration):

Hi,

Where did you send the source code?
Please attach it to this tracker or send it to
[EMAIL PROTECTED]

Regards.


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/task/?7280>

_______________________________________________
  Message posté via/par Savannah
  http://savannah.gnu.org/


_________________________________________________________________
Real-time chat with your friends - Free download - MSN Messenger http://messenger.msn.com/?mkt=tr
import os, sys
import Image

for infile in sys.argv[1:]:
        try:
                converted = 0
                if os.path.splitext(infile)[1] != ".jpg":
                        os.popen ("convert "+infile+" 
"+os.path.splitext(infile)[0]+".jpg")
                        infile1 = os.path.splitext(infile)[0]+".jpg"
                        converted = 1
                else:
                        infile1 = infile
                im = Image.open(infile1)

                biggest = im.histogram()[0]
                zero = 0
                nonzero = 0
                critical = 0
                ratio = 0

                for i in im.histogram():
                        if biggest < i:
                                biggest = i

                step = int(biggest/3)

                for i in im.histogram():
                        if float(i)/float(biggest) < 0.001:
                                zero = zero+1
                        else:
                                nonzero = nonzero+1

                        if i >= step:
                                critical = critical+1

                nonzero = nonzero + 1
                zero = zero + 1
                ratio = nonzero / zero

                if critical < 14 and zero > 5 and ratio < 8:
                        print "----- SPAM!"
                else:
                        print "----- NOT SPAM!"

#               print critical,"\t",zero,"\t",nonzero,"\t",ratio
#               print infile

                if converted == 1:
                        os.popen("rm "+infile1)
                        converted = 0

        except IOError:
                print "error", infile

Reply via email to