fix function to get ips and hostnames from net

This commit is contained in:
Jakobus Schürz 2024-03-07 17:14:24 +01:00 committed by Jakobus Schürz
parent c766602cc3
commit 53bdc127e8

View file

@ -1104,7 +1104,7 @@ getfreeip () {
local N=$1
sudo nmap -v -sn -n $1 -oG - | awk '/Status: Down/{print $2}'
nmap -v -sn -n ${N} -oG - | awk '/Status: Down/{print $2}'
}
@ -1113,13 +1113,31 @@ getusedip () {
local N=$1
local DNS=$2
sudo nmap -v -sn -n $1 -oG - | awk '!/Status: Down/{print $2}'|while read i;do
echo "$i: $(dig "${DNS:+@}${DNS}" -x $i +short +search)"
nmap -v -sn -n $1 -oG - | awk '!/Status: Down/{print $2}'|while read i;do
echo "$i: $(dig ${DNS:+@}${DNS:-} -x $i +short +search)"
done
}
getips () {
local N=$1
local DNS=$2
nmap -v -sn -n $1 -oG - | while read i
do
j=$(echo "$i"|awk '{print $2}')
case $i in
*Status:\ Down*)
echo "$j: $(dig ${DNS:+@}${DNS:-} -x $j +short +search)"
;;
*Status:\ Up*)
echo "$j:"
;;
esac
done
}
function getdbcreds_jra () {
local APP_INST=/opt/atlassian/jira
local JRA_HOME=$(awk -F "=" '/jira.home/ {gsub(/ /, "", $0); print $2}' "${APP_INST}/atlassian-jira/WEB-INF/classes/jira-application.properties")