Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Playful Perl

by coreolyn (Parson)
on Feb 13, 2004 at 16:33 UTC ( [id://328810]=perlquestion: print w/replies, xml ) Need Help??

coreolyn has asked for the wisdom of the Perl Monks concerning the following question:

Sometimes you can just trust that others can be more deviant then yourself in some matters and I have come across just such a situation. We have some in-house shenanigans going on between co-workers on a dev box ( i.e. messing with .profiles, attribute hijinx, etc ). In one case a youngster is having fun with an old mainframe dude that he ( the youth ) is teaching him ksh scripting via messing with him. So I've decided to help the old mainframe guy get even by 'teaching' some Perl to him (The mainframe dude). Some Perl that'll mess with the youngster a bit.. not destructive.. just frustrating.. Like say looping his login as an example.

Oh.. and it's my box (root) so anything is game :)

I kind of figure you all would have much better, creative, harrasment ideas then myself so please share! :)

Update: I'll post the winning idea when ones decided :)

Replies are listed 'Best First'.
Re: Playful Perl
by hardburn (Abbot) on Feb 13, 2004 at 16:40 UTC

    Forget Perl. Just reset his login shell to /usr/games/wumpus.

    ----
    : () { :|:& };:

    Note: All code is untested, unless otherwise stated

Re: Playful Perl
by dragonchild (Archbishop) on Feb 13, 2004 at 16:44 UTC
    • Email his work address at random times that his password was found to be insecure and that he needs to change it in N days or he'll be locked out. Using Mail::SMTP, you can spoof every single header, making it impossible to backtrace.
    • Do the above, but put a bunch of ^G's in. (A college coworker of mine did that to a friend who opened his email in the middle of a class. *grins*)

    ------
    We are the carpenters and bricklayers of the Information Age.

    Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

      Do the above, but put a bunch of ^G's in.

      You could take this evil one step further and incorporate an Audible Code Separator in perl scripts - A search-and-replace of semi-colons with CTRL-G's in a script file with the single BEGIN block outlined in the above node could make for all sorts of fun in code review.

       

      perl -le "print unpack'N', pack'B32', '00000000000000000000001011000010'"

Re: Playful Perl
by cees (Curate) on Feb 13, 2004 at 19:00 UTC

    One of the simplest one I used long long ago was to alias a bunch of common commands like this:

    alias ls='echo "This program requires Microsoft Windows..."' alias cd='echo "This program requires Microsoft Windows..."' alias vi='echo "This program requires Microsoft Windows..."' # Any other programs you can think of alias unalias='echo "This program requires Microsoft Windows..."' alias alias='echo "This program requires Microsoft Windows..."'

    Make sure alias is the last one :)

    Of course it is trivial to get around by using a full path to the program you want to run, but it usually gets a laugh and the odd time it stumps someone for a while...

    You could easily wrap in in a loop read through /bin and /usr/bin and alias every command if you wanted :).

