On Friday, May 24, 2002, at 08:23 , Leon, Yanet I,,DMDCWEST wrote:

[..]
> s/^\#(shell\s.*tcp\s.*\sin.rshd)$/$1/;
>
> I want to call the above script from another longer one to just perform 
> the
> replacement passing a file name as the argument.  The lines on the calling
> file should look as follows:
> :
> Some other steps.
> :
> #Editing myfile lines
>
> $myfile="/scratch/scripts/filetoedit";
>
> I must call the substitute script here passing $myfile as argument.

I know that you are technically asking for a way to
'invoke this 'external' script - but why not be a
bit more perlish about the attack profile.

keeping the original executable out there is a great thing.
don't get me wrong, and system, is an alternative - but since
you want to call this from a larger programme - I do hope
that you were not planning to modify the file and then
read it in????

        sub mungeFile {
                my ($file) =    @_ ;
                my @ret_lines;
                
                die "no such file - $file" unless(-f $file);
                # safety check
                my $outfile = $file . '.bak';

                open(FH, $file) or die "unable to open inputfile:$!\n";
                open(OUTFH, ">$file.tmp) or die "unable to open outputfile:$!\n";

                while(<FH>) {
                        if (s/^\#(shell\s.*tcp\s.*\sin.rshd)$/$1/) {
                                print OUTFH $1;
                                push(@ret_lines, $1);
                        }else{
                                print $_ ;
                                push(@ret_lines, $1);
                        }
                }

                close(FH);
                close(OUTFH);

                return(@ret_lines);
        }

but since you have a regEx that really can only target
/etc/inetd.conf - why not simply call the original script

        OpenRshdInInetd.conf
                        
ciao
drieux

---

ps: do give my regards to the Tiger Team...


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to