Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
Infoblox Dns Helperscripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
Infoblox Dns Helperscripts
Commits
2c6f18c9
Commit
2c6f18c9
authored
2 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
add search for ip address; fix cname as 1st param
parent
af3bb5c7
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+6
-5
6 additions, 5 deletions
README.md
dns-search.sh
+19
-8
19 additions, 8 deletions
dns-search.sh
with
25 additions
and
13 deletions
README.md
+
6
−
5
View file @
2c6f18c9
...
...
@@ -32,7 +32,7 @@ Search for aliases and hosts.
Search for hostnames or aliases in Infoblox API
It uses dns-api.sh and adds the return field for aliases.
SYNTAX: dns-search.sh [name|alias|cname] REGEX
SYNTAX: dns-search.sh [name|alias|cname
|ipv4addr
] REGEX
EXAMPLES:
...
...
@@ -50,13 +50,14 @@ The search supports regex:
dns-search.sh name "^(connector|examinator).*measured.stage"
(4)
Lazy mode: do not add name or alias or cname to start 3 requests to search
search for an IP - use "ipv4addr" as 1st parameter
dns-search.sh ipv4addr .79.30
(5)
Lazy mode: do not add name or alias or cname to start 4 requests to search
in all object types
dns-search.sh ufive
Search for hostnames or aliases in Infoblox API
It uses dns-api.sh and adds the return field for aliases.
```
### dns-api.sh
...
...
This diff is collapsed.
Click to expand it.
dns-search.sh
+
19
−
8
View file @
2c6f18c9
...
...
@@ -9,8 +9,10 @@
# 2022-03-01 v1.1 <axel.hahn@iml.unibe.ch> fix usage with 1st param "name"
# 2022-03-03 v1.2 <axel.hahn@iml.unibe.ch> no param: 2 searches in name and alias
# 2022-06-14 v1.3 <axel.hahn@iml.unibe.ch> added search for cname objects; debug comments are written to stderr
# 2022-09-13 v1.4 <axel.hahn@iml.unibe.ch> add search for ip address; fix cname as 1st param
# ======================================================================
returnFields
=
'&_return_fields%2B=aliases,ttl'
# ----------------------------------------------------------------------
# HELP
...
...
@@ -21,7 +23,7 @@ cat <<EOH
Search for hostnames or aliases in Infoblox API
It uses dns-api.sh and adds the return field for aliases.
SYNTAX: dns-search.sh [name|alias|cname] REGEX
SYNTAX: dns-search.sh [name|alias|cname
|ipv4addr
] REGEX
EXAMPLES:
...
...
@@ -39,7 +41,11 @@ The search supports regex:
dns-search.sh name "^(connector|examinator).*measured.stage"
(4)
Lazy mode: do not add name or alias or cname to start 3 requests to search
search for an IP - use "ipv4addr" as 1st parameter
dns-search.sh ipv4addr .79.30
(5)
Lazy mode: do not add name or alias or cname to start 4 requests to search
in all object types
dns-search.sh ufive
...
...
@@ -51,7 +57,7 @@ fi
# MAIN
# ----------------------------------------------------------------------
mytype
=
if
echo
"
$1
"
|
grep
-E
'^(name|alias|cname)$'
>
/dev/null
if
echo
"
$1
"
|
grep
-E
'^(name|alias|cname
|ipv4addr
)$'
>
/dev/null
then
mytype
=
$1
shift
1
...
...
@@ -62,16 +68,21 @@ mysearch=$1
# ----------------------------------------------------------------------
>
&2
echo
"; === DNS SEARCH"
>
&2
echo
";"
>
&2
echo
"; === INFOBLOX DNS SEARCH"
>
&2
echo
";"
>
&2
echo
"; search for type :
$mytype
"
>
&2
echo
"; search regex :
$mysearch
"
>
&2
echo
";"
if
[
-n
"
$mytype
"
]
;
then
"
$(
dirname
$0
)
"
/dns-api.sh GET
"/record:host?
${
mytype
}
~=
${
mysearch
}
&_return_fields%2B=aliases"
test
"
$mytype
"
=
"cname"
||
"
$(
dirname
$0
)
"
/dns-api.sh GET
"/record:host?
${
mytype
}
~=
${
mysearch
}${
returnFields
}
"
test
"
$mytype
"
=
"cname"
&&
"
$(
dirname
$0
)
"
/dns-api.sh GET
"/record:cname?name~=
${
mysearch
}
&_return_fields%2B=ttl"
else
"
$(
dirname
$0
)
"
/dns-api.sh GET
"/record:host?name~=
${
mysearch
}
&_return_fields%2B=aliases"
"
$(
dirname
$0
)
"
/dns-api.sh GET
"/record:host?alias~=
${
mysearch
}
&_return_fields%2B=aliases"
"
$(
dirname
$0
)
"
/dns-api.sh GET
"/record:cname?name~=
${
mysearch
}
"
for
mytype
in
name
alias
ipv4addr
do
"
$(
dirname
$0
)
"
/dns-api.sh GET
"/record:host?
${
mytype
}
~=
${
mysearch
}${
returnFields
}
"
done
"
$(
dirname
$0
)
"
/dns-api.sh GET
"/record:cname?name~=
${
mysearch
}
&_return_fields%2B=ttl"
fi
# ----------------------------------------------------------------------
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment