Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

SPAM eater

by boo_radley (Parson)
on Aug 10, 2001 at 01:39 UTC ( [id://103656]=CUFP: print w/replies, xml ) Need Help??

this is a sort of tar baby based on my cough-medicine inspired CB rambling. there are 2 files, chatbot_smtp.pl, and the lightly massaged configuration file chatrex.txt Given a file containing a mail message with headers, it'll (ab)use chatbot::eliza to print a response to the spammer with ... well, what Eliza does best. I've made a few modification to her default vocabulary to adapt to a few of the cheesy things found in spam.
Note that this won't send the message, it's up to you to add it, or pipe the output appropriately.

Also, I'd like to improve the vocabulary a bit, expand things. Gimme suggestions!
update : This is my last char post! From here on, it's all unicode for me, baby!!

begin chatbot_smtp.pl :
update : I made slashdot! update : I made use.perl!
Seriously, though, thanks to everyone who ++d me :-) I'm honored
Readmore courtesy zdog :



#!perl.exe use Chatbot::Eliza; use strict; # # get mail as a whole # $|++; $/=undef; my $file = <>; $/="\n"; my ($headers,$mail)= split /\n\n/, $file,2; my @headers = split "\n", $headers; foreach (@headers ){ s/^To\s*\:/From\:/i && next; s/^From\s*\:/To\:/i && next; s/^Subject\s*: (.*?)/Subject: Re: $1/i; s/CC\s*:.*/CC:/i; } $headers=join "\n", @headers; # # paragraphs # my @paras = split /\n{2,}/, $mail; my $chatbot= new Chatbot::Eliza "your name here", "chatrex.txt"; my $resp=$headers."\n\nThank you for your mail! I am new to here, and +do not have good english -- forgive :)"; my $reply; foreach (@paras) { $reply = $chatbot->transform( "$_"); $_= ">" . $_; $_= join "\n>",split ("\n", $_); $resp .= "$_\n\n$reply\n\n"; } print $resp;
Here is the modified vocabulary, chatrex.txt.
initial: How do you do. Please tell me your problem. initial: Hello, I am a computer program. initial: Please tell me what's been bothering you. initial: Is something troubling you? final: Goodbye. It was nice talking to you. final: Goodbye. I hope you found this session helpful. final: I think you should talk to a REAL analyst. Ciao! final: Life is tough. Hang in there! quit: bye quit: goodbye quit: done quit: exit quit: quit pre: dont don't pre: cant can't pre: wont won't pre: recollect remember pre: recall remember pre: dreamt dreamed pre: dreams dream pre: maybe perhaps pre: certainly yes pre: machine computer pre: machines computer pre: computers computer post: am are post: your my post: yours mine pre: were was post: me you pre: you're you are pre: i'm i am post: myself yourself post: yourself myself post: i you post: you me post: my your post: me you post: i'm you are pre: same alike pre: identical alike pre: equivalent alike synon: belief feel think believe wish synon: family mother mom father dad sister brother wife children child synon: desire want need synon: sad unhappy depressed sick synon: happy elated glad better synon: cannot can't synon: everyone everybody nobody noone synon: be am is are was key: xnone -1 decomp: * reasmb: I'm not sure I understand you fully. reasmb: Please go on. reasmb: That is interesting. Please continue. reasmb: Tell me more about that. reasmb: Does talking about this bother you ? key: sorry 0 decomp: * reasmb: Please don't apologise. reasmb: Apologies are not necessary. reasmb: I've told you that apologies are not required. reasmb: It did not bother me. Please continue. key: apologise 0 decomp: * reasmb: goto sorry key: remember 5 decomp: * i remember * reasmb: Do you often think of (2) ? reasmb: Does thinking of (2) bring anything else to mind ? reasmb: What else do you recollect ? reasmb: Why do you remember (2) just now ? reasmb: What in the present situation reminds you of (2) ? reasmb: What is the connection between me and (2) ? reasmb: What else does (2) remind you of ? decomp: * do you remember * reasmb: Did you think I would forget (2) ? reasmb: Why do you think I should recall (2) now ? reasmb: What about (2) ? reasmb: goto what reasmb: You mentioned (2) ? decomp: * you remember * reasmb: How could I forget (2) ? reasmb: What about (2) should I remember ? reasmb: goto you key: forget 5 decomp: * i forget * reasmb: Can you think of why you might forget (2) ? reasmb: Why can't you remember (2) ? reasmb: How often do you think of (2) ? reasmb: Does it bother you to forget that ? reasmb: Could it be a mental block ? reasmb: Are you generally forgetful ? reasmb: Do you think you are suppressing (2) ? decomp: * did you forget * reasmb: Why do you ask ? reasmb: Are you sure you told me ? reasmb: Would it bother you if I forgot (2) ? reasmb: Why should I recall (2) just now ? reasmb: goto what reasmb: Tell me more about (2). key: if 3 decomp: * if * reasmb: Do you think its likely that (2) ? reasmb: Do you wish that (2) ? reasmb: What do you know about (2) ? reasmb: Really, if (2) ? reasmb: What would you do if (2) ? reasmb: But what are the chances that (2) ? reasmb: What does this speculation lead to ? key: dreamed 4 decomp: * i dreamed * reasmb: Really, (2) ? reasmb: Have you ever fantasized (2) while you were awake ? reasmb: Have you ever dreamed (2) before ? reasmb: goto dream key: dream 3 decomp: * reasmb: What does that dream suggest to you ? reasmb: Do you dream often ? reasmb: What persons appear in your dreams ? reasmb: Do you believe that dreams have something to do with your +problem ? key: perhaps 0 decomp: * reasmb: You don't seem quite certain. reasmb: Why the uncertain tone ? reasmb: Can't you be more positive ? reasmb: You aren't sure ? reasmb: Don't you know ? reasmb: How likely, would you estimate ? key: name 15 decomp: * reasmb: I am not interested in names. reasmb: I've told you before, I don't care about names -- please c +ontinue. key: deutsch 0 decomp: * reasmb: goto xfremd reasmb: I told you before, I don't understand German. key: francais 0 decomp: * reasmb: goto xfremd reasmb: I told you before, I don't understand French. key: italiano 0 decomp: * reasmb: goto xfremd reasmb: I told you before, I don't understand Italian. key: espanol 0 decomp: * reasmb: goto xfremd reasmb: I told you before, I don't understand Spanish. key: xfremd 0 decomp: * reasmb: I speak only English. key: hello 0 decomp: * reasmb: How do you do. Please state your problem. reasmb: Hi. What seems to be your problem ? key: computer 50 decomp: * reasmb: Do computers worry you ? reasmb: Why do you mention computers ? reasmb: What do you think machines have to do with your problem ? reasmb: Don't you think computers can help people ? reasmb: What about machines worries you ? reasmb: What do you think about machines ? key: am 0 decomp: * am i * reasmb: Do you believe you are (2) ? reasmb: Would you want to be (2) ? reasmb: Do you wish I would tell you you are (2) ? reasmb: What would it mean if you were (2) ? reasmb: goto what decomp: * i am * reasmb: goto i decomp: * reasmb: Why do you say 'am' ? reasmb: I don't understand that. key: are 0 decomp: * are you * reasmb: Why are you interested in whether I am (2) or not ? reasmb: Would you prefer if I weren't (2) ? reasmb: Perhaps I am (2) in your fantasies. reasmb: Do you sometimes think I am (2) ? reasmb: goto what reasmb: Would it matter to you ? reasmb: What if I were (2) ? decomp: * you are * reasmb: goto you decomp: * are * reasmb: Did you think they might not be (2) ? reasmb: Would you like it if they were not (2) ? reasmb: What if they were not (2) ? reasmb: Are they always (2) ? reasmb: Possibly they are (2). reasmb: Are you positive they are (2) ? key: your 0 decomp: * your * reasmb: Why are you concerned over my (2) ? reasmb: What about your own (2) ? reasmb: Are you worried about someone else's (2) ? reasmb: Really, my (2) ? reasmb: What makes you think of my (2) ? reasmb: Do you want my (2) ? key: was 2 decomp: * was i * reasmb: What if you were (2) ? reasmb: Do you think you were (2) ? reasmb: Were you (2) ? reasmb: What would it mean if you were (2) ? reasmb: What does ' (2) ' suggest to you ? reasmb: goto what decomp: * i was * reasmb: Were you really ? reasmb: Why do you tell me you were (2) now ? reasmb: Perhaps I already know you were (2). decomp: * was you * reasmb: Would you like to believe I was (2) ? reasmb: What suggests that I was (2) ? reasmb: What do you think ? reasmb: Perhaps I was (2). reasmb: What if I had been (2) ? key: i 0 decomp: * i @desire * reasmb: What would it mean to you if you got (3) ? reasmb: Why do you want (3) ? reasmb: Suppose you got (3) soon. reasmb: What if you never got (3) ? reasmb: What would getting (3) mean to you ? reasmb: What does wanting (3) have to do with this discussion ? decomp: * i am* @sad * reasmb: I am sorry to hear that you are (3). reasmb: Do you think coming here will help you not to be (3) ? reasmb: I'm sure it's not pleasant to be (3). reasmb: Can you explain what made you (3) ? decomp: * i am* @happy * reasmb: How have I helped you to be (3) ? reasmb: Has your treatment made you (3) ? reasmb: What makes you (3) just now ? reasmb: Can you explain why you are suddenly (3) ? decomp: * i was * reasmb: goto was decomp: * i @belief i * reasmb: Do you really think so ? reasmb: But you are not sure you (3). reasmb: Do you really doubt you (3) ? decomp: * i* @belief *you * reasmb: goto you decomp: * i am * reasmb: Is it because you are (2) that you came to me ? reasmb: How long have you been (2) ? reasmb: Do you believe it is normal to be (2) ? reasmb: Do you enjoy being (2) ? reasmb: Do you know anyone else who is (2) ? decomp: * i @cannot * reasmb: How do you know that you can't (3) ? reasmb: Have you tried ? reasmb: Perhaps you could (3) now. reasmb: Do you really want to be able to (3) ? reasmb: What if you could (3) ? decomp: * i don't * reasmb: Don't you really (2) ? reasmb: Why don't you (2) ? reasmb: Do you wish to be able to (2) ? reasmb: Does that trouble you ? decomp: * i feel * reasmb: Tell me more about such feelings. reasmb: Do you often feel (2) ? reasmb: Do you enjoy feeling (2) ? reasmb: Of what does feeling (2) remind you ? decomp: * i * you * reasmb: Perhaps in your fantasies we (2) each other. reasmb: Do you wish to (2) me ? reasmb: You seem to need to (2) me. reasmb: Do you (2) anyone else ? decomp: * reasmb: You say (1) ? reasmb: Why do you say (1) ? reasmb: Can you elaborate on that ? reasmb: Do you say (1) for some special reason ? reasmb: That's quite interesting. key: you 0 decomp: * you remind me of * reasmb: goto alike decomp: * you are * reasmb: What makes you think I am (2) ? reasmb: Does it please you to believe I am (2) ? reasmb: Do you sometimes wish you were (2) ? reasmb: Perhaps you would like to be (2). decomp: * you* me * reasmb: Why do you think I (2) you ? reasmb: You like to think I (2) you -- don't you ? reasmb: What makes you think I (2) you ? reasmb: Really, I (2) you ? reasmb: Do you wish to believe I (2) you ? reasmb: Suppose I did (2) you -- what would that mean ? reasmb: Does someone else believe I (2) you ? decomp: * you * reasmb: I'm glad you've sent me this! reasmb: Oh, I (2) ? reasmb: You're not really talking about me -- are you ? reasmb: How do you think I could (2) ? key: yes 0 decomp: * reasmb: Please go on. reasmb: Please tell me some more about this. reasmb: Why don't you tell me a little more about this. reasmb: I see. reasmb: I understand. key: no 0 decomp: * no one * reasmb: Are you sure, no one (2) ? reasmb: Surely someone (2) . reasmb: Can you think of anyone at all ? reasmb: Are you thinking of a very special person ? reasmb: Who, may I ask ? reasmb: You have a particular person in mind, don't you ? reasmb: Who do you think you are talking about ? decomp: * reasmb: Are you saying no just to be negative? reasmb: Does this make you feel unhappy? reasmb: Why not ? reasmb: Why 'no' ? key: my 2 decomp: * my* @family * reasmb: Tell me more about your family. reasmb: Who else in your family (4) ? reasmb: Your (3) ? reasmb: What else comes to mind when you think of your (3) ? decomp: * my * reasmb: Your (2) ? reasmb: Why do you say your (2) ? reasmb: Does that suggest anything else which belongs to you ? reasmb: Is it important to you that your (2) ? reasm_for_memory: Let's discuss further why your (2). reasm_for_memory: Earlier you said your (2). reasm_for_memory: But your (2). reasm_for_memory: Does that have anything to do with the fact that + your (2) ? key: can 0 decomp: * can you * reasmb: You believe I can (2) don't you ? reasmb: goto what reasmb: You want me to be able to (2). reasmb: Perhaps you would like to be able to (2) yourself. decomp: * can i * reasmb: Whether or not you can (2) depends on you more than on me. reasmb: Do you want to be able to (2) ? reasmb: Perhaps you don't want to (2). reasmb: goto what key: what 0 decomp: * reasmb: Why do you ask ? reasmb: Does that question interest you ? reasmb: What is it you really want to know ? reasmb: Are such questions much on your mind ? reasmb: What answer would please you most ? reasmb: What do you think ? reasmb: What comes to mind when you ask that ? reasmb: Have you asked such questions before ? reasmb: Have you asked anyone else ? key: who 0 decomp: who * reasmb: goto what key: when 0 decomp: when * reasmb: goto what key: where 0 decomp: where * reasmb: goto what key: how 0 decomp: how * reasmb: goto what key: because 0 decomp: * reasmb: Is that the real reason ? reasmb: Don't any other reasons come to mind ? reasmb: Does that reason seem to explain anything else ? reasmb: What other reasons might there be ? key: why 0 decomp: * why don't you * reasmb: Do you believe I don't (2) ? reasmb: Perhaps I will (2) in good time. reasmb: Should you (2) yourself ? reasmb: You want me to (2) ? reasmb: goto what decomp: * why can't i * reasmb: Do you think you should be able to (2) ? reasmb: Do you want to be able to (2) ? reasmb: Do you believe this will help you to (2) ? reasmb: Have you any idea why you can't (2) ? reasmb: goto what decomp: * reasmb: goto what key: everyone 2 decomp: * @everyone * reasmb: Really, (2) ? reasmb: Surely not (2). reasmb: Can you think of anyone in particular ? reasmb: Who, for example? reasmb: Are you thinking of a very special person ? reasmb: Who, may I ask ? reasmb: Someone special perhaps ? reasmb: You have a particular person in mind, don't you ? reasmb: Who do you think you're talking about ? key: everybody 2 decomp: * reasmb: goto everyone key: nobody 2 decomp: * reasmb: goto everyone key: noone 2 decomp: * reasmb: goto everyone key: always 1 decomp: * reasmb: Can you think of a specific example ? reasmb: When ? reasmb: What incident are you thinking of ? reasmb: Really, always ? key: alike 10 decomp: * reasmb: In what way ? reasmb: What resemblence do you see ? reasmb: What does that similarity suggest to you ? reasmb: What do you suppose that resemblence means ? reasmb: What is the connection, do you suppose ? reasmb: Could there really be some connection ? reasmb: How ? key: like 10 decomp: * @be *like * reasmb: goto alike key: different 0 decomp: * reasmb: How is it different ? reasmb: What differences do you see ? reasmb: What does that difference suggest to you ? reasmb: What other distinctions do you see ? reasmb: What do you suppose that disparity means ? reasmb: Could there be some connection, do you suppose ? reasmb: How ? key: fuck 10 decomp: * reasmb: goto xswear key: fucker 10 decomp: * reasmb: goto xswear key: shit 10 decomp: * reasmb: goto xswear key: damn 10 decomp: * reasmb: goto xswear key: shut 10 decomp: * shut up * reasmb: goto xswear key: xswear 10 decomp: * reasmb: Does it make you feel strong to use that kind of language +? reasmb: Are you venting your feelings now ? reasmb: Are you angry ? reasmb: Does this topic make you feel angry ? reasmb: Is something making you feel angry ? reasmb: Does using that kind of language make you feel better ? key: click 7 decomp: click here to be removed reasmb: No, please send me more! decomp: click here reasmb: I would like to visit your site, but my mouse is broken key: Dear 5 decomp: * reasmb: Hi there, (2) reasmb: Hi, how are you? reasmb: Good morning! readmb: To whom it concerns,

Replies are listed 'Best First'.
Re: SPAM eater
by Saint Aardvark (Acolyte) on Aug 12, 2001 at 05:41 UTC
    WOW. That is hilarious. I am truly, truly speechless before your genius. Honestly.

    I am now blessing your keyboard...

      Just adding another "This cracks me up, you rock" post.
      I Agree, Kudos to the absolute genius!
Re: SPAM eater
by Anonymous Monk on Aug 12, 2001 at 23:17 UTC
    Ah yes, I remember trying to wrestle an early version of the Eliza program down on my old 286 :) A classic that still delivers annoyance and drives normally sane people to the top of the clocktower with a rifle. I salute you!
