Skip to main content
edited tags
Link
added 12 characters in body
Source Link

Distributor ID: Debian

Description: Debian GNU/Linux 10 (buster)

Release: 10

Codename: buster

4.19.0-16-amd64

Distributor ID: Debian

Description:    Debian GNU/Linux 10 (buster)

Release:        10

Codename:       buster

4.19.0-16-amd64

My /etc/apt/sources.list

deb http://security.debian.org/debian-security buster/updates main contrib

deb-src http://security.debian.org/debian-security buster/updates main contrib

deb http://deb.debian.org/debian/ buster-updates main contrib

deb-src http://deb.debian.org/debian/ buster-updates main contrib

deb http://security.debian.org/debian-security buster/updates main contrib

deb-src http://security.debian.org/debian-security buster/updates main contrib

deb http://deb.debian.org/debian/ buster-updates main contrib

deb-src http://deb.debian.org/debian/ buster-updates main contrib

Distributor ID: Debian

Description: Debian GNU/Linux 10 (buster)

Release: 10

Codename: buster

4.19.0-16-amd64

My /etc/apt/sources.list

deb http://security.debian.org/debian-security buster/updates main contrib

deb-src http://security.debian.org/debian-security buster/updates main contrib

deb http://deb.debian.org/debian/ buster-updates main contrib

deb-src http://deb.debian.org/debian/ buster-updates main contrib

Distributor ID: Debian

Description:    Debian GNU/Linux 10 (buster)

Release:        10

Codename:       buster

4.19.0-16-amd64

My /etc/apt/sources.list

deb http://security.debian.org/debian-security buster/updates main contrib

deb-src http://security.debian.org/debian-security buster/updates main contrib

deb http://deb.debian.org/debian/ buster-updates main contrib

deb-src http://deb.debian.org/debian/ buster-updates main contrib
added 153 characters in body; edited tags; edited title
Source Link

bash script to, check if host response on a give port response with bash's built-in /dev/tcp, time delay | hangs | speed up

With this scripts i check if a host is response on a given port with the bash's built-in /dev/tcp.

I can use ip address or domains(hostnames).

Script 1

#!/bin/bash

HOST_NAME="127.1"
HOST_PORT="80"

if ( (exec 3<>/dev/tcp/${HOST_NAME}/${HOST_PORT}) 2> /dev/null); then
    echo -e "PORT: ${HOST_PORT} | ON"
    else
    echo -e "PORT: ${HOST_PORT} | OFF"
fi

exit;

Script 2

#!/bin/bash

HOST_NAME="127.1"

for HOST_PORT in {1..1000}
do

if ( (exec 3<>/dev/tcp/${HOST_NAME}/${HOST_PORT}) 2> /dev/null); then
    echo -e "PORT: ${HOST_PORT} | ON"
    else
    echo -e "PORT: ${HOST_PORT} | OFF"
fi
done

exit;

Script 3

#!/bin/bash

HOST_NAME="127.1"
declare -A PORT_ON

for HOST_PORT in {1..65535}
do
    if ( (exec 3<>/dev/tcp/${HOST_NAME}/${HOST_PORT}) 2> /dev/null); then
        PORT_ON[${HOST_PORT}]="ON"
    fi
done

for i in ${!PORT_ON[*]}
do
    echo -e "$i : ${PORT_ON[$i]}"
done

exit;

On some of our local and online domains Script 3 hangs on some ports and takes longer to jump to the next port scan, for example on ssh(because of firewalls or other services). How can i manage this that it continues straight away and is it possible to speed the script up, it takes a long time, when i scan all 65535 ports an.

My GNU/Linux Distro:

Distributor ID: Debian

Description: Debian GNU/Linux 10 (buster)

Release: 10

Codename: buster

4.19.0-16-amd64

My /etc/apt/sources.list

deb http://security.debian.org/debian-security buster/updates main contrib

deb-src http://security.debian.org/debian-security buster/updates main contrib

deb http://deb.debian.org/debian/ buster-updates main contrib

deb-src http://deb.debian.org/debian/ buster-updates main contrib

I can only install from this repos.

bash script, check port response with bash's built-in /dev/tcp, time delay | hangs | speed up

how can i speed up and terminate the time delay?

bash script to check if host response on a give port with bash's built-in /dev/tcp

With this scripts i check if a host is response on a given port with the bash's built-in /dev/tcp.

I can use ip address or domains(hostnames).

Script 1

#!/bin/bash

