Advertisement
DD3AH

dyndns

Jan 30th, 2023
1,440
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.89 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. use CGI;
  4. use Net::DNS;
  5.  
  6.  
  7. my $q = CGI->new;
  8. my $update = Net::DNS::Update->new('bnm.me');
  9. my $res = Net::DNS::Resolver->new;
  10.  
  11. print $q->header(-type=>'text/plain');
  12.  
  13.  
  14. $res->nameservers('127.0.0.1');
  15.  
  16. (my $sec,my $min, my $hour, my $tag, my $mon, my $year, my $wday, my $ydat, my $isdst)=localtime();
  17. $mon += 1;
  18. $year += 1900;
  19. my $datum = sprintf ('%04d-%02d-%02dT%02d:%02d:%02d', $year, $mon, $tag, $hour, $min, $sex);
  20. my $ipv4 = $q->param('ipv4');
  21. my $ipv6 = $q->param('ipv6');
  22. my $t =  "nobs.d.bnm.me.";
  23.  
  24. $update->push(update => rr_del("$t AAAA"));
  25. $update->push(update => rr_del("$t A"));
  26. $update->push(update => rr_del("$t TXT"));
  27.  
  28. $update->push(update => rr_add("$t 1800 AAAA $ipv6"));
  29. $update->push(update => rr_add("$t 1800 A $ipv4"));
  30. $update->push(update => rr_add("$t TXT $datum"));
  31.  
  32. my $reply = $res->send($update);
  33. print "$ipv4 $ipv6\n";
  34. print "ok";
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement