Mac telnet for linux

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Open source MAC Telnet client and server for connecting to Microtik RouterOS routers and Posix machines via MAC address.

License

haakonnessjoen/MAC-Telnet

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Handle console login options during login process

Git stats

Files

Failed to load latest commit information.

README.markdown

MAC-Telnet for Posix systems

Console tools for connecting to, and serving, devices using MikroTik RouterOS MAC-Telnet protocol.

CURRENTLY UNDER DEVELOPMENT

Warning This repository is in mid-way of adding support for RouterOS v6.43 and up, which does not support the old MD5 authentication method. Expect this to be «alpha quality» for now. The new EC-SRP key sharing and authentication protocol is not implemented in mactelnetd yet.

haakonn/mactelnet contains all four programs:

docker run -it --rm --net=host haakonn/mactelnet mactelnet … docker run -it --rm --net=host haakonn/mactelnet macping … docker run -it --rm --net=host haakonn/mactelnet mndp … docker run -it --rm --net=host haakonn/mactelnet mactelnetd … 

Note that Docker runs containers on isolated internal networks by default. —net=host instructs Docker to provide mactelnet direct access to the host machine’s network interfaces.

Warning Currently untested in new version.

yum -y install wget automake gettext gettext-devel gcc make 

Download source tarball, extract, compile and install:

wget http://github.com/haakonnessjoen/MAC-Telnet/tarball/master -O mactelnet.tar.gz tar zxvf mactelnet.tar.gz cd haakonness*/ ./autogen.sh make all install 

Dependencies: gcc (or similar), automake, autoconf

To install dependencies on Debian/Ubuntu based systems:

apt-get install build-essential autopoint automake autoconf libssl-dev 

Download source tarball, extract, compile and install:

wget http://github.com/haakonnessjoen/MAC-Telnet/tarball/master -O mactelnet.tar.gz tar zxvf mactelnet.tar.gz cd haakonness*/ ./autogen.sh make all install 

Warning Currently untested in new version.

Dependencies: clang (gcc or similar), automake, autoconf

Читайте также:  Canon dr m140 драйвер linux

To install dependencies on Debian/Ubuntu based systems:

pkg install automake autoconf gettext-tools 

Download source tarball, extract, compile and install:

wget http://github.com/haakonnessjoen/MAC-Telnet/tarball/master -O mactelnet.tar.gz tar zxvf mactelnet.tar.gz cd haakonness*/ ./autogen.sh ./configure LDFLAGS=" -L/usr/local/lib" gmake all install 

Install dependencies, download source tarball, extract, compile and install:

wget http://github.com/haakonnessjoen/MAC-Telnet/tarball/master -O mactelnet.tar.gz tar zxvf mactelnet.tar.gz cd haakonness*/ # Install dependencies brew install gettext autoconf automake libtool openssl export GETTEXT_PATH=$(brew --prefix gettext) export OPENSSL_PATH=$(brew --prefix openssl) export PATH="$/bin:$/bin:$PATH" export LDFLAGS="-L$/lib" export CPPFLAGS="-I$/include -I$/include" export CRYPTO_CFLAGS="-I$/include" export CRYPTO_LIBS="-L$/lib $/lib/libcrypto.3.dylib" ./autogen.sh make all install 
# mactelnet -h Usage: mactelnet [-h] [-n] [-a ] [-A] [-t ] [-u ] [-p ] [-U ] | -l [-B] [-t ] Parameters: MAC MAC-Address of the RouterOS/mactelnetd device. Use mndp to discover it. identity The identity/name of your destination device. Uses MNDP protocol to find it. -l List/Search for routers nearby (MNDP). You may use -t to set timeout. -B Batch mode. Use computer readable output (CSV), for use with -l. -n Do not use broadcast packets. Less insecure but requires root privileges. -a Use specified path instead of the default: ~/.mactelnet for autologin config file. -A Disable autologin feature. -t Amount of seconds to wait for a response on each interface. -u Specify username on command line. -p Specify password on command line. -U Drop privileges to this user. Used in conjunction with -n for security. -q Quiet mode. -o Force old authentication algorithm. -h This help. 
$ mactelnet main-router Searching for 'main-router'. found Login: admin Password: Connecting to d4:ca:6d:12:47:13. done 

Example using mac address:

