Skip to content

Commit

Permalink
Merge pull request #60 from soubinan/features
Browse files Browse the repository at this point in the history
improve listenning ports printing
  • Loading branch information
soubinan authored Nov 3, 2024
2 parents 87b4286 + 77d61c2 commit caf7343
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-tester.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:
- ".github/publish_build.hurl"
- ".github/workflows/builder.yml"
- ".github/workflows/build-tester.yml"
- "./__layout.k"

jobs:
init:
Expand Down
6 changes: 3 additions & 3 deletions __layout.k
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,7 @@ _welcome_msg_cron = """\
_welcome_msg_script = """\
#!/bin/bash

ports=$(ss -ptuln | grep -vE 'systemd|next-router|next-render|127.0.0.|%lo' | awk '/^tcp/ && $4 !~ /^(127\.|::1|0\.0\.0\.0)/ {print $5}' | awk -F: '{print $NF}' | sort -u)
ports=$(ss -ptuln '( sport > :1023 or sport = :80 or sport = :443 )' | grep -vE 'systemd|next-router|next-render|127.0.0.|%lo' | awk '/^tcp/ && $4 !~ /^(127\.|::1|0\.0\.0\.0)/ {print $5}' | awk -F: '{print $NF}' | sort -u)
num_ports=$(echo $ports | wc -l)
ips=$(ip a|grep 'inet '|awk '{print $2}')

Expand All @@ -1046,15 +1046,15 @@ printf '+-----------------------------------+\\n'
printf '| %-33s |\\n' '${_app_name} is listening on'

while read -r ip; do
printf '| %-33s |\\n' \" => $ip\"
printf '| %-33s |\\n' " => $ip"
done <<< $ips

printf '+------------+----------------------+\\n'
printf '| %-10s | %-20s |\\n' 'Ports' 'Process'
printf '+------------+----------------------+\\n'

while read -r port; do
application=$(ss -lptn \"sport = :$port\" | tail -n +2 | awk '{print $6}' | cut -d'\"' -f2 | sort -u)
application=$(ss -lptn "(sport = :$port)" | tail -n +2 | awk '{print $6}' | cut -d'"' -f2 | sort -u)
printf '| %-10s | %-20s |\\n' $port $application
done <<< $ports

Expand Down

0 comments on commit caf7343

Please sign in to comment.