Re: DNS Perl Help? [ot]
> OK - Thanks for your help on that one, Still need the DNS stuff figured > out, That's the last piece in what will be an extrodinarilly powerful > whitelisting system. I'll publish the code once it is tested. I think a > lot of people will want to use it and improve it. Using Net::DNS, here is a snip of what I have used in the past. It returns the PTR record, and if not available, returns the IP. sub get_ame { my $ip = shift; my $res = Net::DNS::Resolver->new; my $query = $res->search("$ip"); if ($query) { foreach my $rr ($query->answer) { next unless $rr->type eq "PTR"; return ($rr->rdatastr); } } else { return ($ip); } } HTH, Steve
Re: DNS Perl Help? [ot]
Theo Van Dinter wrote: On Sun, Jul 22, 2007 at 07:15:50AM -, [EMAIL PROTECTED] wrote: Mark Perkel wrote: If I have a string, what's that fastest way to count the number of periods in the string? in perl, I would probably split the string at the periods @parts = split /\./, $string; and then just use the number of splits $#parts I believe the official/fastest/shortest method is: $count = $string =~ y/.//; OK - Thanks for your help on that one, Still need the DNS stuff figured out, That's the last piece in what will be an extrodinarilly powerful whitelisting system. I'll publish the code once it is tested. I think a lot of people will want to use it and improve it.
Re: DNS Perl Help? [ot]
On Sun, Jul 22, 2007 at 07:15:50AM -, [EMAIL PROTECTED] wrote: > Mark Perkel wrote: > If I have a string, what's that fastest way to count the number of > periods in the string? > > in perl, I would probably split the string at the periods > > @parts = split /\./, $string; > and then just use the number of splits > $#parts I believe the official/fastest/shortest method is: $count = $string =~ y/.//; -- Randomly Selected Tagline: If a can of Alpo costs 38 cents, would it cost $2.50 in Dog Dollars? pgpK1hqYi3jEL.pgp Description: PGP signature
Re: DNS Perl Help? [ot]
Mark Perkel wrote: If I have a string, what's that fastest way to count the number of periods in the string? in perl, I would probably split the string at the periods @parts = split /\./, $string; and then just use the number of splits $#parts Wolfgang Hamann
DNS Perl Help? [ot]
OK - I'm not experienced at Perl by trying to do something that should be fairly simple for those of you who are good at it. I need a subroutine that I can pass and IP address to. It will do a reverse DNS lookup and get a hostname. Then lookup the hostname to verify that one of the IP addresses it returns matched the IP that was looked up. Return the host name if it succeeds ot an empty string if not. How do you do that? I'm building what will be an impressive public DNS blacklist/whitelist which I will share when it's working. Thanks in advance. Oh - also. If I have a string, what's that fastest way to count the number of periods in the string?