$ mactelnet -u admin 0:c:42:43:58:a5 Password: Connecting to 0:c:42:43:58:a5. done MMM MMM KKK TTTTTTTTTTT KKK MMMM MMMM KKK TTTTTTTTTTT KKK MMM MMMM MMM III KKK KKK RRRRRR OOOOOO TTT III KKK KKK MMM MM MMM III KKKKK RRR RRR OOO OOO TTT III KKKKK MMM MMM III KKK KKK RRRRRR OOO OOO TTT III KKK KKK MMM MMM III KKK KKK RRR RRR OOOOOO TTT III KKK KKK MikroTik RouterOS 6.49 (c) 1999-2021 http://www.mikrotik.com/ [admin@Mikrotik] > 

You can use the well known «expect» tool to automate/script dialogues via mactelnet!

# macping -h Usage: macping [-h] [-c ] [-s ] Parameters: MAC MAC-Address of the RouterOS/mactelnetd device. -s Specify size of ping packet. -c Number of packets to send. (0 = for ever) -h This help. 
# macping 0:c:42:43:58:a5 0:c:42:43:58:a5 56 byte, ping time 1.17 ms 0:c:42:43:58:a5 56 byte, ping time 1.07 ms 0:c:42:43:58:a5 56 byte, ping time 1.20 ms 0:c:42:43:58:a5 56 byte, ping time 0.65 ms 0:c:42:43:58:a5 56 byte, ping time 1.19 ms 5 packets transmitted, 5 packets received, 0% packet loss round-trip min/avg/max = 0.65/1.06/1.20 ms 

Or for use in bash-scripting:

# macping 0:c:42:43:58:a5 -c 2 >/dev/null 2>&1 || ( echo "No answer for 2 pings" | mail -s "router down" my.email@address.com ) 

Thanks to @comed-ian for creating a working proof of concept python script that successfully authenticated using the new authentication method in RouterOS 4.43+, and @kmeaw for porting the code to C, and implementing it in mactelnet.

About

Open source MAC Telnet client and server for connecting to Microtik RouterOS routers and Posix machines via MAC address.

Источник

Mac telnet for linux

NAME

mactelnet - A tool for telneting via MAC addresses

SYNOPSIS

mactelnet [options] MAC-Address|hostname>

DESCRIPTION

This tool enables you to telnet other RouterOS or MAC-Telnetd enabled devices. You can connect to either a hostname or a MAC address. If specified, the hostname (identity) will be looked up via MNDP discovery.

OPTIONS

These programs follow the usual GNU command line syntax. A summary of options is included below. -l This will discover RouterOS or MAC-Telnetd enabled devices. It will list the MAC- address software version, and uptime of every device or machine it discovers. To exit the discovery, use Control + C -n Do not use broadcast packets. A tad less insecure but requires root privileges. This means that ethernet packets will have the specified mac-address as the packet destination, instead of using the ethernet broadcast address. -t Amount of seconds to wait for a response on each interface. If you have several network interfaces, this is the timeout value per interface. -u Specify username. Without this option, you will need to enter the username in a interactive prompt. -p Specify password. Without this option, you will need to enter the password in a interactive prompt. -a Specify the path of the autologin configuration file. The default path for this file is ~/.mactelnet. The format for this file is standard INI file layout. -A Do not use the autologin configuration file. Interactively ask for username and password. -h Show summary of options. -v Show version of program.

SEE ALSO

mndp(1), mactelnetd(1), macping(1).

AUTHOR

mactelnet was written by Håkon Nessjøen haakon.nessjoen@gmail.com>. This manual page was written by Håkon Nessjøen haakon.nessjoen@gmail.com>, for the Debian project (and may be used by others). February 27, 2011 MACTELNET(1)

© 2019 Canonical Ltd. Ubuntu and Canonical are registered trademarks of Canonical Ltd.

Источник

Доступ через MAC с Ubuntu 18.04 Server

В утилите winbox есть такая возможность к настраиваемому оборудованию фирмы Mikrotik подключаться, как через IP&MAC , вот второй способ интересен. Я порой сталкивался, что есть какие-то скрипты позволяющие с системы Ubuntu 18.04 Server подключаться через mac соединение с устройством . Меня это заинтересовало и я начал копать. Пакет mactelnet-client использует разработку Mikrotik (MAC-Telnet protocol) на которой работает подключение через MAC адрес.

