Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: one-liner hogs

by jynx (Priest)
on Feb 01, 2001 at 04:01 UTC ( [id://55606]=note: print w/replies, xml ) Need Help??


in reply to one-liner hogs


And how about one for disk hoggage:
perl -e '(open T "/tmp/f.$t" and print T "disk\n"x256; close T) while +(++$t);'
That should work. If not a little variation should be close enough. There are probably more efficient ways to do this, but that's the first thing off the top of my head...

HTH,
jynx

Replies are listed 'Best First'.
Re: Re: one-liner hogs
by baku (Scribe) on Feb 01, 2001 at 22:22 UTC

    For disc overflows:

    not perl, but works:

    cat /dev/zero > /tmp/.#overflow#

    Of course, could also be

    perl -e 'open T,">/tmp/.#overflow#";open F,"</dev/zero";while(<F>){pri +nt T;};'

    Or the 'smarter'(?) way to completely overflow a machine (but probably only as root):

    perl -e 'open M,"/sbin/mount|grep -v':'";while(<M>){($m)=split($_);if( +fork){open Z,"</dev/zero";open F,">$m/.#overflow#";while(<Z>){print F +}}};'

    But that's WAY too much to memorize, da?

      Ah, I think you've accidentally stumbled upon an obfuscated hog of a different kind. Consider:

      open(ZERO,"</dev/zero") or die $!; my $x= <ZERO>;
      I think I'll let someone else explain what that does so people have a little time to think about it. (:

              - tye (but my friends call me "Tye")

        Serves me right for working on a machine with no /dev/zero.... argh.

        The <> operator will seek $/, never find it, and just fill memory to the rlimit. Not great for a disc test.

        That makes the 'line' read:

        perl -e 'open M,"/sbin/mount|grep -v':'";while(<M>){($m)=split($_); if(fork){open Z,"</dev/zero";open F,">$m/.#overflow#";while(read(Z, $x,4096)){print F $x}}};

        Bleh.

        cat /dev/zero > /tmp/kill.system

        Less effective, but easier to type. And probably a good way to muck up 90% of systems :-)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2024-04-19 19:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found