Re: your mail

From: Mordechai T. Abzug (mortyat_private)
Date: Tue Dec 02 1997 - 04:38:29 PST

  • Next message: Ryan Murray: "Re: in.telnetd bug (linux)"

    Szekely-Benczedi Endre spake thusly:
    
    >         There is a nice small shell script at www.rootshell.com,
    > longpath.sh, wich exploits some bug in Linux about long pathnames...
    [snip]
    > I heard that it is possible to erase it with mc (Midnight Commander).
    > Well, I can tell you' this ISN'T true ;-)
    > I tried the script on a RedHat Linux, and... well... I can't erase the
    > directory now ;-)
    >         I wonder if anyone of you knows the problem, and can help me with
    > that..
    
    #!/usr/local/bin/perl5
    
    # this basically does an rm -r, only on directories.  Be careful.  :)
    
    $junk="junk.$$";
    
    mkdir $junk, 0700 || die "$0: $!";
    
    $seq=0;
    sub newseq { return ($seq++);}
    
    foreach (@ARGV) {
            rename $_, $junk."/".&newseq || die "$0: $!";
    }
    chdir $junk || die "$0: $!";
    
    $current=0;
    
    while ($current<$seq) {
            foreach (glob "$current/*") {
                    rename $_, "./".&newseq || die "$0: $!";
            }
            $current ++;
    }
    
    foreach (glob "*") {
            rmdir ($_) || die "$0: $!";
    }
    chdir ".." || die "$0: $!";
    rmdir $junk || die "$0: $!";
    
    
    
    
    Just give it the name of the top-level evil directory (making sure to run
    it in the same filesystem), and it'll clean things up.  Next time, be more
    careful.  :)
    
    --
                            Mordechai T. Abzug
    "Grad school is the snooze button on the clock-radio of life."
     - comedian John Rogers (who holds a graduate degree in physics)
    



    This archive was generated by hypermail 2b30 : Fri Apr 13 2001 - 13:34:04 PDT