[ create a new paste ] login | about

Link: http://codepad.org/1bSzuxz8    [ raw code | fork ]

Semtex-Primed - Perl, pasted on Jan 6:
#!/usr/bin/perl
use IO::Socket;
@header = (
        "\n\n\t\t|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|\n",
        "\t\t|+|     Exploiter 0.1a      |+|\n",
        "\t\t|+|    ~ Semtex-Primed ~    |+|\n"
);
@options = (
        "\t\t|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|\n",
        "\t\t|+| 1. Connect to server    |+|\n",
        "\t\t|+| 2. Close                |+|\n",
        "\t\t|+|                         |+|\n",
        "\t\t|+|+|+|+|+|+|+|+|+|+|+|+|+|+|+|\n"
);
while(1) {
    system("clear");
    print @header;
    print @options;
    print "\t\tWhat is your option? \n";
    print "\t\t>>> ";
    $choice = <STDIN>;
    chomp ($choice);
    if($choice eq "1") {
        my $sock = new IO::Socket::INET (
            PeerAddr => 'netbook1-linux',
            PeerPort => '8880',
            Proto => 'tcp',
            );
            die "\t\tCould not create socket: $!\n" unless $sock;
            print $sock "\t\tConnected!!\n";
            while ($sock) {
                print "\t\tConnected, here's your choices\n";
                print "\t\t1. Enter command\n";
                print "\t\t2. quit\n";
                print "\t\t>> ";
                $choice = <STDIN>;
                chomp ($choice);
                if ($choice eq "2") {
                    close($sock);
                    exit($sock);
                    last
                } elsif ($choice eq "1") {
                    print "\t\tEnter Command! \n";
                    print "\t\t>> ";
                    $data2send = <STDIN>;
                    chomp ($data2send);
                    $sock->send($data2send);
                    close $sock;
                    last;
                }
            }
    } elsif($choice eq "2") {
        exit
    }
}


Create a new paste based on this one


Comments: