P
P
PapiRUS902021-06-15 20:01:46
bash
PapiRUS90, 2021-06-15 20:01:46

How, using a while loop, the dig command to display the A-records of the domain in the ips.txt file, after which, on the next line, the PTR-record of the IP?

Started writing the script:

#!/bin/bash
dig google.com +noall +answer +short >> ips.txt
dig -x -f ips.txt +short >> ips2.txt

But it is not possible to use the -f switch for dig .
If you manually insert ip
dig -x 64.233.165.138 +short >> ips2.txt
, then there is no problem. And the list doesn't work.
And it's not clear yet how to use the while command in this script.
Thanks in advance for any help, otherwise Google will ban me soon, for ddos

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
SOTVM, 2021-06-16
@sotvm

quotes "

S
Saboteur, 2021-06-16
@saboteur_kiev

#!/bin/bash
IP=$(dig ${1} +noall +answer +short)
echo ${IP} >> ips.txt
dig -x ${IP} +short >> ips2.txt

and run
./myscript.sh google.com

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question