Linux com порт сниффер

Linux com порт сниффер

Как просниферить com-порт на linux?
Пробовл запустить прогу, работающую с com портом и minicom
одновременно,
прога пашет, обмен идет, а в миникоме пусто.
Подскажите пожалуйста как увидеть что ушло/пришло из компорта?

  • Как просниферить com-порт на linux, exn, 15:25 , 03-Мрт-07, (1)
    • Как просниферить com-порт на linux, Vaso Petrovich, 15:58 , 03-Мрт-07, (2)
      • Как просниферить com-порт на linux, exn, 16:23 , 03-Мрт-07, (3)
      • Как просниферить com-порт на linux, exn, 16:34 , 03-Мрт-07, (4)
        • Как просниферить com-порт на linux, exn, 16:56 , 03-Мрт-07, (5)
          • Как просниферить com-порт на linux, fantom, 11:12 , 05-Мрт-07, (6)
            • Как просниферить com-порт на linux, chip, 11:09 , 09-Мрт-07, ( 7 )

            >Никак, нет таких фич

            зачем же так категарично? думать надо и все получится 🙂 есть устройсва типа moxa которе сеть в com превращает. даль любимый снифер в руки.

            Для перехвата данных идущих через сом я всегда пытался найти патч(ненавижу это слово)

            Вы имеете ввиду сом превратить в сеть и через сеть обратно в порт ?
            тоесть так ?

            open -> /dev/ttyMOXAвсякое
            tcpdump MOXAФЕЙС
            kernel kernel -> / dev/ttyS0

            а так бывает чтоли ?
            я правильно понял мысль ?

            Очень вас прошу хоть ссылку дайте . хоть немного конкретнее, меня очень заинтересовал
            этот вопрос .

            >зачем же так категарично? думать надо и все получится 🙂 есть устройсва
            >типа moxa которе сеть в com превращает. даль любимый снифер в
            >руки.

            я наверное просто неправильно вас понял, вы имеете ввиду трафик. А я имею ввиду
            низкоуровневый програмный перехват данных идущих в порт, в Линуксе это организовать
            сложно, сильно быстро все переделывают, да и код тяжеловат, тудаб какой printk всунуть
            для порта за радость, тока предварительно изучив много кода и понять что к чему, можно
            извращаться. Хотя для виндоус есть очень толковые снифера, при всем том что исходники
            закрыты. Лично я сломался на ядре и нет желания опять туда лезть.

            Решения есть конечно, но они для 2.0.1 2.2.1 и более не поддерживаються(со времен serial.c)
            2.6.20 накуралесили так что туда и лезть неохота, вот

            имхо, возможно я чегото недопонял

            >http://unix.freshmeat.net/redir/linuxserialsniffer/5870/url_tgz/serial_sniffer-0.5.tar.gz
            >http://unix.freshmeat.net/redir/slsnif/14158/url_tgz/slsnif-0.4.4.tar.gz
            >http://unix.freshmeat.net/redir/serialsnoop/35427/url_tgz/sersnoop-current.tar.gz
            >
            >вот подобной тематики
            >насколько я помню неодин из них не работает так как надо :((
            >

            Спасибо, будем пробовать-смотреть.
            Нужна банальная запись всего что прошлов обоих направлениях через com порт.
            Теоретически идею мне подсказали — «Завернуть все через fifo и смотреть»
            Но моих познаний для попыток проделать подобное нехватает 🙁

            >>http://unix.freshmeat.net/redir/linuxserialsniffer/5870/url_tgz/serial_sniffer-0.5.tar.gz
            >>http://unix.freshmeat.net/redir/slsnif/14158/url_tgz/slsnif-0.4.4.tar.gz
            >>http://unix.freshmeat.net/redir/serialsnoop/35427/url_tgz/sersnoop-current.tar.gz
            >>
            >>вот подобной тематики
            >>насколько я помню неодин из них не работает так как надо :((
            >>
            >
            >Спасибо, будем пробовать-смотреть.
            >Нужна банальная запись всего что прошлов обоих направлениях через com порт.
            >Теоретически идею мне подсказали — «Завернуть все через fifo и смотреть»
            >Но моих познаний для попыток проделать подобное нехватает 🙁

            Можно развернуть идентичную тестовую машину в qemu. Он с помощью ключика -serial умеет перенаправлять вывод в различные направления.

            Высказать мнение | Ответить | Правка | Наверх | Cообщить модератору


            Архив | Удалить

            Индекс форумов | Темы | Пред. тема | След. тема
            Оцените тред (1=ужас, 5=супер)? [ Рекомендовать для помещения в FAQ]

            Источник

            slsnif(1) — Linux man page

            slsnif is a serial line sniffer software. It listens to the specified serial port and writes all data coming through it into either stdout (default) or a log file (if specified — see option -l).

            slsnif operates either by creating a pseudo tty (pty) and linking it to the serial port, or by linking two serial ports together. In order to set up a debug session one has either to start slsnif on a given port first, note the pty it had opened (also available from file /tmp/slsnif_pty while slsnif is running), then configure the controlling software for the device being debugged to use this pty instead of the actual port, or, in case of two ports being used, simply start slsnif on two ports (see option -p) and watch the show 🙂

            Note 1 : Slsnif will try to match port settings on pty and port (or on 1st and 2nd ports) as soon as it detects first chunk of data coming from the «host side» (which is either pty or 2nd port). If it fails (in case of a braindead controlling software that doesn’t set the baudrate correctly), one has an ability to set baudrate by hand via option -s. Controlling software and slsnif should be set up to use the same baudrate, which in turn should match the baudrate used by the device connected to the port.

            Note 2 : If controlling software is running under vmware (www.vmware.com) and pty is used, port in question should be disconnected from vmware before invoking slsnif, and connected to the opened pty after slsnif has been started.

            Parameters

            slsnif accepts the following parameters: (required) First (and only one in case of pty being used) serial port to listen to. (/dev/ttyS0, /dev/ttyS1, etc.)

            Options

            [-l ] ([—log ]) File to direct output to. Output is sent to stdout by default. [-i ] ([—in-tee ]) File to dump raw data from device to. Multiple ‘-i’ / ‘—in-tee’ arguments result in multiple copies of data in corresponding files. [-o ] ([—out-tee ]) File to dump raw data from host to. Multiple ‘-o’ / ‘—out-tee’ arguments result in multiple copies of data in corresponding files. [-s ] ([—speed ]) Baudrate to use. Valid options are:
            50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200.
            Defaults to 9600 baud. [-b] ([—bytes]) Print number of bytes transmitted on every read. [-p ] ([—port2 ]) Use real serial port instead of pty. Useful when one needs to log data going between two ports. [-n] ([—nolock]) Disable locking of the port. Normally not a good idea, but can be very useful if one doesn’t have permissions to write to lock directory (usually /var/lock/) [-t] ([—timestamp]) Print timestamp for every transmission. [-x] ([—hex]) Display hexadecimal ascii values. [-u] ([—unix98]) Use SYSV (Unix98) ptys instead of BSD ptys. [—color ] Color to use for normal output. [—timecolor ] Color to use for timestamp. [—bytescolor ] Color to use for number of bytes transmitted.
            Valid values are:
            black, red, green, yellow, blue, magenta,
            cyan, white, brightblack, brightred,
            brightgreen, brightyellow, brightblue,
            brightmagenta, brightcyan, and brightwhite. [-h] ([—help]) Display help.

            Rc File

            The following options can be specified via rc-file ‘.slsnifrc’, which should be located in the user’s home directory: TOTALBYTES ON/OFF — corresponds to -b (—bytes). TIMESTAMP ON/OFF — corresponds to -t (—timestamp). DISPLAYHEX ON/OFF — corresponds to -x (—hex). NOLOCK ON/OFF — corresponds to -n (—nolock). SYSVPTY ON/OFF — corresponds to -u (—unix98). COLOR — corresponds to —color . TIMECOLOR — corresponds to —timecolor . BYTESCOLOR — corresponds to —bytescolor .

            Options specified via command line always override the ones specified via rc-file.

            Example

            slsnif -n -l log.txt -s 2400 /dev/ttyS1
            Started logging data into file ‘log.txt’.
            Opened pty: /dev/ttyp0
            Saved name of the pty opened into file ‘/tmp/slsnif_pty’.
            Opened port: /dev/ttyS1
            Baudrate is set to 2400 baud.

            Note: pty slsnif has opened is /dev/ttyp0.

            Signals

            SIGHUP signal causes slsnif to move file pointer in all log files back to the beginning. This is useful for example when logfiles are rotated by logrotate. SIGUSR1 signal causes slsnif to re-synchronize settings between ttys at any time. Useful for debugging software that changes port settings in the middle of transmission.

            Источник

            Sniff serial port on Linux

            I tried interceptty (copy at GitHub), and was successful in using it. First I ran it on the port of interest:

            Then I connected the program-under-test to the pseudo-terminal /dev/pts/5 that interceptty created.

            I tried to use slsnif, but I found that I got an error:

            Failed to open a pty: No such file or directory 

            This mailing list item indicates that slsnif only supports the «legacy» pseudo-terminals ( /dev/ttyp0 etc) which are probably not used on current Linux kernels.

            Solution 3

            Try using jpnevulator (debian packaged) or slsniff. Note that slsniff uses a deprecated terminal emulation model.

            Sniff serial port on Linux (3 Solutions!!)

            4 ways communicating with serial port in linux

            Serial Port Sniffer

            RS232 Communication (3) - Linux Serial Port Communication

            FREE Serial Port Sniffer Easiest to Use! Works on RS-485, RS-232-, I2C, & others Sniffer for LabVIEW

            Mike Holdsworth

            (Last updated 2018-08-28.) http://stackoverflow.com/questions/1825585/how-to-determine-what-version-of-powershell-is-installed/1825807#1825807 Experienced application developer. Software Engineer. M.Sc.E.E. C++ (10 years), software engineering, .NET/C#/VB.NET (7 years), usability testing, Perl, scientific computing, Python, Windows/Macintosh/Linux, Z80 assembly. My other accounts: iRosetta. [/]. Stack Overflow (SO). [/]. Server Fault (SF). [/]. Super User (SU). [/]. Meta Stack Overflow (MSO). [/]. Careers. [/]. Other My 15 minutes of fame on Super User Blog. Sample: Jump the shark. LinkedIn profile @PeterMortensen (Twitter) Google profile Quora profile GitHub profile Full jump page with other SOFU related, Stack Exchange sites, etc. Contact I can be contacted through this reCAPTCHA (requires JavaScript to be allowed from google.com).

            Updated on September 17, 2022

            Comments

            If some answers provided answer to your question, you should accept it (meta.serverfault.com/questions/1033/…)

            You can achieve this with standard tools using socat and tee . 1) socat -d -d pty,raw,echo=0 pty,raw,echo=0 . The output will give you two ports . N PTY is /dev/pts/27. N PTY is /dev/pts/28 . 2) sudo cat /dev/ttyS0 | tee /dev/pts/27 and in another terminal sudo cat /deb/pts/27 | tee /dev/ttyS0 . Finally 3) Connect your program to /dev/tty/28 . The two tee commands will dump both directions to the console and forward to/from the actual serial port. Note that the port settings like baudrate must be configured ahead of time.

            You can save the tee stuff to a file, too: cat /dev/pts/27 | sudo tee /dev/ttyS0 serial-caps and xxd will help if it’s a binary protocol: cat /dev/pts/27 | sudo tee /dev/ttyS0 serial-caps | xxd .

            @jtpereyda it looks like your 3rd step should be connect program to /dev/ttyS0. e.g. when I connect PUTTY there to /dev/ttyS0 it correctly shows me that output in step 2 while also communicating with the actual embedded board. BTW you have a typo /deb/pts/27 should be /dev/pts/27 . Also cat /deb/pts/27 | tee /dev/ttyS0 should be cat /dev/pts/27 | sudo tee /dev/ttyS0

            Источник

          • Читайте также:  Wsl linux kernel update package
Оцените статью
Adblock
detector