telnet in scripten

snowyrain

Neuer User
Mitglied seit
31 Jul 2006
Beiträge
125
Punkte für Reaktionen
0
Punkte
16
Hallo,

ich würde gerne in einem mini Script einen Befehl mit Telnet senden und auf die Antwort reagieren.

Die Befehle sehen so aus:
Code:
Beispiel für korrektes Einfügen eines neuen Timers: (abfragen des Wertes 250) 
/var/mod/root # telnet 192.168.2.116 2001
220 linvdr SVDRP VideoDiskRecorder 1.4.5-Toxic-Ed.; Sat Jan 20 12:12:14 2007
NEWT 1:2:2007-11-21:2000:2200:60:50:TELE_TIMER:
250 2 1:2:2007-11-21:2000:2200:60:50:TELE_TIMER:
quit
221 linvdr closing connection
Connection closed by foreign host.
/var/mod/root #



Beispiel: Einfügen eines schon vorhandenen Timers: (abfragen des Wertes 550)
/var/mod/root # telnet 192.168.2.116 2001
220 linvdr SVDRP VideoDiskRecorder 1.4.5-Toxic-Ed.; Sat Jan 20 12:13:04 2007
NEWT 1:2:2007-11-21:2000:2200:60:50:TELE_TIMER:
550 Timer already defined: 2 1:2:2007-11-21:2000:2200:60:50:TELE_TIMER:
quit
221 linvdr closing connection
Connection closed by foreign host.
/var/mod/root # 


Beispiel: Übertragen eines unbekannten Befehls (abfragen des Wertes 500)
/var/mod/root # telnet 192.168.2.116 2001
220 linvdr SVDRP VideoDiskRecorder 1.4.5-Toxic-Ed.; Sat Jan 20 12:13:38 2007
1:2:2007-11-21:2000:2200
500 Command unrecognized: "1:2:2007-11-21:2000:2200"
quit
221 linvdr closing connection
Connection closed by foreign host.
/var/mod/root #

Beispiel: Übertragen eines unkorrekten Timers (abfragen des Wertes 501)
/var/mod/root # telnet 192.168.2.116 2001
220 linvdr SVDRP VideoDiskRecorder 1.4.5-Toxic-Ed.; Sat Jan 20 12:13:51 2007
NEWT 1:2:2007-11-21:2000:2200
501 Error in timer settings
quit
221 linvdr closing connection
Connection closed by foreign host.
/var/mod/root #

Mit: echo -e "NEWT 1:2:2007-12-21:2000:2200:60:50:TELE_TIMER1:" | telnet 192.168.2.116 2001 bekomme ich keine Antwort.
Wie kann ich das machen?

Gruß

Snowyrain
 
NC ist deine Lösung...

Hoi,

Schau dir doch mal "nc" an.

Beispiel-Script:
Code:
#!/bin/sh
nc smtp.web.de 25 >&1 <<EOF
HELO
quit
EOF
exit

Ausgabe:
Code:
phil@philipp ~ $ sh test.sh
220 smtp05.web.de ESMTP WEB.DE V4.107#114 Sat, 20 Jan 2007 23:25:27 +0100
501 syntactically invalid HELO argument(s)
221 smtp05.web.de closing connection

Ich hoffe das hilft dir weiter.

Gruß Phil
 
Kostenlos!

Statistik des Forums

Themen
248,117
Beiträge
2,281,852
Mitglieder
377,328
Neuestes Mitglied
Meich3000