-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathaxfr_get.php
75 lines (60 loc) · 1.62 KB
/
axfr_get.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/*
*
* VegaDNS - DNS Administration Tool for use with djbdns
*
* CREDITS:
* Written by Bill Shupp
*
* LICENSE:
* This software is distributed under the GNU General Public License
* Copyright 2003-2016, Bill Shupp
* see COPYING for details
*
*
*
*
* NOTE:
* This functionality ONLY exists outside of the main application
* because tcplient kept dying fatally due to file descriptor 7
* being unavailable, which only occurs AFTER session_start() is
* called.
*
*/
require_once 'src/config.php';
// CHECKS
// Make sure the hostname was given
if(!isset($_REQUEST['hostname']) || $_REQUEST['hostname'] == "") {
echo "ERROR: no hostname given\n";
exit;
}
// Make sure that some domains were given
if(!isset($_REQUEST['domain']) || $_REQUEST['domain'] == "") {
echo "ERROR: no domain was supplied\n";
exit;
}
$domain = $_REQUEST['domain'];
$hostname = $_REQUEST['hostname'];
$rand = rand();
$file = "/tmp/".escapeshellcmd($domain).".$rand";
$command = "$dns_tools_dir/tcpclient -R '".escapeshellcmd($hostname)."' 53 $dns_tools_dir/axfr-get '".escapeshellcmd($domain)."' $file $file.tmp 2>&1";
exec($command, $out);
// Print any errors first
if(strlen($out[0]) > 0) echo $out[0];
if(file_exists($file)) {
$string = '';
$newfile = file($file);
while(list($key,$val) = each($newfile)) {
$string .= $val;
}
unlink($file) or die("unable to unlink $file");
}
// rm the tmp file if it exists
if(file_exists("$file.tmp")) {
unlink("$file.tmp") or die("unable to unlink $file.tmp");
}
// output data
echo $string;
exit;
?>