Academy, Linux Fundamentals. How many services are listening on the target system on all interfaces

Can someone give me a clue for this one please ?

I've tried the following commands none have given me the correct answer;

netstat -tunleep4 | grep -v "127.0.0"

ss -l -4 | grep -v "127.0.0" | grep "LISTEN" | wc -l

Comments

  • @Su8Z3r0 said:

    Can someone give me a clue for this one please ?

    I've tried the following commands none have given me the correct answer;

    netstat -tunleep4 | grep -v "127.0.0"

    ss -l -4 | grep -v "127.0.0" | grep "LISTEN" | wc -l

    So, I'd suggest thinking through what you are trying to do.

    When you run netstat, you want everything that is listening, why are you excluding references to localhost?

    Also I'd double-check the switches you are using with netstat. I find -ano is quite a useful one for general use.

    Lastly, make sure you are running this on the target system, not your system.

    TazWake

    Note: https://www.nohello.com/

    Happy to help people but PLEASE explain your problem in as much detail as possible! If you say vague things like "It's not working", I cant help. This isn't Twitter so my DMs are always open.

  • did u get answer ?

  • I'm wondering about this as well, because every combination I am trying, the answer is still wrong with the output. I've tried netstat -luntp | grep "LISTEN" | wc -l , nmap localhost -p 1-65535 | wc -l, ss -l -4 | grep "LISTEN" | wc -l, but all the output that is returned is still apparently the wrong answer.

  • ss -l -4 | grep -v "127.0.0" | grep "LISTEN" | wc -l

  • ss -l -4 | grep -v "127.0.0" | grep "LISTEN" | wc -l

    i'm not sure why but it didn't look like it let me post the "slashes"

    grep -v "127slash.0slash.0"

  • I find the Question to be a bit misleading given it mentions (Not on localhost and IPv4 only)
    to get the correct answer you have to exclude grep -v "127.0.0"

Sign In to comment.