Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"ss" Parser not working correctly: Entries Missing #561

Open
megabert opened this issue Apr 17, 2024 · 2 comments
Open

"ss" Parser not working correctly: Entries Missing #561

megabert opened this issue Apr 17, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@megabert
Copy link

megabert commented Apr 17, 2024

jc version: 1.25.2
python interpreter version: 3.10.9
ss utility, iproute2-5.9.0

ss-Parser seems not to be working correctly:

a) raw ss output

export LC_ALL=C;ss -tulpen | grep :443 | cut -c1-100
tcp   LISTEN 0      511                       1.2.3.43:443        0.0.0.0:*    users:(("apache2",pid...
tcp   LISTEN 0      511                       1.2.3.32:443        0.0.0.0:*    users:(("apache2",pid...
tcp   LISTEN 0      511                       1.2.3.31:443        0.0.0.0:*    users:(("apache2",pid...
...

b) resulting jc output

export LC_ALL=C;ss -tulpen | jc --ss | jq .|grep "[^0-9]443"

# no output at all

There should be three blocks like this one for port 443:

# export LC_ALL=C;ss -tulpen| jc --ss | jq '.[] | select (.send_q==8443)'

{
  "netid": "tcp",
  "state": "LISTEN 0",
  "recv_q": 16,
  "send_q": 8443,
  "local_address": "[::]",
  "local_port": "*",
  "peer_address": "users:((\"liveconfig/SRVR\",pid=3279783,fd=11),(\"liveconfig\",pid=3279782,fd=11)) ino:788096034 sk:2016 cgroup:/system.slice/liveconfig.service v6only",
  "peer_portprocess": "1 <->"
}

See raw-output-ss.txt for full ss output
raw-output-ss.txt

@kellyjonbrazil
Copy link
Owner

Hi there - thanks for reporting this. I'll have to see why the ss parser is skipping those lines.

@kellyjonbrazil kellyjonbrazil added the bug Something isn't working label Apr 18, 2024
@kellyjonbrazil
Copy link
Owner

This output seems a bit strange. For example, there is no space between Port and Process in the header. Even with a space added I still see parsing issues, so I'll need to take a closer look at what's going on here.

Netid State  Recv-Q Send-Q                    Local Address:Port  Peer Address:PortProcess                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
udp   UNCONN 0      0                               0.0.0.0:50305      0.0.0.0:*    users:(("host",pid=118409,fd=20)) ino:64236321 sk:1 cgroup:/system.slice/xinetd.service <->                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
udp   UNCONN 0      0                               0.0.0.0:33986      0.0.0.0:*    users:(("host",pid=2494612,fd=20)) ino:530312145 sk:2 cgroup:/system.slice/xinetd.service <->                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
udp   UNCONN 0      0                               0.0.0.0:42285      0.0.0.0:*    users:(("host",pid=605248,fd=20)) ino:3006390304 sk:3 cgroup:/system.slice/xinetd.service <->                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants