Well, I signed up for the Perl Ironman Challenge set forth by the Enlightened Perl guys recently as a way to get myself to stand up and start learning all the new hotness like Moose, POE, ancient perl, and so on. So here's my first task: write 'badjoked' using POE and Moose.
What is badjoked? Well, to quote what I wrote randomly in manpage-like style over an IM session to a friend:
NAME
badjoked(8) - send out random bad jokes on a TCP port
SYNOPSIS
badjoked [--listen-stupid=<port>] [--knock-knock]
DESCRIPTION
badjoked is an implementation of the RFC 0xDEADBEEF
protocol. badjoked listens on the default badjoke port 11235,
unless given the --listen-stupid command line argument.
Upon connection to the listening port, badjoked runs the fortune
command to generate a random quote, which is written to the
listening client.
If badjoked is started with the --knock-knock option, connecting
the first time will cause an immediate disconnect of the
client. Afterward, badjoked will initiate a knock-knock portscan
on ports 1, 1, 2, and 1 to the originating client. Finally,
badjoked will connect to the badjoked port on the originating
system and do the following:
1. Wait for the line "Who's there?\n".
2. Upon reciept, send the first part of a randomly chosen knock
knock joke.
3. Wait for another line that matches the regex ^.+ who?\n$
4. Send the final line of the knock knock joke.
5. Disconnect.
AUTHOR
June Tate-Gans <june@theonelab.com>
BUGS
- Since the original 0xDEADBEEF RFC doens't specify what to do
when the originatinc client isn't a badjoke implementor,
badjoked doesn't discriminate when run in --knock-knock mode.
NOTE: This may be considered an implementation detail -- a bad
joke itself.
NOTES
The knock-knock 1, 1, 2, 1 port order is completely arbitrary --
it was chosen because it corresponds to the usual American
knock-knock pattern, "knock, knock, knock-knock, knock."
SEE ALSO
fortune(6), strfry(3), lart(1)
Post a comment