mirror of
https://github.com/byReqz/conn.git
synced 2025-07-01 10:30:48 +00:00
Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
3ca589818b |
66
README.md
66
README.md
@ -1,29 +1,32 @@
|
|||||||
# conn
|
# conn
|
||||||
|
|
||||||
|
__this branch has been merged into main and is no longer maintained__
|
||||||
|
|
||||||
quick and dirty server availability check <br> <br>
|
quick and dirty server availability check <br> <br>
|
||||||
basically just a way too complex wrapper for nmap and fping <br>
|
basically just a way too complex wrapper for nmap and fping <br>
|
||||||
the pre-rewrite version is available as conn.sh.old and is no longer maintained <br>
|
|
||||||
|
|
||||||
### features:
|
### features:
|
||||||
- ~~multi-input detection~~ (not needed anymore since the rewrite)
|
- multi-input detection
|
||||||
- ~~ipv4 input detection~~ (not needed anymore since the rewrite)
|
- ipv4 input detection
|
||||||
- ~~ipv6 input detection~~ (not needed anymore since the rewrite)
|
- ipv6 input detection
|
||||||
- waiting for availability
|
- waiting for availability
|
||||||
- send notification on availability
|
- send notification on availability
|
||||||
- updater built in
|
- updater built in
|
||||||
|
|
||||||
# usage
|
# usage
|
||||||
Usage: conn <args> [IP(s)/hostname(s)] <br>
|
Usage: conn (options) [ip] <br>
|
||||||
Options: <br>
|
Options: <br>
|
||||||
-h / --help show help page (this) <br>
|
-m/--multi -- test multiple ips / disable portscan <br>
|
||||||
-6 / --force-ipv6 force ipv6 portscanning (also forces portscanning) <br>
|
-h/--help -- show help <br>
|
||||||
-4 / --force-ipv4 force ipv4 portscanning (also forces portscanning) <br>
|
-6/--force-ipv6 -- force ipv6 portscanning (also forces portscanning) <br>
|
||||||
-y / --yes portscan without asking <br>
|
-4/--force-ipv4 -- force ipv4 portscanning (also forces portscanning) <br>
|
||||||
-n / --no dont portscan <br>
|
-y/--yes -- portscan without asking <br>
|
||||||
-w / --wait wait for active connection <br>
|
-n/--no -- dont portscan <br>
|
||||||
-u / --update update the script <br>
|
-p/--portscan -- same as -y <br>
|
||||||
-f / --fast disable os check <br>
|
-w/--wait -- wait for active connection <br>
|
||||||
-s / --simple simplify output <br>
|
-u/--update -- update the script <br>
|
||||||
|
-f/ --fast -- disable os check <br>
|
||||||
|
-s/ --simple -- same as -f <br>
|
||||||
|
|
||||||
# installation
|
# installation
|
||||||
1. download the script: <br>
|
1. download the script: <br>
|
||||||
@ -43,33 +46,28 @@ chmod +x conn.sh && ./conn.sh
|
|||||||
|
|
||||||
# sample output
|
# sample output
|
||||||
```bash
|
```bash
|
||||||
./conn.sh nils.lol
|
checking connection status for localhost
|
||||||
checking connection status for nils.lol
|
|
||||||
-------------------Availability----------------------
|
-------------------Availability----------------------
|
||||||
nils.lol is alive (35.5 ms)
|
localhost is alive (545 ms)
|
||||||
note: this seems to be a linux machine
|
note: this seems to be a linux machine
|
||||||
-----------------------------------------------------
|
-----------------------------------------------------
|
||||||
portscan? (y/n) (default: y)
|
|
||||||
|
|
||||||
-------------------Portscan---------------------
|
-------------------Portscan---------------------
|
||||||
Starting Nmap 7.92 ( https://nmap.org ) at 2021-12-05 13:42 CET
|
Starting Nmap 7.91 ( https://nmap.org ) at 2021-02-15 15:07 CET
|
||||||
Nmap scan report for nils.lol (168.119.185.158)
|
Nmap scan report for localhost (127.0.0.1)
|
||||||
Host is up, received user-set (0.048s latency).
|
Host is up, received user-set (0.047s latency).
|
||||||
Not shown: 995 filtered tcp ports (no-response)
|
Other addresses for localhost (not scanned): ::1
|
||||||
|
Not shown: 998 closed ports
|
||||||
|
Reason: 998 conn-refused
|
||||||
PORT STATE SERVICE REASON
|
PORT STATE SERVICE REASON
|
||||||
21/tcp open ftp syn-ack
|
|
||||||
22/tcp open ssh syn-ack
|
22/tcp open ssh syn-ack
|
||||||
80/tcp open http syn-ack
|
631/tcp open ipp syn-ack
|
||||||
81/tcp closed hosts2-ns conn-refused
|
Nmap done: 1 IP address (1 host up) scanned in 3.23 seconds
|
||||||
443/tcp open https syn-ack
|
|
||||||
|
|
||||||
Nmap done: 1 IP address (1 host up) scanned in 5.54 seconds
|
localhost : [0], 64 bytes, 0.185 ms (0.185 avg, 0% loss)
|
||||||
|
localhost : [1], 64 bytes, 0.058 ms (0.122 avg, 0% loss)
|
||||||
|
localhost : [2], 64 bytes, 0.060 ms (0.101 avg, 0% loss)
|
||||||
|
localhost : [3], 64 bytes, 0.081 ms (0.096 avg, 0% loss)
|
||||||
|
|
||||||
nils.lol : [0], 64 bytes, 36.5 ms (36.5 avg, 0% loss)
|
localhost : xmt/rcv/%loss = 4/4/0%, min/avg/max = 0.058/0.096/0.185
|
||||||
nils.lol : [1], 64 bytes, 35.7 ms (36.1 avg, 0% loss)
|
|
||||||
nils.lol : [2], 64 bytes, 34.7 ms (35.6 avg, 0% loss)
|
|
||||||
nils.lol : [3], 64 bytes, 33.5 ms (35.1 avg, 0% loss)
|
|
||||||
|
|
||||||
nils.lol : xmt/rcv/%loss = 4/4/0%, min/avg/max = 33.5/35.1/36.5
|
|
||||||
------------------------------------------------
|
------------------------------------------------
|
||||||
```
|
```
|
||||||
|
14
conn.sh
14
conn.sh
@ -57,14 +57,7 @@ function get_args {
|
|||||||
|
|
||||||
#quick fix to prevent nslookups interactive mode being triggered by invalid arguments
|
#quick fix to prevent nslookups interactive mode being triggered by invalid arguments
|
||||||
#some other places in the code have also gotten a leading space to prevent similar issues
|
#some other places in the code have also gotten a leading space to prevent similar issues
|
||||||
for v in $input; do
|
input=$(echo "$input" | tr -d "-")
|
||||||
if [[ ! $(echo $v | cut -c1) == "-" ]];then
|
|
||||||
newinput="$newinput $v"
|
|
||||||
else
|
|
||||||
newinput="$newinput $(echo $v | cut -c 2-)"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
input="$newinput"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_argvars {
|
function set_argvars {
|
||||||
@ -93,10 +86,7 @@ function set_argvars {
|
|||||||
|
|
||||||
function validate {
|
function validate {
|
||||||
for arg in $@; do
|
for arg in $@; do
|
||||||
if [[ "$arg" =~ : ]];then
|
if ip route show " $arg" 2&> /dev/null;then
|
||||||
only="-6" # enable ipv6, this needs a more complex function to avoid treating every argument as v6
|
|
||||||
fi
|
|
||||||
if ip route show "$arg" 2&> /dev/null;then
|
|
||||||
hosts="$hosts $arg"
|
hosts="$hosts $arg"
|
||||||
elif nslookup "$arg" > /dev/null;then
|
elif nslookup "$arg" > /dev/null;then
|
||||||
hosts="$hosts $arg"
|
hosts="$hosts $arg"
|
||||||
|
Reference in New Issue
Block a user