Carrying a variable through a series of script steps to print that variable's value in the script output

11 réponses [Dernière contribution]
amenex
Hors ligne
A rejoint: 01/03/2015

Here's my dilemma:
The following nmap script looks up the hosts (actually pointers, abbreviated PTR) advertised
by the IPv4 addresses in the target list, Listed-IPv4s.txt (attached):
sudo nmap -Pn -sn -T2 --max-retries 8 -iL Listed-IPv4's.txt -oG - | grep "Host:" '-' | awk '{print $2,$3}' '-' | sed 's/()/(No_DNS)/g' | tr -d '()' | grep -v "No_DNS" '-' > nMap-I-Listed-IPv4s.txt
Followed by the opposite lookup:
sudo nmap -Pn -sn -T2 --max-retries 8 -iL nMap-I-Listed-IPv4s.txt -oG - | grep "Host:" '-' | awk '{print $2,$3}' '-' | sed 's/()/(No_DNS)/g' | tr -d '()' > nMap-II-Listed-IPv4s.txt
Some of the addresses in the first script produce no output at all, and I delete those, as
I cannot look them up any other way now. Some outputs in the second script give the same PTR
results for a series of addresses. Many outputs are a combination of 92.242.140.21 and
unallocated.barefruit.co.uk, which obfuscates both the originating IP address and the
unresolvable PTR that was looked up in the second script.
To maintain the identity associated with each still-active IPv4 in the original Listed-IPv4s.txt
file, I'd like to pass it through the two scripts so one can see the resolvable PTR's and their
(sometimes many) addresses as well as the addresses of the unresolvable PTR's advertised for
the original Listed-IPv4's. Presently, the many unallocated.barefruit.co.uk's are hiding
quite a number (1490 for the attached file) of unresolvable PTR's.

George Langford

Pièce jointeTaille
Listed-IPv4s.txt113.63 Ko
amenex
Hors ligne
A rejoint: 01/03/2015

Another homework assignment for me ...
man export was no help at all; nor sudo apt-get install export

Online I found https://linuxconfig.org/learning-linux-commands-export
which introduced the concept of BUILTINS, and man BUILTINS provides
assurance that export and a lot of other commands, some of which I've taken for
granted, are real.