Re: SPAM eater
by Anonymous Monk on Aug 12, 2001 at 21:58 UTC
    Sounds like a lot of fun. I'd love to see some sample spams and replies.
Re: SPAM eater
by silent11 (Vicar) on Aug 24, 2001 at 02:29 UTC
    This is great, I can't wait to get this up and running.
Re: SPAM eater
by Anonymous Monk on Aug 12, 2001 at 23:37 UTC
    Anyone can tell me how to get this to work ? I try to run it but all I get is hundreds of compile warnings... # perl index.pl "use" not allowed in expression at index.pl line 5, at end of line syntax error at index.pl line 5, near "char #!perl.exe use Chatbot::Eliza" BEGIN not safe after errors--compilation aborted at index.pl line 6.
      You need to install the 'chatbot::eliza' -- You can find it here
        Probably a good thing to have the module. But in this case, the shebang/hashbang line on boo_radley's script uses perl.exe, a decidedly Windows sort of thing to do. On Unix, in the absence of an executable named perl.exe (easily accomplished by symlinking in an appropriate place), this script will run as a shell script-- which yields a host of interesting errors none of which are related to not having this module installed in the local Perl install. More than likely Unix users will want to change that first line to a variant of #!/usr/bin/perl.
Font Size
by Anonymous Monk on Aug 12, 2001 at 22:09 UTC
    Ya gotta get a larger font up there. My 20/20 vision is having trouble reading the code portions of your webpage.
      Get a larger screen... and it's not supposed to be read through the bottom of a beer glass ;-)
      Great code :) I remember Eliza since I was a kid ( that's way more than a decade ago... )
      if you're running IE, click on View->text size->(any size you want) to increase the size of the font in the page you're viewing
Windows?
by Anonymous Monk on Aug 13, 2001 at 20:15 UTC
    Wow, this is really cool! Can I get it to work for my Windows ME? It would be great to see this as a Windows program where I could just feed the program with spam and Eliza creates her annoying answer. If someone could translate this into Visual Basic, I'm would love to do something with it! Can someone please send me an email to joakim&spray.no if you know how to translate this into VB or if it is available for Windows? Thanks a lot if you do!

    By the way, the Norwegian Internet magazine ITavisen has written about this thingy under the title "How to really annoy spammers"!
      Of course it's available for Windows! It's written in Perl!

      Why would you even want to translate it into Visual Basic? I'm a bit confused.

      If you use ActiveState's Perl, and you really *need* something specific to Visual Basic for some reason, you could always use PerlCOM to execute calls from VB.

      If you think you need Visual Basic so you can distribute it to your Windows friends, check out PerlApp (a Perl compiler) from ActiveState.

      If you think you need Visual Basic so you can wrap some sort of GUI around it, check out Perl/Tk (which has a fantastic Windows implementation).

      I tried VB a few years ago, but found Perl so much more fun. Not only is the language easier to use and the community much more friendly and dynamic, but you have the CPAN at your disposal which makes scripts such as this one possible.

      Just my $0.02 :-)

Re: SPAM eater
by Anonymous Monk on Aug 16, 2001 at 18:59 UTC
    I think this is funny

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: CUFP [id://103656]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-10-09 00:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The PerlMonks site front end has:





    Results (44 votes). Check out past polls.

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.