[TriLUG] porn spam problem
David Brain
dbrain at gmail.com
Wed Nov 28 09:51:26 EST 2007
Hi,
We had similar problems with our wiki (it's a somewhat hacked around
with media wiki implementation) - in the end I went with a
quick'n'dirty CAPTCHA which did seem to work without requiring a bunch
of code changes in the wiki.
I basically created a 100 captcha images (rather than gen them
dynamically - which required libraries that weren't installed on the
server) and just had a mapping (e.g. 01.jpg = 'FXCCSFA' ) on the
server side, and just picked which image to serve randomly. It's not
as secure as it looks to the user (-: as there are only 100 possible
answers, but it did stop the spam.
Below is the script used to gen captchas (was run on a Mac so the
-font param would need changing, uses imagemagick).
David.
===
#!/usr/bin/python
import os
import random
command="""convert -size 142x42 xc:white -font
/Library/Fonts/Baskerville.dfont -pointsize 28 -tile
pattern:checkerboard -annotate +10+30 %s -blur 0x1 -wave 1x3 -draw
"line %s" -draw "line %s" %s.jpg
"""
def getString():
letters='ABCDEFGHJKPRSTWXYZ'
ret=""
for n in range(6):
ret+=letters[random.randint(0,len(letters)-1)]
return ret
def getLinePoints():
xpos=str(random.randint(0,71))
ypos=str(random.randint(0,21))
xpos2=str(random.randint(71,142))
ypos2=str(random.randint(21,41))
return "%s,%s,%s,%s" % (xpos,ypos,xpos2,ypos2)
fp=open('mapping.txt','w')
for n in range(100):
rndString=getString()
os.system(command % (rndString,getLinePoints(),getLinePoints(),str(n)))
fp.write(str(n)+','+rndString+'\n')
fp.close()
On Nov 28, 2007 9:22 AM, <dhardison at grapeape.org> wrote:
>
> > WA Brown wrote:
> >> I have a server and website. I am having a problem with robots trying to
> >> access the message board to load porn spam. Looks like captcha dont
> >> work. I
> >> get, on the average, 50 tries a
> >> day. It fills up my email and I have to delete all the entries.
> >> What can I do to stop this?
> >>
> >>
> >> WA Brown
> >> www.havenstead.net
> >>
> >>
> >>
> > what message board software ?
> > --
> > TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug
> > TriLUG Organizational FAQ : http://trilug.org/faq/
> > TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
> >
>
> Is porn ever really a *problem* ? ;-)
>
> ha!
>
> --
> TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG Organizational FAQ : http://trilug.org/faq/
> TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
>
More information about the TriLUG
mailing list