Mianowicie
Kod: Zaznacz cały
#!/bin/bash
telnet "jakieś IP"
"tu podaje login wpisane już do skryptu"
"tu podaje hasło wpisane już do skryptu"
"polecenie1" "enter"
sleep 20 "enter"
"polecenie2" "enter"
exit
PS koniecznie musi to być telnet
Kod: Zaznacz cały
#!/bin/bash
telnet "jakieś IP"
"tu podaje login wpisane już do skryptu"
"tu podaje hasło wpisane już do skryptu"
"polecenie1" "enter"
sleep 20 "enter"
"polecenie2" "enter"
exit
Kod: Zaznacz cały
read user;
read host;
stty -echo; read pass; stty echo;
sleep 2
echo $pass
sleep 5
echo exit
done | telnet -l $user $host
Kod: Zaznacz cały
#!/bin/sh
# Date: Thu, 3 Feb 2005
# Shell script to start a connection to another host using telnet and
# keep the connection "alive". While the telnet session is running,
# this shell script will also be running.
# It uses redirection operators (pointing to the current TTY to avoid
# blocking 'stdin'), and a FIFO (pipe) to communicate the reader
# program (cat) with the telnet program.
# To exit you have to end the telnet process ('quit' command) and
# then input an ENTER or ^D (EOF) character to 'cat' (so it ends).
# Example values are prefixed with "example-" (change them to real ones).
FIFO="/tmp/fifo"
HOST="10.0.0.138"
USER="moj_login"
PASS="moje_haslo"
PORT="" # leave empty for default (23)
TTY=`tty`
# To communicate telnet and TTY.
mkfifo $FIFO
# Start telnet, reading from the FIFO and outputting everything to
# the current TTY. Wait 3 seconds, log in, wait 3 seconds and run
# cat, that reads from the TTY and outputs to the FIFO (that is
# read by telnet).
telnet -l $USER $HOST $PORT < $FIFO 2>&1 > $TTY &
sleep 3; echo $PASS > $FIFO; sleep 3;
cat > $FIFO < $TTY
# Clean up (delete FIFO).
rm $FIFO
# Exit.
exit 0
Kod: Zaznacz cały
mkfifo: nie można utworzyć potoku `/tmp/fifo': File exists
Trying 10.0.0.138...
Connected to 10.0.0.138.
Escape character is '^]'.
Connection closed by foreign host.
Kod: Zaznacz cały
Trying 10.0.0.138...
Connected to 10.0.0.138.
Escape character is '^]'.
Connection closed by foreign host.
Kod: Zaznacz cały
pwd; ls -la
Kod: Zaznacz cały
cat > $FIFO < $TTY
Kod: Zaznacz cały
use Net::Telnet ();
$t = new Net::Telnet (Timeout => 10,
Prompt => '/bash\$ $/');
$t->open("$remote_host");
$t->login($username, $passwd);
@lines = $t->cmd("who");
print @lines;
Kod: Zaznacz cały
Prompt => '/\$ $/i');
Kod: Zaznacz cały
#!/bin/sh
telnet 192.168.4.1 218
Użytkownicy przeglądający to forum: Obecnie na forum nie ma żadnego zarejestrowanego użytkownika i 8 gości