From e99ec25514ebceb45c215fba14319769d34904db Mon Sep 17 00:00:00 2001 From: joey Date: Mon, 4 Nov 2002 01:32:40 +0000 Subject: [PATCH] * Added a censor filter. * Added a spammer filter which generates spamassassin-triggering pseudo-spam from input. * Updated eleet filter (which should perhaps be renamed to just 'leet') to the standards of irc circa mid 2002. * Make jibberish filter only run text through 3 to 8 of the other filters. * Various improvements. --- Makefile | 2 +- README | 3 ++- b1ff | 1 + censor | 61 ++++++++++++++++++++++++++++++++++++++++++++++++ debian/TODO | 2 +- debian/changelog | 12 ++++++++++ debian/control | 2 +- debian/copyright | 6 ++--- eleet | 24 ++++++++++++------- filters.6 | 21 +++++++++++++---- jibberish | 8 ++++--- studly | 1 - 12 files changed, 117 insertions(+), 26 deletions(-) create mode 100755 censor diff --git a/Makefile b/Makefile index d4b7344..c64135f 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ LEX = flex BUILD = jethro kraut cockney jive nyc ken ky00te newspeak -OTHER = eleet b1ff chef jibberish upside-down rasterman studly fudd +OTHER = eleet b1ff chef jibberish upside-down rasterman studly fudd censor spammer CFLAGS = -O2 INSTALL_PROGRAM = install diff --git a/README b/README index dec7b07..1857f62 100644 --- a/README +++ b/README @@ -1,5 +1,6 @@ This is a collection of filters to do all sorts of strange things to text. -B1ff, the Swedish Chef, and an eleet filter are included. +B1ff, the Swedish Chef, and an eleet filter are included, along with many, +many more. Since the original versions of some of these filters have copyright problems, I have done a "clean room" re-implementation of the original lex diff --git a/b1ff b/b1ff index f958c0f..0f1ad43 100755 --- a/b1ff +++ b/b1ff @@ -53,6 +53,7 @@ 'ER' => 'UR', 'S+\b' => 'Z', 'KN' => 'N', + 'IE' => 'EI', ); $_=uc; diff --git a/censor b/censor new file mode 100755 index 0000000..2d46963 --- /dev/null +++ b/censor @@ -0,0 +1,61 @@ +#!/usr/bin/perl +# Censor filter. +# Copyright 2002 by Joey Hess under the terms of the GNU GPL. + +# Yes, this program is self-modifying code, if you want it to be. +if (exists $ENV{ADD_WORD}) { + open(IN, $0) || die "cannot read myself"; + @lines=; + close IN; + open OUT, ">$0" || die "cannot write myself"; + for (@lines) { + print OUT $_; + if (/^__DATA__\n$/) { + open(DATAOUT, "|sort|uniq|column >> $0"); + $ENV{ADD_WORD} =~ y/n-za-m/a-z/; + print DATAOUT "$ENV{ADD_WORD}\n"; + print DATAOUT join("\n", + map { chomp; split ' ', $_ } ); + close DATAOUT; + exit; + } + } +} + +$censored = join("|", reverse sort { $a cmp $b } + grep { length $_ } + map { chomp; y/a-z/n-za-m/; split ' ', $_ } ); + +while (<>) { + s/\b($censored)ed/CENSORED/ig; # don't say "CENSOREDed" + s/\b($censored)/CENSORED/ig; + print $_; +} + +__DATA__ +ahqr enaql grng pbzrvat t\f+fcbg +anxrq encr guebng pbzvat tebva +avccyr erne gvg pebgpu ubbgre +bcravat fangpu gvggl penc ubeal +beny fchax gvggvr penpx ubyr +betl fcrez hgrehf pernz uhzc +betnfz fcuvapgre ihyin phag unaqwbo +certanag fghq intvan phz urnq +cevpx fgnss ivetva phzzvat wvfz +chff fhpx ivoengbe pnzr xabo +chffl fjnyybj jbzo preivk xvff +chffvrf fperj jrg pureel ybir +chovp frk juber pyvg ybire +chqraqhz frkhny kkk pyvgbehf ybirq +chzc frrq nany pyvggl ybnq +cnagvrf frzra nerbyn pyvznk ynovn +crargengr funsg nff qevyyrq ynvq +crargengrq funt nffubyr qrsybjre yrfovna +cravf funttvat obbo qvpx yvcf +crgre fuvg oernfg qvyqb znfgheong +crpxre fyhg ohgg rebgvp znfgheongr +cunyyhf fyhggvfu ohggbpx rerpgvba znfgheongvat +cvff fyvg onyy rkcbfrq znzznel +ebfrohq gbathr ovgpu shpx znzznevrf +ebq gbby oybj snpvny +ehg gjng pbpx t-fcbg diff --git a/debian/TODO b/debian/TODO index 053a6de..a1a7bfc 100644 --- a/debian/TODO +++ b/debian/TODO @@ -1,3 +1,3 @@ -* censor filter (should be easy) * continue to make the chef filter more similar to the old one * write and collect more filters +* does anyone have an asci-art cow font? diff --git a/debian/changelog b/debian/changelog index 7bdbd90..d15f792 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +filters (2.27) unstable; urgency=low + + * Added a censor filter. + * Added a spammer filter which generates spamassassin-triggering + pseudo-spam from input. + * Updated eleet filter (which should perhaps be renamed to just 'leet') + to the standards of irc circa mid 2002. + * Make jibberish filter only run text through 3 to 8 of the other filters. + * Various improvements. + + -- Joey Hess Sun, 3 Nov 2002 16:37:12 -0500 + filters (2.26) unstable; urgency=low * Don't use dh_installmanpages. diff --git a/debian/control b/debian/control index e5c96d1..e6048b5 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: games Priority: optional Build-Depends: debhelper (>= 4), flex, bison | byacc | btyacc, dpkg-dev (>= 1.9.0) Maintainer: Joey Hess -Standards-Version: 3.5.6.1 +Standards-Version: 3.5.7.0 Package: filters Architecture: any diff --git a/debian/copyright b/debian/copyright index 2896a57..cd0bfa4 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,9 +1,7 @@ This is a Debian prepackaged version of the filters package. This package was put together and debianized by Joey Hess -, using sources from - http://qz.to/~eli/src.html and - ftp://ftp.funet.fi/pub/misc/old-hsu-archive/unsorted/2/kraut.shar.gz +, using sources from all over. The jethro filter has this copyright: ** Public domain. Use at your own risk. Y'all come back now, heah? @@ -97,6 +95,6 @@ has the following license statement: # just for reference, you may do whatever you like with this file. -Everything else is copyright 1999-2001 by Joey Hess, under the terms of GPL. +Everything else is copyright 1999-2002 by Joey Hess, under the terms of GPL. The full text of the GNU GPL can be found in /usr/share/common-licenses/GPL on Debian systems. diff --git a/eleet b/eleet index 017d9eb..9e0fb77 100755 --- a/eleet +++ b/eleet @@ -1,13 +1,19 @@ #!/usr/bin/perl -p -# Eleet filter, Copyright 1999 by Joey Hess under the terms of the GNU GPL. +# Eleet filter, Copyright 1999,2002 by Joey Hess under the terms of the GNU GPL. BEGIN { - $transstring="4bcd3fgh1jklmn0pqr5+uvwxyz"; - $t="tr/a-zA-Z/$transstring".uc($transstring)."/"; + # abcdefghijklmnopqrstuvwxyz + $transstring="4bcd3fgh1jklmn0pqr5tuvwxyz"; + $t="tr/a-zA-Z/$transstring$transstring/"; } +s/porn/pr0n/g; +s/elite/l33t/g; eval $t; -s:h:|-|:ig; -s:l:|_:ig; -s:m:/\\/\\:ig; -s:n:/\\/:ig; -s:v:\\/:ig; -s:x:><:ig; + +# These are not in common usage anymore. +#s:h:|-|:ig; +#s:l:|_:ig; +#s:m:/\\/\\:ig; +#s:n:/\\/:ig; +#s:w:\\/\\/:ig; +#s:v:\\/:ig; +#s:x:><:ig; diff --git a/filters.6 b/filters.6 index 9499740..62f8b56 100644 --- a/filters.6 +++ b/filters.6 @@ -1,8 +1,14 @@ .TH FILTERS 6 .SH NAME -ken, b1ff, chef, cockney, eleet, fudd, jethro, jibberish, jive, kraut, ky00te, newspeak, nyc, rasterman, studly, upside-down \- assorted text filters +ken, b1ff, censor, chef, cockney, eleet, fudd, jethro, jibberish, jive, kraut, ky00te, newspeak, nyc, rasterman, spammer, studly, upside-down \- assorted text filters .SH SYNOPSIS $SHELL | chef + + newspeak < thesis.tex > newthesis.tex + + eleet | wall # b1ff works well too + + b1ff | bitchx | censor .SH "DESCRIPTION" All of these programs are filters to do all sorts of strange things to text. No racial or societal slurs are intended. For amusement only. @@ -24,7 +30,8 @@ Hillbilly text filter .IP jive Jive English .IP jibberish -Runs text through all the rest of the filters, to make really weird output. +Runs text through a random selection of the rest of the filters, to make really +weird output. .IP ken English into Cockney, featuring (dubious) rhyming slang for a lot of computer terminology. @@ -35,10 +42,14 @@ This program places a very cute (and familiar to FurryMuck fans) accent on any text file. .IP newspeak A-la-1984 +.IP censor +CDA-ize text .IP nyc Brooklyn English .IP rasterman Makes text look like it came from the keyboard of Carsten Haitzler. +.IP spammer +Turns honest text into something that is liable to be flagged as spam. .IP studly Studly caps. .IP upside-down @@ -46,9 +57,9 @@ Flips text upside down. Stand on your head and squint to read the output. .SH "SEE ALSO" .IP /usr/share/doc/filters/SAMPLES Lists samples of the output of all the filters. -.SH AUTHOR -The eleet, upside-down, chef, and b1ff filters were written by Joey -Hess . Daniel V Klein wrote the +.SH AUTHORS +The eleet, upside-down, chef, b1ff, and censor filters were written by +Joey Hess . Daniel V Klein wrote the cockney, jive, and nyc filters. jibberish is by Raul Miller , jethro is by Duane Paulson , rasterman is by Zachary Beane, ken is by diff --git a/jibberish b/jibberish index d5197b8..b4f219d 100644 --- a/jibberish +++ b/jibberish @@ -1,5 +1,5 @@ #!/usr/bin/perl -# jibberish -- run all filters in random order +# jibberish -- run filters in random order $ENV{PATH}.=":/usr/games"; @@ -18,6 +18,8 @@ ky00te rasterman newspeak studly +censor +spammer ); # shuffle order @@ -30,9 +32,9 @@ for (0..$#all) { } # start the pipe... -my $pipe= join '|', @all; +my $pipe= join '|', @all[0..3 + rand(5)]; open FILTER, "$pipe|" - or die ""Never mind...\n";; + or die "Never mind...\n"; # display the results while () { diff --git a/studly b/studly index 8e69d9b..21a4d02 100755 --- a/studly +++ b/studly @@ -11,4 +11,3 @@ for (my $offset = 0; defined(my $c = getc); $offset++) { # (($c + $offset) % 4) == 2 and print (ord($c) ^ 32) or print($c); (($c + $offset) % 4) != 2 and print($c) or $c =~ tr/[A-Za-z]/[a-zA-Z]/, print $c; } - -- 2.30.2