Portál AbcLinuxu, 2. listopadu 2025 20:29
$netstat --help 2>>&1 | grep truncate
-W, --wide don't truncate host names
no ja som uz help samozrejme presiel ale nic take som tam nenasiel duben@stream_gw:~$ netstat -W netstat: invalid option -- W - aku mate verziu ? duben@stream_gw:~$ netstat -V net-tools 1.60 netstat 1.42 (2001-04-15) Fred Baumgarten, Alan Cox, Bernd Eckenfels, Phil Blundell, Tuan Hoang and others +NEW_ADDRT +RTF_IRTT +RTF_REJECT +FW_MASQUERADE +I18N AF: (inet) +UNIX +INET +INET6 +IPX +AX25 +NETROM +X25 +ATALK -ECONET -ROSE HW: +ETHER +ARC +SLIP +PPP +TUNNEL +TR +AX25 +NETROM +X25 +FR -ROSE -ASH -SIT -FDDI -HIPPI -HDLC/LAPB -EUI64
bzcat ../54_all_net-tools-1.60-wide.patch.bz2 | patch -p1 patching file man/en_US/netstat.8 patching file netstat.c Hunk #5 FAILED at 932. Hunk #6 FAILED at 1042. Hunk #7 FAILED at 1051. 3 out of 11 hunks FAILED -- saving rejects to file netstat.c.rejpotom napriek chybam som to skusil skompilovat
cc -D_GNU_SOURCE -O2 -Wall -g -I. -idirafter ./include/ -Ilib -I/usr/src/net-tools-1.60 -idirafter /usr/src/net-tools-1.60/include -c -o inet_sr.o inet_sr.c inet_sr.c: In function `INET_setroute': inet_sr.c:108: error: label at end of compound statement make[1]: *** [inet_sr.o] Error 1 make[1]: Leaving directory `/usr/src/net-tools-1.60/lib' make: *** [subdirs] Error 2ale z tohoto sa uz neviem dostat nevie mi niekto poradit ?
#!/usr/bin/python
import struct, socket
statuslist = ["",
"ESTABLISHED",
"SYN_SENT",
"SYN_RECV",
"FIN_WAIT1",
"FIN_WAIT2",
"TIME_WAIT",
"CLOSE",
"CLOSE_WAIT",
"LAST_ACK",
"LISTEN",
"CLOSING"]
def inethex_toa(inethex):
n = int(inethex, 16)
p = struct.pack("L", n)[:4]
return socket.inet_ntoa(p)
def hexhostport_toa(hexhostport):
hh, ph = hexhostport.split(':')
ha = inethex_toa(hh)
pn = int(ph, 16)
return [ha, '%d' %pn]
fr = file('/proc/net/tcp')
fr.readline()
for line in fr:
l = line.split()[1:4]
loc = hexhostport_toa(l[0])
rem = hexhostport_toa(l[1])
s = int(l[2], 16)
status = statuslist[s]
tabsjoined = '\t'.join(loc + rem + [status])
print tabsjoined.expandtabs(15)
Eventuelně (po úpravě) také z /proc/net/tcp6.
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.