запуск приложений через php, требующих ввод данных

Discussion in 'PHP' started by kay_rus, 18 Feb 2008.

  1. kay_rus

    kay_rus New Member

    Joined:
    16 Feb 2008
    Messages:
    2
    Likes Received:
    0
    Reputations:
    0
    как запустить приложение через php, чтобы с ним можно было работать как через терминал.

    например rfr pfgecnbnm банальный ncftp?

    пробовал вариации с proc_open, а также PHPShell, но ничего не получается.
     
  2. banned

    banned Banned

    Joined:
    20 Nov 2006
    Messages:
    3,324
    Likes Received:
    1,194
    Reputations:
    252
    PHP:
    system
    Или вот что я нашел:
    HTML:
    Article 9818 of comp.lang.perl:
    Xref: feenix.metronet.com comp.lang.perl:9818 alt.sources:2646
    Path: feenix.metronet.com!internet.spss.com!insosf1.infonet.net!news-feed-1.peachnet.edu!news-feed-2.peachnet.edu!emory!europa.eng.gtefsd.com!howland.reston.ans.net!news.intercon.com!udel!gramps.itd.com!ma.itd.com!jblaine
    From: jblaine@ma.itd.com (Jeff Blaine)
    Newsgroups: comp.lang.perl,alt.sources
    Subject: iarchie: An interactive backend to archie, frontend to NcFTP
    Date: 16 Jan 1994 07:24:28 GMT
    Organization: Space Remote Sensing Center
    Lines: 104
    Distribution: world
    Message-ID: <2haq3c$jnm@gramps.itd.com>
    NNTP-Posting-Host: ma.itd.com
    
    This is a backend to archie (slash) frontend to NcFTP.
    You must have archie and NcFTP to make use of this script (as well as perl).
    Let me know what you think.
    
    #!/usr/local/bin/perl
    #
    # Interactive Archie for terminals.
    # Jeff Blaine, 1994, jblaine@ma.itd.com
    #
    # READ THIS:
    # This is NOT an archie implementation.  You must have archie
    # installed as well as NcFTP to use this perl code to interactively
    # (ahem) search for and retrieve files.
    #
    # You can get NcFTP from cse.unl.edu:/pub/mgleason/ncftp
    # You can get archie from nic.sura.net:/pub/archie/clients
    #
    # iarchie should be called exactly like your copy of archie (same
    # args you always use).  Example usage:
    #
    # prompt% iarchie -h archie.ans.net filename.tar.Z
    #
    # Please see the end of this Perl script for more commented information.
    #
    # INSTALLER: Define NCFTP to point to your copy of NcFTP.  That's all.
    $NCFTP = '/usr/code/sun/bin/ncftp';
    
    $VERSION = '1.0';
    
    $ia_tmp = "iarchie.tmp";
    $0 = iarchie;
    $| = 1;                                        # Flush stdout on all writes.
    
    if ($ARGV[0] eq "") {
    	&usage;
    	exit (1);
    }
    print "Connecting to archie server and retrieving information...\n";
    print "";
    unlink ("$ia_tmp");                             # Remove any old temp file.
    system ("archie -l @ARGV > $ia_tmp");           # Call archie.
    &parse_archie;                                  # Parse output from archie.
    &print15;                                        # Menu and select.
    unlink ("$ia_tmp");                             # Remove temp file.
    
    sub usage {
    	print "Usage:\n";
    	print "   $0 uses all of the same options as the c-archie package.\n";
    	print "   Type 'man archie' to see those options.\n";
    }
    
    sub parse_archie {
    	open (INFILE, "$ia_tmp") || die "Couldn't open $ia_tmp\n";
    	while (<INFILE>) {
    		if ($_ ne '\n') {
    			@curr = split;
    			$ncftp_line = $curr[2] . ":" . $curr[3];
    			$ncftp_line = "$ncftp_line\n";
    			push (@ncftp_lines, $ncftp_line);
    		}
    	}
    	close (INFILE);
    	print "\n";
    }
    
    sub print15 {
    	$num = 0;
    	while ($num != 15) {
    		print "$num ) ", $ncftp_lines[$num];
    		$num++;
    	}
    	print "\n";
    	print "Enter a number or 'q' to quit: ";
    	$ch = getc;
    	if ($ch eq "q") {
    		exit (0);
    	} elsif ($ch =~ /[0-15]/) {
    		print "FTPing Number $ch : ", $ncftp_lines[$ch];
    		print "Please wait.";
    		chop ($ncftp_lines[$ch]);
    		system ("$NCFTP $ncftp_lines[$ch]");
    	} else {
    		&print15;
    	}
    }
    
    # TODO:  Make iarchie check args sent to it to match those valid ones
    #        allowed by the archie program.
    #
    #        Allow for more than 15 shown matches (add a 'n' for next page
    #        command)
    #
    #        Write a man page.
    #
    # This code is by no means to be depended on.  It seems to work well
    # for me, and I feel that others will benefit from it, so I am posting
    # it for others to use who have Perl, archie, and NcFTP installed.
    #
    # If you want to hack the hell out of it, be my guest.  If you release
    # a modified version of this iarchie perl script, please be kind and
    # mention my name, Jeff Blaine somewhere. 
    -- 
            J e f f  B l a i n e               jblaine@ma.itd.com
    Perl code: checksummed line-noise with a mission in life.    -- R.L. Schwartz
     
  3. kay_rus

    kay_rus New Member

    Joined:
    16 Feb 2008
    Messages:
    2
    Likes Received:
    0
    Reputations:
    0
    я ncftp только в качестве примера привел.
    основная задача - запустить недавно выложенный эксплоит для linux 2.6.17-2.6.24.1 и запустить команду под рутом.
     
  4. desTiny

    desTiny Elder - Старейшина

    Joined:
    4 Feb 2007
    Messages:
    1,006
    Likes Received:
    444
    Reputations:
    94
    ага=) и команду password=)
     
  5. banned

    banned Banned

    Joined:
    20 Nov 2006
    Messages:
    3,324
    Likes Received:
    1,194
    Reputations:
    252
    kay_rus, через пхп запустить экспойт на перле?
    Или я не догнал
     
  6. ShAnKaR

    ShAnKaR Пачка маргарина

    Joined:
    14 Jul 2005
    Messages:
    904
    Likes Received:
    297
    Reputations:
    553
    переписать сплоит чтоб он не bash запускал а что тебе нужно.