Showing posts with label Port. Show all posts
Showing posts with label Port. Show all posts

14 May 2026

How to get inventory information of all the hosts on a network?

nmap -A -T4 -oN network_scan.txt 192.168.2.0/24

  • -A (Aggressive / Advanced Scan): This is a convenient shortcut that enables four powerful features at once:
    • OS Detection: Attempts to identify the operating system of the target.
    • Version Detection: Probes open ports to determine the exact software and version numbers running on the services.
    • Script Scanning: Runs a default set of Nmap Scripting Engine (NSE) scripts to gather extra information or spot common vulnerabilities.
    • Traceroute: Maps the network path taken from your machine to the target.
  • -T4 (Aggressive Timing): This timing template tells Nmap to run a faster, more aggressive scan. It assumes you are on a reasonably fast and reliable network and makes adjustments (like reducing the wait times between probes and capping timeouts) to speed up execution.
  • -oN (Normal Output): This tells Nmap to save the results to a text file in a human-readable format. You must follow this flag with your desired file name (e.g., -oN scan_results.txt).

  •  

    ================= 

    $ sudo nmap -sV -O -R --dns-servers 192.168.0.1 -T4 -vv -oN network_scan.txt 192.168.0.0/24

    -sV: service version detection 

    -O: OS identification

    -R: Force reverse DNS lookup for all hosts

    --system-dns: Use your system's DNS resolver (often better on home networks)

    -T4: Faster scan timing (good balance between speed and accuracy)

    -v or -vv: Increase verbosity so you see hostnames as they are discovered

    -oN: Then you can open network_scan.txt with any text editor

     

    23 February 2026

    Knowing port number, how to kill a process which is using that port?

    • Find what's sitting on the port:  

      $ sudo lsof -i :8000 (Replace 8000 with your port)

    • Kill that specific listener:  

      $ sudo kill -9 <PID_FROM_LSOF>


    If I am running -

    $ gunicorn --bind 0.0.0.0:8000 app:app
    [2026-02-23 10:38:25 -0500] [250191] [INFO] Starting gunicorn 25.1.0
    [2026-02-23 10:38:25 -0500] [250191] [INFO] Listening at: http://0.0.0.0:8000 (250191)
    [2026-02-23 10:38:25 -0500] [250191] [INFO] Using worker: sync
    [2026-02-23 10:38:25 -0500] [250191] [INFO] Control socket listening at /home/shermanchen/dev/convShop2/gunicorn.ctl
    [2026-02-23 10:38:25 -0500] [250193] [INFO] Booting worker with pid: 250193

     

    When I run lsof, I get -

    $ sudo lsof -i :8000                           
    COMMAND     PID        USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME                            
    gunicorn 250191 shermanchen    3u  IPv4 1077472      0t0  TCP *:8000 (LISTEN)                 
    gunicorn 250193 shermanchen    3u  IPv4 1077472      0t0  TCP *:8000 (LISTEN) 

     

    If I kill the 'booting worker' pid 250193, the gunicorn will not be killed.  I have to kill the 'listening' pid 250191, to kill the gunicorn process.

    $ sudo kill -9 250191

      

    If I use ps, I got

    $ ps aux | grep gunicorn                       
    sherman+  250690  0.0  0.0   9824  2172 pts/1    S+   10:45   0:00 grep --color=auto gunicorn 
     

    Killing pid 250690 will not kill the gunicorn process.

    28 June 2016

    How to check if a port is open or blocked?

    How to check if a port is open or blocked?

    Method 1: Use 'Netcat' (alias: 'nc')
                      nc -zvv IP port

    Method 2: http://www.canyouseeme.org/

    Method 3: http://www.yougetsignal.com/tools/open-ports/

    23 June 2015

    SysAid - In RDS list, can not see the machine I have installed RDS software on

    Problem: SysAid - In RDS list, can not see the machine I have installed RDS software on

    Solution: On the machine I have installed RDS on, go to the folder -

    C:\Program Files\SysAidRemoteDiscovery\root\WEF_INF\root, open the text file -

    Discovery Services.properties

    There are two lines containing the IP address of the SysAid server. The first one is with the port 8080, the second one without.

    What we need to do is to just add ':8080' at the end of the second line of IP address.

    Save it. Restart the RDS service.

    Done.