⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.93
Server IP:
65.108.141.171
Server:
Linux server.heloix.com 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
7.4.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
webmin
/
virtual-server
/
View File Name :
fetch-script-files.pl
#!/usr/bin/perl # Download all files used by scripts to some directory package virtual_server; if (!$module_name) { $main::no_acl_check++; $ENV{'WEBMIN_CONFIG'} ||= "/etc/webmin"; $ENV{'WEBMIN_VAR'} ||= "/var/webmin"; if ($0 =~ /^(.*)\/[^\/]+$/) { chdir($pwd = $1); } else { chop($pwd = `pwd`); } $0 = "$pwd/fetch-script-files.pl"; require './virtual-server-lib.pl'; $< == 0 || die "fetch-script-files.pl must be run as root"; } @OLDARGV = @ARGV; # Parse command-line args while(@ARGV) { $a = shift(@ARGV); if ($a eq "--dest") { $dest = shift(@ARGV); } elsif ($a !~ /^\-/) { push(@scripts, $a); } elsif ($a eq "--help") { &usage(); } else { &usage("Unknown parameter $a"); } } $dest || die "usage: fetch-script-files.pl --dest dir"; if (!@scripts) { @scripts = &list_available_scripts(); } @rv = ( ); foreach $s (@scripts) { $script = &get_script($s); next if (!$script->{'enabled'}); $d = { 'dom' => 'example.com' }; foreach $ver (@{$script->{'versions'}}) { @files = &{$script->{'files_func'}}($d, $ver, undef, undef); foreach $f (grep { $_->{'url'} } @files) { next if ($f->{'nofetch'}); next if ($f->{'virtualmin'}); local $url = &convert_osdn_url($f->{'url'}) || $f->{'url'}; local $destfile = "$dest/$f->{'file'}"; next if (-r $destfile); # Already gotten local $temp = &transname($f->{'file'}); local $error; print "script:$script->{'name'} version:$ver url:$url\n"; if ($url =~ /^http/) { # Via HTTP my ($host, $port, $page, $ssl) = &parse_http_url($f->{'url'}); &http_download($host, $port, $page, $temp, \$error, undef, $ssl, undef, undef, undef, 1, $f->{'nocache'}); } elsif ($url =~ /^ftp:\/\/([^\/]+)(\/.*)/) { # Via FTP my ($host, $page) = ($1, $2); &ftp_download($host, $page, $temp, \$error); } if ($error) { # HTTP failed print "status: FAILED $error\n"; } else { # Looks OK .. but was it really a file? $fmt = &compression_format($temp); $cont = undef; if (!$fmt && $temp =~ /\.(pl|php)$/i) { $cont = &read_file_contents($temp); } if (!$fmt && $cont !~ /^\#\!\s*\S+(perl|php)/i && $cont !~ /^\s*<\?php/i) { print "status: BADFILE\n"; } else { @st = stat($temp); print "status: OK $st[7]\n"; ©_source_dest($temp, $destfile); &set_ownership_permissions(undef, undef, 0755, $destfile); } } unlink($temp); } } } sub usage { print "$_[0]\n\n" if ($_[0]); print "Download files for some script.\n"; print "\n"; print "usage: fetch-script-files.pl\n"; exit(1); }