Angry Kitchen Appliances


 Software for Unix

  1. Program: ip_decoder
  2. Program: readlink
  3. Program: stat
  4. Download
  5. Links

 ip_decoder

 Description

The ip_decoder program reads a, possibly truncated, IP packet from standard input (as blank or newline separated hex format bytes) and outputs a decoded description of the IP packet.

The intended use was to decode the first 48 bytes of the IP packet that that triggered the last connection as displayed by the D-Link DI-106 ISDN router in Menu 24.1, but any source for the IP packet bytes can be used. There is no requirement that the IP packet must be 48 bytes either, ip_decoder decodes what it can from the bytes it is given.

 Example

# ip_decoder
Enter IP packet as hex bytes separated by blanks or newlines.
End with ^d after last line.
45 00 00 54 19 5F 40 00 FE 01 23 F3 C0 A8 0A 02 C0 47 B4 64 08 00 0D 51
47 51 00 00 3C CA 5A F9 00 01 20 96 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13
^D
Decoded IP packet:
 IP header
  Protocol              = 1 ICMP
  Source address        = 192.168.10.2
  Destination address   = 192.71.180.100
 ICMP
  Type of message       = 8 Echo request
  Type sub code         = 0 N/A
# 

Read the README file.

 readlink

 Description

The readlink program takes a number of filenames as arguments and then resolves symbolic links showing the final filename (even after chained symbolic links).

The intended use is in shell scripts.

 Example

# readlink /etc/rc2.d/S88*
/etc/rc2.d/S88exim @ /etc/init.d/exim
/etc/rc2.d/S88utmpd ! /etc/rc2.d/S88utmpd
# 

Read the README file.

 stat

 Description

The stat program is a command line interface to the stat(2) system call. The information about the file can be selected and displayed in various ways. One use of stat is to use it as a custom ls or to get file information in shell scripts instead of trying to parse the varying output from ls -l.

 Example

# stat /etc/rc2.d/S88exim

File               :  /etc/rc2.d/S88exim
File mode          :  120777    u:rwx g:rwx o:rwx link                      
Link to            :  ../init.d/exim
Link to (absolute) :  /etc/init.d/exim
Inode number       :  144199
Device ID          :  32,0
Special device ID  :  N/A
Number of links    :  1
User ID            :  0         (root)
Group ID           :  1         (other)
Size in bytes      :          14
Allocated size     :        1024
Last access        :  2002-04-27 11:01:54
Last modification  :  2001-12-07 18:47:58
Last status change :  2001-12-07 18:47:58

# stat -f "%n %A %l (%L)\n" /etc/rc2.d/S88exim
/etc/rc2.d/S88exim  ->  ../init.d/exim (/etc/init.d/exim)
# stat -n -A -l -L /etc/rc2.d/S88exim
/etc/rc2.d/S88exim  ->  ../init.d/exim /etc/init.d/exim
# stat -f "%10rs %n\n" /etc/rc2.d/S88*
        14 /etc/rc2.d/S88exim
       597 /etc/rc2.d/S88utmpd
# 

 Note

This is a work in progress since 1988. There are still code in the source to handle ancient Unix systems. However, the old code has not been in use for quite some time. The code is still in K&R C for consumption by old compilers. New Unix versions may need adaptions, e.g. the door file was added in later Solaris releases. Look in config.h if the compile fails, it may be enough to change some #defines there.

Read the manual page.

 Download

 Source code.

 Compiled program and Source code.

 Links

 


The page has been visited 888888 times since 2002-04-01.
Last modified 2003-10-14 18:31:34 (built 2010-03-10 23:57:16).
Copyright © 2002-2010 Göran Larsson. All rights reserved.