HOST_NAME="127.1"
HOST_PORT="80"

if ( (exec 3<>/dev/tcp/${HOST_NAME}/${HOST_PORT}) 2> /dev/null); then
    echo -e "PORT: ${HOST_PORT} | ON"
    else
    echo -e "PORT: ${HOST_PORT} | OFF"
fi

exit;

Script 2

#!/bin/bash

HOST_NAME="127.1"

for HOST_PORT in {1..1000}
do

if ( (exec 3<>/dev/tcp/${HOST_NAME}/${HOST_PORT}) 2> /dev/null); then
    echo -e "PORT: ${HOST_PORT} | ON"
    else
    echo -e "PORT: ${HOST_PORT} | OFF"
fi
done

exit;

Script 3

#!/bin/bash

HOST_NAME="127.1"
declare -A PORT_ON

for HOST_PORT in {1..65535}
do
    if ( (exec 3<>/dev/tcp/${HOST_NAME}/${HOST_PORT}) 2> /dev/null); then
        PORT_ON[${HOST_PORT}]="ON"
    fi
done

for i in ${!PORT_ON[*]}
do
    echo -e "$i : ${PORT_ON[$i]}"
done

exit;

On some of our local and online domains Script 3 hangs on some ports and takes longer to jump to the next port scan, for example on ssh(because of firewalls or other services). How can i manage this that it continues straight away and is it possible to speed the script up, it takes a long time, when i scan all 65535 ports an.

My GNU/Linux Distro:

Distributor ID: Debian

Description: Debian GNU/Linux 10 (buster)

Release: 10

Codename: buster

4.19.0-16-amd64

My /etc/apt/sources.list

deb http://security.debian.org/debian-security buster/updates main contrib

deb-src http://security.debian.org/debian-security buster/updates main contrib

deb http://deb.debian.org/debian/ buster-updates main contrib

deb-src http://deb.debian.org/debian/ buster-updates main contrib

I can only install from this repos.

bash script, check port response with bash's built-in /dev/tcp, time delay | hangs | speed up

With this scripts i check if a host is response on a given port with the bash's built-in /dev/tcp.

I can use ip address or domains(hostnames).

Script 1

#!/bin/bash

HOST_NAME="127.1"
HOST_PORT="80"

if ( (exec 3<>/dev/tcp/${HOST_NAME}/${HOST_PORT}) 2> /dev/null); then
    echo -e "PORT: ${HOST_PORT} | ON"
    else
    echo -e "PORT: ${HOST_PORT} | OFF"
fi

exit;

Script 2

#!/bin/bash

HOST_NAME="127.1"

for HOST_PORT in {1..1000}
do

if ( (exec 3<>/dev/tcp/${HOST_NAME}/${HOST_PORT}) 2> /dev/null); then
    echo -e "PORT: ${HOST_PORT} | ON"
    else
    echo -e "PORT: ${HOST_PORT} | OFF"
fi
done

exit;

Script 3

#!/bin/bash

HOST_NAME="127.1"
declare -A PORT_ON

for HOST_PORT in {1..65535}
do
    if ( (exec 3<>/dev/tcp/${HOST_NAME}/${HOST_PORT}) 2> /dev/null); then
        PORT_ON[${HOST_PORT}]="ON"
    fi
done

for i in ${!PORT_ON[*]}
do
    echo -e "$i : ${PORT_ON[$i]}"
done

exit;

On some of our local and online domains Script 3 hangs on some ports and takes longer to jump to the next port scan, for example on ssh(because of firewalls or other services). How can i manage this that it continues straight away and is it possible to speed the script up, it takes a long time, when i scan all 65535 ports an.

My GNU/Linux Distro:

Distributor ID: Debian

Description: Debian GNU/Linux 10 (buster)

Release: 10

Codename: buster

4.19.0-16-amd64

My /etc/apt/sources.list

deb http://security.debian.org/debian-security buster/updates main contrib

deb-src http://security.debian.org/debian-security buster/updates main contrib

deb http://deb.debian.org/debian/ buster-updates main contrib

deb-src http://deb.debian.org/debian/ buster-updates main contrib

I can only install from this repos.

bash script, check port response with bash's built-in /dev/tcp, time delay | hangs | speed up

how can i speed up and terminate the time delay?

Post Undeleted by CommunityBot
Post Deleted by CommunityBot
added 539 characters in body
Source Link
Loading
added 2 characters in body
Source Link
Loading
deleted 62 characters in body
Source Link
Loading
Source Link
Loading