My first script has an obviously misplaced apostrophe [']:
sudo nmap -Pn -sn -T2 --max-retries 8 -iL Listed-IPv4[']s.txt -oG - | grep "Host:" '-' | awk '{print $2,$3}' '-' | sed 's/()/(No_DNS)/g' | tr -d '()' | grep -v "No_DNS" '-' > nMap-I-Listed-IPv4s.txt

The second script in the original posting wasn't quite right, as nmap expects only
one input variable; here's the correction:
awk '{print $2}' nMap-I-Listed-IPv4s.txt | sudo nmap -Pn -sn -T2 --max-retries 8 -iL '-' -oG - | grep "Host:" '-' | awk '{print $2,$3}' '-' | sed 's/()/(No_DNS)/g' | tr -d '()' > nMap-II-Listed-IPv4s.txt

Applying Lloyd's constructive suggestion depends on syntax which I haven't yet worked out.

My intent is, at each step in the script, to assign the $1 variable to a name called IPv4
and the $2 variable to the name PTR and then to place PTR in the -iL PTR position in the
arguments of nmap and IPv4 in the awk statement printing the outputs: awk '{print IPv4,$2,$3}' '-'

jbar
Hors ligne
A rejoint: 01/22/2011

'export' is a builtin command and you can get info about it with 'help'.

$ help export

$ help help

amenex
Hors ligne
A rejoint: 01/03/2015

Here's my attempt to apply the declare command in my context:
awk '{print $1,$2}' nMap-I-Listed-IPv4s.txt | declare -x IPv4=$1 | declare -x PTR=$2 | awk '{print $2}' nMap-I-Listed-IPv4s.txt | sudo nmap -Pn -sn -T2 --max-retries 8 -iL '-' -oG - | grep "Host:" '-' | sed 's/()/(No_DNS)/g' | tr -d '()' | awk '{print IPv4,PTR,$2,$3}' '-' | awk '{print IPv4,PTR,$2,$3}' '-'|more

The first part of the script extracts the variables IPv4 ($1) and PTR ($2)
from the file (nMap-I-Listed-IPv4s.txt) created by the first script in my
original posting and uses the declare command to assign those two values:
awk '{print $1,$2}' nMap-I-Listed-IPv4s.txt | declare -x IPv4=$1 | declare -x PTR=$2

The second part of my proposed script initiates the nmap command which uses only
the current value of the $2 column in the source file to look up its IPv4 address:
awk '{print $2}' nMap-I-Listed-IPv4s.txt | sudo nmap -Pn -sn -T2 --max-retries 8 -iL '-' -oG -
which has two outputs: The newly retrieved IPv4 address and the value of $2 being
looked up with some extraneous text that is removed with grep, sed, and tr:
grep "Host:" '-' | sed 's/()/(No_DNS)/g' | tr -d '()'

Following the grep command I attempt to retrieve the stored values of IPv4 and PTR:
awk '{print IPv4,PTR,$2,$3}' '-'

Alas, this script runs, but fails to deliver.
I could make a set of 5,672 individual scripts, print a list of all 5,672 pairs, then
hand the variables one-at-a-time to the nmap command, print out another list of 5,672 new
pairs, and then match the lists side-by-side ...

Magic Banana

I am a member!

I am a translator!

Hors ligne
A rejoint: 07/24/2010

$1, $2, ... in a shell script are arguments given to the script, piping in declare (which is not portable) makes no sense, the shell interprets nothing that is between single quotes, etc.

You apparently only want to use 'paste'.

amenex
Hors ligne
A rejoint: 01/03/2015

Magic Banana infers from my scripting attempts that only paste may work.

Paste is handy for building multi-line scripts ...

Here's another attempt:
export PTR | awk -v PTR=$2 '{print $PTR}' nMap-I-Listed-IPv4s.test.txt | sudo nmap -Pn -sn -T2 --max-retries 8 -iL '-' -oG - | grep "Host:" '-' | sed 's/()/(No_DNS)/g' | tr -d '()' | sed 's/Host://g' | sed 's/Status://g' | sed 's/Up//g' | awk '{print $0,declare -p PTR}' '-' |more
and some selected output:
40.77.178.124 msnbot-40-77-178-124.search.msn.com 0
40.77.178.124 msnbot-40-77-178-124.search.msn.com 0
40.77.178.223 msnbot-40-77-178-223.search.msn.com 0
40.77.178.223 msnbot-40-77-178-223.search.msn.com 0
40.77.178.235 msnbot-40-77-178-235.search.msn.com 0
40.77.178.235 msnbot-40-77-178-235.search.msn.com 0
40.77.179.86 msnbot-40-77-179-86.search.msn.com 0
40.77.179.86 msnbot-40-77-179-86.search.msn.com 0
40.77.181.110 msnbot-40-77-181-110.search.msn.com 0
40.77.181.110 msnbot-40-77-181-110.search.msn.com 0
40.77.188.24 msnbot-40-77-188-24.search.msn.com 0
40.77.188.24 msnbot-40-77-188-24.search.msn.com 0
40.77.188.7 msnbot-40-77-188-7.search.msn.com 0
40.77.188.7 msnbot-40-77-188-7.search.msn.com 0
40.77.189.28 msnbot-40-77-189-28.search.msn.com 0
40.77.189.28 msnbot-40-77-189-28.search.msn.com 0

41.13.200.206 vc-gp-n-41-13-200-206.umts.vodacom.co.za 0
41.13.20.163 vc-nat-gp-s-41-13-20-163.umts.vodacom.co.za 0

41.146.154.95 8ta-146-154-95.telkomadsl.co.za 0
41.146.154.95 8ta-146-154-95.telkomadsl.co.za 0

41.189.45.31 ocit-41.189.45.31.aviso.ci 0
92.242.140.21 unallocated.barefruit.co.uk 0
41.236.190.247 host-41.236.190.247.tedata.net 0
92.242.140.21 unallocated.barefruit.co.uk 0

4.14.17.198 COLORADO-SP.ear1.Dallas1.Level3.net 0
4.14.17.198 COLORADO-SP.ear1.Dallas1.Level3.net 0
42.156.138.3 shenmaspider-42-156-138-3.crawl.sm.cn 0
42.156.138.3 shenmaspider-42-156-138-3.crawl.sm.cn 0

42.236.10.100 hn.kd.ny.adsl 0
92.242.140.21 unallocated.barefruit.co.uk 0
42.236.10.103 hn.kd.ny.adsl 0
92.242.140.21 unallocated.barefruit.co.uk 0
...
42.236.99.86 hn.kd.ny.adsl 0
92.242.140.21 unallocated.barefruit.co.uk 0

The identical pairs represent resolvable PTR's;
the non-identical pairs generally represent unresolvable PTR's.
The ...vodacom pair were somehow missed by barefruit error handling.

This script is on the right track:
Nmap was fed two variables (IPv4 and PTR) but only responded to the exported PTR variable.
However, awk's print function responds with both the 1st & 2nd columns (all that remain
after all those sed & tr commands) without regard to which one(s) are explicitly requested.

Without use of the export command, here's what happens:
awk '{print $2}' nMap-I-Listed-IPv4s.test.txt | sudo nmap -Pn -sn -T2 --max-retries 8 -iL '-' -oG - | grep "Host:" '-' | sed 's/()/(No_DNS)/g' | tr -d '()' | sed 's/Host://g' | sed 's/Status://g' | sed 's/Up//g' | awk '{print $1,$2}' '-' |more
and the condensed output:
40.77.178.124 msnbot-40-77-178-124.search.msn.com
40.77.178.223 msnbot-40-77-178-223.search.msn.com
40.77.178.235 msnbot-40-77-178-235.search.msn.com
40.77.179.86 msnbot-40-77-179-86.search.msn.com
40.77.181.110 msnbot-40-77-181-110.search.msn.com
40.77.188.24 msnbot-40-77-188-24.search.msn.com
40.77.188.7 msnbot-40-77-188-7.search.msn.com
40.77.189.28 msnbot-40-77-189-28.search.msn.com
... two missing rows where the ...
... vodacom entries once were ...
41.146.154.95 8ta-146-154-95.telkomadsl.co.za
92.242.140.21 unallocated.barefruit.co.uk
92.242.140.21 unallocated.barefruit.co.uk
4.14.17.198 COLORADO-SP.ear1.Dallas1.Level3.net
42.156.138.3 shenmaspider-42-156-138-3.crawl.sm.cn
92.242.140.21 unallocated.barefruit.co.uk
92.242.140.21 unallocated.barefruit.co.uk
92.242.140.21 unallocated.barefruit.co.uk
92.242.140.21 unallocated.barefruit.co.uk
...
92.242.140.21 unallocated.barefruit.co.uk

Without any of the subsequent text processing:
awk '{print $2}' nMap-I-Listed-IPv4s.test.txt | sudo nmap -Pn -sn -T2 --max-retries 8 -iL '-' -oG - | awk '{print $0}' '-' |more
The script finishes, having skipped the two vodacom entries, with the statement that 42 entries
(of 44 in the source file) were scanned, and all were "up" which is a rare occurrence in my experience.

Pièce jointeTaille
nMap-I-Listed-IPv4s.test_.txt 1.5 Ko
amenex
Hors ligne
A rejoint: 01/03/2015

Lloyd suggested that I substitute
awk -v "variable=$PTR" '{print $0, variable}'
for
awk '{print $0,declare -p PTR}'
at the end of my trial script:
export PTR | awk -v PTR=$2 '{print $PTR}' nMap-I-Listed-IPv4s.test.txt | sudo nmap -Pn -sn -T2 --max-retries 8 -iL '-' -oG - | grep "Host:" '-' | sed 's/()/(No_DNS)/g' | tr -d '()' | sed 's/Host://g' | sed 's/Status://g' | sed 's/Up//g' | awk -v "variable=$PTR" '{print $0, variable}' '-' |more
producing the exact same output without the trailing zero's,
but there should have been three columns, the first two for the outputs of the nmap script
and one for the input (?) value of variable=$PTR, which would have satisfied the original
posting's intent. In my other [rejected] attempts at the script, both columns of the original
file are printed whichever way I preface the script (exporting PTR or IPv4). The most recent two
scripts (Lloyd's and mine) at least produce two lines, an input pair of IPv4 and PTR, followed
by an output pair (nmap's IPv4 and the PTR) not always matching the inputs, except for the two
different vodacom rows, unfortunately.

At present, even placing the input file next to nmap's outputs without any use of export
or awk's -v argument would have almost done the trick, but for nmap's ignoring of the vodacom
inputs, as otherwise nmap's outputs are in the same sequence as the inputs.

This is progress, as there is a comparison between inputs and outputs.

amenex
Hors ligne
A rejoint: 01/03/2015

Noted in some exasperation:
For example:
vc-gp-n-41-13-200-206.umts.vodacom.co.za
Can be almost trivially resolved by stripping the letters,
replacing the dashes (-) with dots (.) and then
using dig -x:
Start with: vc-gp-n-41-13-200-206.umts.vodacom.co.za
Strip out the letters:-41-13-200-206.
Replace the dashes with dots and remove leading & trailing punctuation: 41.13.200.206
dig -x 41.13.200.206:
ANSWER SECTION:
206.200.13.41.in-addr.arpa. 4670 IN PTR vc-gp-n-41-13-200-206.umts.vodacom.co.za

They're not all this straightforward; the octets are often rearranged to hinder resolution,
and there are two dozen permutations of the 1234 octet sequence.

It turns out that the following script:
grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}" <(awk '{print $2}' nMap-I-Listed-IPv4s.test.txt)
Extracts only two IPv4 addresses from the target file, nMap-I-Listed-IPv4s.test.txt:
41.189.45.31
41.236.190.247
And these aren't the two vodacom PTRs' addresses, because the script isn't designed
to handle octets separated by dashes instead of dots.

Another script does gather the eleven dash-separated octets after a single change:
grep -E -o "([0-9]{1,3}[\-]){3}[0-9]{1,3}" <(awk '{print $2}' nMap-I-Listed-IPv4s.test.txt)
40-77-178-124
40-77-178-223
40-77-178-235
40-77-179-86
40-77-181-110
40-77-188-24
40-77-188-7
40-77-189-28
41-13-200-206
41-13-20-163
42-156-138-3

Sed can then be used to change those dashes to dots: sed 's/\-/\./g'
grep -E -o "([0-9]{1,3}[\-]){3}[0-9]{1,3}" <(awk '{print $2}' nMap-I-Listed-IPv4s.test.txt) | sed 's/\-/\./g'
40.77.178.124
40.77.178.223
40.77.178.235
40.77.179.86
40.77.181.110
40.77.188.24
40.77.188.7
40.77.189.28
41.13.200.206
41.13.20.163
42.156.138.3

But those nice-looking IPv4 addresses may still not resolve without being put back in their original order.

Magic Banana

I am a member!

I am a translator!

Hors ligne
A rejoint: 07/24/2010

Noted in some exasperation

What is exasperating is that you keep on asking for help to solve the same problems, showing attempts that always commit the same mistakes that we have explained to you many times.

Two years ago, I wrote for you a simple AWK program that searches, in every input line, numbers below 256. If it finds four consecutive such numbers, it prints the line followed by the four numbers separated by dots, then the same four numbers in the reverse order and finally the same four numbers with the first one moved to the last position: https://trisquel.info/forum/how-can-one-capture-failed-resolve-output-console-during-nmap-scan#comment-141556

Just save it in a directory listed in your PATH variable, turn it executable and use it.

amenex
Hors ligne
A rejoint: 01/03/2015

There are two or more forms of exasperation at play ...
Magic Banana's exasperation is over my age-related difficulty in remembering what I did last week ...
Mine is over the slow response of software developers in updating the dig command to deal with
"advances" in the methods of obfuscating server/Pointer names.

With apologies to Magic Banana, I'm not going to get any younger; I'm concentrating my efforts
on getting older.

Apache servers have been allowing their deprecated gratuitous hostname lookups to continue, though
I've noticed that the Webalizer data published online is increasingly free of those alphanumeric
abominations. That's not the main issue, though: the raw addresses too often resolve to untraceable
pointer names, and it would benefit the honest users of the Internet if the maliciously named
pointers were detected [and then flagged] by double lookups.

Here's my current way of dealing with those buried addresses:
grep -E -o "([0-9]{1,3}[\.\-]){3}[0-9]{1,3}" <(awk '{print $2}' nMap-I-Listed-IPv4s.txt) | sed 's/\-/\./g' | sort -u
Combining the field separators (.) and (-) in a single script increases the number of addresses
extracted from 434 using just (.) or 3,825 using just (-) to 4,366 using both at once.

I notice on further reflection that reversing the order of [\.\-] to [\-\.] yields only 434 addresses:
wc -l <(grep -E -o "([0-9]{1,3}[\-\.]){3}[0-9]{1,3}" <(awk '{print $2}' nMap-I-Listed-IPv4s.txt) | sed 's/\-/\./g' |sort -u)
Magic Banana will not like this ad hoc approach ...

The following twenty-four-step script looks up the PTR's of the permutations of the sequences of
four octets of the extracted IPv4 addresses:
awk '{print $0}' nMap-I-Extracted-IPv4s.test.txt | sed 's/\./\t/g' | awk '{print $1"."$2"."$3"."$4}' '-' | sudo nmap -Pn -sn -T2 --max-retries 8 -iL '-' oG - | grep "Nmap scan report for " '-' | awk '{print $6,$5}' '-' | sed 's/()/(No_DNS)/g' | tr -d '()' > nMap-I-Extracted-IPv4s.1234-oGnMap.test.txt ;
awk '{print $0}' nMap-I-Extracted-IPv4s.test.txt | sed 's/\./\t/g' | awk '{print $1"."$2"."$4"."$3}' '-' | sudo nmap -Pn -sn -T2 --max-retries 8 -iL '-' oG - | grep "Nmap scan report for " '-' | awk '{print $6,$5}' '-' | sed 's/()/(No_DNS)/g' | tr -d '()' > nMap-I-Extracted-IPv4s.1243-oGnMap.test.txt ;
...
awk '{print $0}' nMap-I-Extracted-IPv4s.test.txt | sed 's/\./\t/g' | awk '{print $4"."$3"."$2"."$1}' '-' | sudo nmap -Pn -sn -T2 --max-retries 8 -iL '-' oG - | grep "Nmap scan report for " '-' | awk '{print $6,$5}' '-' | sed 's/()/(No_DNS)/g' | tr -d '()' > nMap-I-Extracted-IPv4s.4321-oGnMap.test.txt ;

Saved as nMap-I-Extracted-IPv4s.4321.test.txt (attached) and made executable, it produces a
collected output consisting of mixed unresolved IPv4 addresses and resolved ones, separated
with the script:
cat nMap-I-Extracted-IPv4s.????-oGnMap.test.txt | sort -u | awk '{print $2}' '-' | sed '/^$/d' '-' > nMap-I-Extracted-IPv4s-to-Candidate-PTRs.test.txt
Which when joined with Col$2 of the original list in nMap-I-Listed-IPv4s.txt:
join -1 1 -2 2 <(sort nMap-I-Extracted-IPv4s-to-Candidate-PTRs.test.txt) <(sort -k 2,2 nMap-I-Listed-IPv4s.test.txt) | awk '{print $2,$1}' '-' > nMap-II-Resolved-PTRs.test.txt
Lists thirteen of the fourteen original address-containing PTR's.
The unresolved one looks as though it's further obfuscated with a numeral adjacent to a letter:
8ta-146-154-95.telkomadsl.co.za
But that PTR is directly resolved with dig.
The other thirteen are all in the 1234 category of the 24 permutations; I'll run the same series
of scripts on the main 5,672-row list of nMap-I-Listed-IPv4s.txt and report back later.

Pièce jointeTaille
nMap-I-Extracted-IPv4s.4321.test_.txt 7.13 Ko
Magic Banana

I am a member!

I am a translator!

Hors ligne
A rejoint: 07/24/2010

Magic Banana's exasperation is over my age-related difficulty in remembering what I did last week ...

If you would save the scripts I wrote for you in a directory listed in your PATH variable (for instance in /usr/local/bin) under meaningful names (for instance "find-IPv4-and-permute"), you would not need to remember anything.

Here is the same program I wrote two years ago, except that it now stores the four numbers below 256 in an array, to now easily print all 24 permutations (rather than only the three you asked for at the time):
#!/usr/bin/awk -f
BEGIN {
if (sep == "")
sep = " "
FS = "[^0-9]+"
OFS = "." }
{
k = 0
for (i = 0; k < 4 && ++i <= NF; )
if ($i != "" && $i < 256)
a[++k] = $i
else
k = 0 }
k == 4 {
print $0 sep a[1], a[2], a[3], a[4] sep a[1], a[2], a[4], a[3] sep a[1], a[3], a[2], a[4] sep a[1], a[3], a[4], a[2] sep a[1], a[4], a[2], a[3] sep a[1], a[4], a[3], a[2] sep a[2], a[1], a[3], a[4] sep a[2], a[1], a[4], a[3] sep a[2], a[3], a[1], a[4] sep a[2], a[3], a[4], a[1] sep a[2], a[4], a[1], a[3] sep a[2], a[4], a[3], a[1] sep a[3], a[1], a[2], a[4] sep a[3], a[1], a[4], a[2] sep a[3], a[2], a[1], a[4] sep a[3], a[2], a[4], a[1] sep a[3], a[4], a[1], a[2] sep a[3], a[4], a[2], a[1] sep a[4], a[1], a[2], a[3] sep a[4], a[1], a[3], a[2] sep a[4], a[2], a[1], a[3] sep a[4], a[2], a[3], a[1] sep a[4], a[3], a[1], a[2] sep a[4], a[3], a[2], a[1] }

As you can see, I also put the delimiter that separates the IPv4 addresses in a variable named sep. It is " " by default. You can assign any other string with option -v. For instance, to use a tabulation, you write (assuming the script is named "find-IPv4-and-permute" and is in a directory listed in your PATH variable):
$ find-IPv4-and-permute -v sep='\t'

As before, any sequence of characters without any digit is considered an input delimiter and the lines without four consecutive numbers below 256 are ignored. Also, as usual for AWK programs, any number of files in arguments can be processed or the standard input is, if no file is given)

amenex
Hors ligne
A rejoint: 01/03/2015

To no one's surprise, Magic Banana's script both works better and looks better than mine,
though I did modify it a little for my application:
BEGIN {
if (sep == "")
sep = " "
FS = "[^0-9]+"
OFS = "." }
{
k = 0
for (i = 0; k < 4 && ++i <= NF; )
if ($i != "" && $i < 256)
a[++k] = $i
else
k = 0 }
k == 4 {
print a[1], a[2], a[3], a[4] sep a[1], a[2], a[4], a[3] sep a[1], a[3], a[2], a[4] sep a[1], a[3], a[4], a[2] sep a[1], a[4], a[2], a[3] sep a[1], a[4], a[3], a[2] sep a[2], a[1], a[3], a[4] sep a[2], a[1], a[4], a[3] sep a[2], a[3], a[1], a[4] sep a[2], a[3], a[4], a[1] sep a[2], a[4], a[1], a[3] sep a[2], a[4], a[3], a[1] sep a[3], a[1], a[2], a[4] sep a[3], a[1], a[4], a[2] sep a[3], a[2], a[1], a[4] sep a[3], a[2], a[4], a[1] sep a[3], a[4], a[1], a[2] sep a[3], a[4], a[2], a[1] sep a[4], a[1], a[2], a[3] sep a[4], a[1], a[3], a[2] sep a[4], a[2], a[1], a[3] sep a[4], a[2], a[3], a[1] sep a[4], a[3], a[1], a[2] sep a[4], a[3], a[2], a[1] }

And so the execution becomes:
awk -f ./Script-MB-4321-permutations -v sep='\n' <(awk '{print $2}' nMap-I-Listed-IPv4s.txt) | sudo nmap -Pn -sn -T2 --max-retries 8 -iL '-' oG - | grep "Nmap scan report for " '-' | awk '{print $6,$5}' '-' | sed 's/()/(No_DNS)/g' | tr -d '()' > nMap-I-MB-Extracted-IPv4s.Permutations-oGnMap.txt

Followed by a join to the PTR column of the source file:
join -1 2 -2 1 <(sort -k 2,2 nMap-I-MB-Extracted-IPv4s.Permutations-oGnMap.txt) <(awk '{print $2}' nMap-I-Listed-IPv4s.txt | sort -k 1,1) | awk '{print $2,$1}' '-' | sort -u > nMap-II-Resolved-PTRs-MB.txt
Capturing 5096 of 5672 original rows, with many inseparable PTR's brought in by association:
awk -f ./Script-MB-1234-Followup -v sep=' ' <( awk '{print $2}' nMap-II-Resolved-PTRs-MB.txt) > nMap-II-Separable-4321-PTRs-MB.txt
Where 4432 rows out of the original 5096 rows are separable.
Magic Banana's original script can be further modified to test the output file for separability:
BEGIN {
if (sep == "")
sep = " "
FS = "[^0-9]+"
OFS = "." }
{
k = 0
for (i = 0; k < 4 && ++i <= NF; )
if ($i != "" && $i < 256)
a[++k] = $i
else
k = 0 }
k == 4 {
print a[1], a[2], a[3], a[4] sep $0 }

Comm will find the inseparable ones:
comm -23 <(awk '{print $2}' nMap-II-Resolved-PTRs-MB.txt | sort) <(awk '{print $2}' nMap-II-Separable-4321-PTRs-MB.txt | sort) | uniq -c '-' > nMap-II-Inseparable-4321-PTRs-MB.txt
These may be associated with other servers of other PTR's; that will take a little more work; see attachment.

Pièce jointeTaille
nMap-II-Inseparable-4321-PTRs-MB.txt 472 octets