TCP-/UDP-сокет средствами bash

Настройка, программирование, распределённые вычисления

Модераторы: Olej, bellic, vikos

Аватара пользователя
Olej
Писатель
Сообщения: 21338
Зарегистрирован: 24 сен 2011, 14:22
Откуда: Харьков
Контактная информация:

TCP-/UDP-сокет средствами bash

Непрочитанное сообщение Olej » 30 окт 2016, 16:49

Заинтересовала вот эта статья: Как открыть TCP-/UDP-сокет средствами командной оболочки

Проверил относительно аппаратного роутера TP-LINK TL-WR841N в собственной LAN:

Код: Выделить всё

[olej@dell media]$ timeout 1 cat </dev/tcp/192.168.1.3/22
SSH-2.0-dropbear_2012.55
Вот такой:
Изображение

Никогда не подумал бы что там в нём есть SSH-сервер (в документации ведь ничего не пишут).

Но войти в него с теми административными рег-данными admin:admin, что работают через WEB-интерфейс, не проходит:

Код: Выделить всё

[olej@dell media]$ ssh admin@192.168.1.3
The authenticity of host '192.168.1.3 (192.168.1.3)' can't be established.
RSA key fingerprint is SHA256:EMCNYC12Xvlh7oObJr+U6zQHk1OtOZUN/B59ZAj5y5M.
RSA key fingerprint is MD5:34:bf:03:8b:01:69:12:fd:b2:be:28:56:05:69:54:56.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.3' (RSA) to the list of known hosts.
admin@192.168.1.3's password: 
PTY allocation request failed on channel 0
shell request failed on channel 0
WEB-интерфейс регистрируется исправно.
Изображение

Аватара пользователя
Olej
Писатель
Сообщения: 21338
Зарегистрирован: 24 сен 2011, 14:22
Откуда: Харьков
Контактная информация:

Re: TCP-/UDP-сокет средствами bash

Непрочитанное сообщение Olej » 30 окт 2016, 23:59

Olej писал(а): Но войти в него с теми административными рег-данными admin:admin, что работают через WEB-интерфейс, не проходит:

Код: Выделить всё

[olej@dell ~]$ ssh -v admin@192.168.1.3 sh
OpenSSH_7.2p2, OpenSSL 1.0.2j-fips  26 Sep 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 58: Applying options for *
debug1: Connecting to 192.168.1.3 [192.168.1.3] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/olej/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/olej/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/olej/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/olej/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/olej/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/olej/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/olej/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/olej/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2
debug1: Remote protocol version 2.0, remote software version dropbear_2012.55
debug1: no match: dropbear_2012.55
debug1: Authenticating to 192.168.1.3:22 as 'admin'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: diffie-hellman-group14-sha1
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha1 compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha1 compression: none
debug1: kex: diffie-hellman-group14-sha1 need=20 dh_need=20
debug1: kex: diffie-hellman-group14-sha1 need=20 dh_need=20
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
debug1: Server host key: ssh-rsa SHA256:zOAJ/rn0jOV/LvgDoLizwQRKFxJrNyuHH8klAca7FLI
debug1: Host '192.168.1.3' is known and matches the RSA host key.
debug1: Found key in /home/olej/.ssh/known_hosts:11
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /home/olej/.ssh/id_rsa
debug1: Trying private key: /home/olej/.ssh/id_dsa
debug1: Trying private key: /home/olej/.ssh/id_ecdsa
debug1: Trying private key: /home/olej/.ssh/id_ed25519
debug1: Next authentication method: password
admin@192.168.1.3's password: 
debug1: Authentication succeeded (password).
Authenticated to 192.168.1.3 ([192.168.1.3]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending environment.
debug1: Sending env XMODIFIERS = @im=none
debug1: Sending env LANG = ru_RU.utf8
debug1: Sending command: sh
exec request failed on channel 0
Т.е.
- вход - ОК
- аутентификация (password) - OK
- но там нет ... или нет возможности запустить командный интерпретатор sh

Ответить

Вернуться в «Сети»

Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и 8 гостей