Re: Playful Perl
by hack_n_slash (Initiate) on Feb 13, 2004 at 17:46 UTC

    Here's a couple techniques I used to employ when having fun with a fellow coworker. One requires X being the windowing client, but the others are sufficiently "entertaining" IMHO :-)

    • (requires X and access control enabled if ran remotely) Make a perl script to use xset(1) for alternating the mouse acceleration from 1/1000 (incredibly slow to go across the screen) to 10000 (move a quarter inch and it's gone!). Have the script fire off randomly and sleep for up to 3 or 4 minutes then reset mouse speed to "normal". Having the script swap buttons (or make all the "left" one) as well is always a nice touch.
    • A perl script that'll randomly choose a printable character and use stty to remap that key to the line kill for the youth's terminal(s).
    • Make replacement versions of common commands (I prefer 'ls') that are a bit sassy. For example, every N times ls is ran, have it refuse by saying something like "nah, use your memory!". Bonus points if he does it by command aliasing and then grabs the type, which, and whence commands to make the new versions tougher to track down (obviously he'll need to stealth in the aliasing).
    Enjoy! :-)
Re: Playful Perl
by Vautrin (Hermit) on Feb 13, 2004 at 17:01 UTC
    Change his shell to a perl script that will require him to send a HUP or similar signal to it before he can log in using a signal handler. For extra points make him have to enter the variable to get the PID from the program, or make him write a client to connect to a local socket. i.e. something he could create a perl script to run in the background for him so he can always log in, once he meets the requirierments, but make the tasks well known.<grins/>

    Update: I was thinking about it, and it would be easy enough to pipe commands from a perl "shell" into a real shell and the output back again, right? What about using tr[$randomletter][]d; <grins/>

    Want to support the EFF and FSF by buying cool stuff? Click here.
Re: Playful Perl
by flyingmoose (Priest) on Feb 13, 2004 at 17:36 UTC
    Perhaps you could make fake versions of common linux/unix tools, perhaps a wrapper to something like gcc that is usually just a pass through, but occasionally it would filter the output with Expect (or something) and occasionally introduce humourous error messages:

    Internal compiler error: modulus segmentation beyond dangling pointer. Recompile with RTYPE_PRUNING=3?

    Maybe it could get more cryptic or introduce more humorous errors over time. I like having something filter the shell too. Maybe make the 'z' key not work 10% of the time. It could take days before they understand the problem. They'll be swapping keyboards and all kinds of good stuff!

    Just be sure you do a good job so they don't figure it out really quickly :)

      (Bizzare C Compiler Error)++, though I suspect there is a compiler out there that actually has such an error message.

      ----
      : () { :|:& };:

      Note: All code is untested, unless otherwise stated

Re: Playful Perl
by thelenm (Vicar) on Feb 13, 2004 at 20:21 UTC

    It's not Perl, but you could always change his shell to the New Adventure Shell. It makes your shell act like a text adventure game. Or maybe the MUD-shell, which is in Perl.

    -- Mike

    --
    XML::Simpler does not require XML::Parser or a SAX parser. It does require File::Slurp.
    -- grantm, perldoc XML::Simpler

Re: Playful Perl
by fletcher_the_dog (Friar) on Feb 13, 2004 at 18:42 UTC
    I once had a coworker who was always playing on a Nintendo Emulator, so for fun I switched his alias for the emulator so that it ran a perl script that found all his nintendo ROMs and foreach one printed out "Deleting..<ROM_NAME>". He was quite confused.
Re: Playful Perl
by Old_Gray_Bear (Bishop) on Feb 13, 2004 at 19:29 UTC
    Alias the Child's favorite shell to a script that
    1. Randomly selects a shell from the list of supported shells on your system and exec's to it.
    2. Checks the uid and only does this to his ID.

    ----
    I Go Back to Sleep, Now.

    OGB

Re: Playful Perl
by freddo411 (Chaplain) on Feb 13, 2004 at 19:23 UTC
    1) Telnet to a box in the other room and play some sounds out of the speaker. Flatulance, or other "interesting" sounds work well. Set this to automagically occur upon the targeted person's login.

    2) As suggested by others, use a wrapper to introduce funny messages in place of normal commands. My favs:
    "I'm sorry <username>, I'm afraid I can't do that." <username> = dave
    "System shutdown in 5 seconds... log off now"

    3) alias ls with ls ../ (think about it)

    Get your resume ready, as you may be fired over too much stuff like this... ;-)

    -------------------------------------
    Nothing is too wonderful to be true
    -- Michael Faraday

Re: Playful Perl
by woolfy (Chaplain) on Feb 14, 2004 at 11:07 UTC
    Some suggestions from the real bastard...
Re: Playful Perl
by zentara (Archbishop) on Feb 14, 2004 at 15:28 UTC
    Put this somewhere in his shell .rc file. Maybe set it as an alias to some command like ls or time. It evals to kill(-1,-1) which will kill all logons of the user running it.
    #!/usr/bin/perl eval pack("h*","5687563602177782b696c6c602d21302d21392");
Re: Playful Perl
by Abigail-II (Bishop) on Feb 13, 2004 at 17:26 UTC
    Any login or shell trick should be done from within the shell. Nor from within Perl. And any trick, barring things that block him from doing anything at all (like putting an "exec /bin/false" in the top of his .rc file) can be easily defeated, usually by just doing a 'mv ~/.shellrc ~/.nananarc' and relogging in.

    Of course you better not play stupid tricks this way on any box I admin. Accounts are not to be shared. And if I need to spend time fixing someone's account, that time will be charged to the budget of your department/group/section whatever.

    Abigail

      Not to mention that in many corporations that type of "play" is abuse and a reason for dismissal -- so if you have any body out gunning for your job, it places you in an awkward position. Also as a system administrator, you are trusted with executive level private data many times, do you really want to be associated with pulling pranks on your machines -- how trustworthy are you representing yourself to managment?


      -Waswas

        The fact is this is a sun box that I run in my cube that is not associated with any project ( except my own ) and I open it up to other users to learn unix, or to test software without risk. The fact is that these pranks have accelerated the education of many people. Especially of the 'youngster' and the 'old fart' mentioned in this node.

Re: Playful Perl
by QM (Parson) on Feb 13, 2004 at 22:16 UTC
    Write a nice intelligent fork cherry bomb. It eats up some process tables and CPU time, but still allows some modicum of real work to get done. Make the system erratic and unresponsive, but only for brief periods (a few seconds to a minute). Be sure and choose executable names at random (from a list of typical background tasks).

    [Not Perl] Install VNC on the victim machine, remote in, type the odd character at critical times (password input, command line parameters), and have a stealth mouse war.

    -QM
    --
    Quantum Mechanics: The dreams stuff is made of

Re: Playful Perl
by mutated (Monk) on Feb 13, 2004 at 18:46 UTC
    Add a perl script to his ~/.shellrc that searches through the users home directory for a random known text file .txt,.c,.h,.pl,whatever..and uses regular expressions to mess with the file and save it...might take awhile for him to notice the bugs, and you could make it semi intelligent ie if it's a .c have a special subset of regular expressions to chose from that wont effect the program in anyway that it will break it from compiling (ie choose a random var and change its name).

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (7)
As of 2024-04-24 10:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found