ekzorchik@srv-bionic:~$ apt-cache search mactelnet

mactelnet-client — Console tools for telneting and pinging via MAC addresses

mactelnet-server — Telnet daemon for accepting connections via MAC addresses

ekzorchik@srv-bionic:~$ apt-cache show mactelnet-client | grep Version

ekzorchik@srv-bionic:~$ sudo apt-get install mactelnet-client -y

ekzorchik@srv-bionic:~$ whereis mactelnet

mactelnet: /usr/bin/mactelnet /usr/share/man/man1/mactelnet.1.gz

За справкой следует обращаться:

ekzorchik@srv-bionic:~$ mac mactelnet

ekzorchik@srv-bionic:~$ zcat /usr/share/man/man1/mactelnet.1.gz

Чтобы просканировать текущую сеть на наличии устройств к которым можно подключиться через MAC— адрес:

ekzorchik@srv-bionic:~$ mactelnet -l

Searching for MikroTik routers. Abort with CTRL+C.

IP MAC-Address Identity (platform version hardware) uptime

192.168.88.108 64:d1:54:5:bc:ce MikroTik (MikroTik 6.42.6 (stable) RB951Ui-2HnD) up 22 days 7 hours K2RF-4I3T bridge1

192.168.88.254 64:d1:54:66:55:ce slk/office (MikroTik 6.42.6 (stable) RB952Ui-5ac2nD) up 21 days 5 hours 5IC2-8QK6 bridge1

^C → по сочетанию клавиш «Ctrl + C» прерываем выполнение утилиты.

Итак утилита обнаружила, два микротика в локальной сети которые поддерживают подключение через mac-адрес, по сути это как-бы использование утилиты winbox. Ну по крайней мере я пока так себе это вижу.

Попробую подключиться из консоли к одному из Mikrotik:

ekzorchik@srv-bionic:~$ mactelnet 64:d1:54:66:55:ce

Connecting to 64:d1:54:66:55:ce. Connection failed.

Почему не подключилось — не могу знать, может в этот момент устройство было в перезагрузке в связи с обновлением к пример.

В составе установленного пакета mactelnet-client присутствует еще одна утилита именуемая, как macping :

ekzorchik@srv-bionic:~$ sudo macping 64:d1:54:66:55:ce

64:d1:54:66:55:ce 56 byte, ping time 4.15 ms
64:d1:54:66:55:ce 56 byte, ping time 1.78 ms
^C
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 1.78/2.96/4.15 ms

Проверка роутера на доступность через L2— уровень посредством использования утилиты macping:

ekzorchik@srv-bionic:~$ macping 64:d1:54:66:55:ce -c 2

You need to have root privileges to use macping.

Ага, для запуска нужно использовать повышение привилегий через sudo.

Ниже пример проверки доступности устройства и если нет ответа то уведомление о тот что нет ответа.

ekzorchik@srv-bionic:~$ sudo macping 64:d1:54:66:55:ce -c 2 >/dev/null 2>&1 || ( echo «No answer for 2 pings»)

вывода нет значит команда отработала успешно, но если добавить еще команду которая будет при настроенном почтовом клиенте на системе (к примеру ssmtp) уведомлять заинтересованных людей о проблеме с хостом:

ekzorchik@srv-bionic:~$ sudo macping 64:d1:54:66:55:ce -c 2 >/dev/null 2>&1 || ( echo «No answer for 2 pings» | mail -s «router down» support@ekzorchik.ru )

Пока на этом всё, с уважением автор блога Олло Александр aka ekzorchik.

От ekzorchik

Всем хорошего дня, меня зовут Александр. Я под ником — ekzorchik, являюсь автором всех написанных, разобранных заметок. Большинство вещей с которыми мне приходиться разбираться, как на работе, так и дома выложены на моем блоге в виде пошаговых инструкции. По сути блог — это шпаргалка онлайн. Каждая новая работа где мне случалось работать вносила новые знания и нюансы работы и соответственно я расписываю как сделать/решить ту или иную задачу. Это очень помогает. Когда сам разбираешь задачу, стараешься ее приподнести в виде структурированной заметки чтобы было все наглядно и просто, то процесс усвоения идет в гору.

Источник

Оцените статью
Adblock
detector