Ganteng Doang Upload Shell Gak Bisa


Linux server.jmdstrack.com 3.10.0-1160.119.1.el7.tuxcare.els10.x86_64 #1 SMP Fri Oct 11 21:40:41 UTC 2024 x86_64
/ scripts/

//scripts/cleandns

#!/usr/local/cpanel/3rdparty/bin/perl

# cpanel - scripts/cleandns                        Copyright 2022 cPanel, L.L.C.
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited

package scripts::cleandns;

use strict;
use warnings;

use Getopt::Long              ();
use File::Basename            ();
use Cpanel::SafeFile          ();
use Cpanel::DNSLib            ();
use Cpanel::Hostname          ();
use Cpanel::FileUtils::Move   ();
use Cpanel::FileUtils::Copy   ();
use Cpanel::Logger            ();
use Cpanel::SafetyBits        ();
use Cpanel::StringFunc::Count ();
use Cpanel::StringFunc::Match ();

exit main(@ARGV) unless caller();

sub help {
    print "USAGE:\n\t$0\n\nRemoves zones no longer operated by cPanel users on this host, and removes duplicate zone definitions.\n";
    return 1;
}

#Only use prints if you expect to shoot this over to a web interface, otherwise logger() stuff
sub main {
    my @args = @_;

    my $logger = Cpanel::Logger->new();
    my ( $restart, $help );
    Getopt::Long::GetOptionsFromArray(
        \@args,
        v        => \$Cpanel::Debug::level,
        r        => \$restart,
        'h|help' => \$help,
    );
    return help() if $help;

    my $dnslib    = Cpanel::DNSLib->new();
    my $namedconf = $dnslib->{'namedconf'};

    my ( $confstatus, $confresult ) = remove_warnings_checknamedconf( $dnslib->checknamedconf() );

    my @confresults      = split( /\n/, $confresult );
    my @only_dupes       = grep { m/already exists previous definition/i } @confresults;
    my $only_dupe_errors = ( scalar(@only_dupes) == scalar(@confresults) );

    if ( !$confstatus && !$only_dupe_errors ) {
        $logger->warn("Fatal! $namedconf fails named-checkconf, please repair named.conf and try again");
        $logger->warn($confresult);
        print "$namedconf is in a state that cannot be automatically corrected.\n";
        print "Please address these issues and before trying again.";
        return 1;
    }

    my $binduser = $dnslib->{'data'}{'binduser'};
    my $bindgrp  = $dnslib->{'data'}{'bindgroup'};

    my %ZONES = gather_zones( $logger, $dnslib, $namedconf, $binduser, $bindgrp );

    $logger->debug("The following zone and zonefiles were found");
    $logger->debug("zones with out corresponding zone file (and duplicates) will be removed");
    $logger->debug("========================================================");
    foreach my $key ( sort keys %ZONES ) {
        $logger->debug("$key ==> $ZONES{$key}");
    }
    $logger->debug("========================================================");

    Cpanel::FileUtils::Copy::safecopy( $namedconf, $namedconf . '.precleandns' );

    my ( $NDC, $namelock, @CONF ) = build_clean_config( $logger, $namedconf, %ZONES );
    write_cleaned_config( $namedconf, $namelock, $NDC, @CONF );

    ( $confstatus, $confresult ) = remove_warnings_checknamedconf( $dnslib->checknamedconf() );

    if ( !$confstatus ) {
        $logger->warn("cleandns was unable to properly clean $namedconf");
        $logger->warn($confresult);
        $logger->info("Reverting to original version.");
        Cpanel::FileUtils::Copy::safecopy( $namedconf, $namedconf . '.brokencleandns' );
        Cpanel::FileUtils::Move::safemv( "-f", $namedconf . 'precleandns', $namedconf );
        Cpanel::SafetyBits::safe_chown( $binduser, $bindgrp, $namedconf );
        print "There was an error running the DNS cleanup. Please check the cPanel error logs.";
        return 2;
    }

    my $shorthost = Cpanel::Hostname::shorthostname();
    if ( !$shorthost ) {
        $shorthost = 'localhost';
        my $host_name_not_properly_set_msg = "Your hostname is not properly set, please run /usr/local/cpanel/bin/set_hostname";
        say STDERR ($host_name_not_properly_set_msg);
        $logger->warn($host_name_not_properly_set_msg);
    }

    my $numzones = scalar keys %ZONES;
    $logger->info("DNS cleanup successful");
    print "Cleaned up " . $numzones . " zone(s) on $shorthost.";

    if ($restart) {
        $logger->info("Restarting Bind using restartsrv");
        exec '/usr/local/cpanel/scripts/restartsrv', 'named';
    }
    $logger->debug("Bind will not be restarted automatically.");
    $logger->debug("To restart Bind run the following: /usr/local/cpanel/scripts/restartsrv_named");

    return 0;
}

sub _is_line_comment {
    my ( $line, $cppcomment, $callback ) = @_;

    # Rudimentary comment exclusion.
    if ($cppcomment) {
        if ( $line =~ m/\*\// ) {
            $cppcomment = 0;
        }
        $callback->($line) if $callback;
        return ( 1, $cppcomment );
    }
    if ( $line =~ m/^\s*\#/ ) {
        $callback->($line) if $callback;
        return ( 1, $cppcomment );
    }
    if ( $line =~ m/^\s\/\// ) {
        $callback->($line) if $callback;
        return ( 1, $cppcomment );
    }
    if ( $line =~ m/^\s*\/\*/ ) {
        $cppcomment = 1;
        $callback->($line) if $callback;
        return ( 1, $cppcomment );
    }
    return ( 0, $cppcomment );
}

# XXX I am dissatisfied with this loop and build_clean_config being nearly the same.
# This means we are straight up wasting time in this script which is called by dnsadmin
# and hence needs good performance.

sub gather_zones {    ## no critic(ProhibitExcessComplexity)
    my ( $logger, $dnslib, $namedconf, $binduser, $bindgrp ) = @_;

    my %ZONES;
    my $inc      = 0;
    my $seenhint = 0;
    my $zone     = '';
    my ( $numbrace, $zonemarker, $cppcomment, $continue ) = ( 0, 0, 0, 0 );
    my $zonedir = $dnslib->{'data'}{'zonefiledir'};

    # Read through named.conf. Gather hash of zones and zone files
    open( my $NDC, '<', $namedconf ) || $logger->die("Unable to open $namedconf: $!");

    while (<$NDC>) {
        ( $continue, $cppcomment ) = _is_line_comment( $_, $cppcomment );
        next if $continue;

        if ($zonemarker) {
            $numbrace += Cpanel::StringFunc::Count::get_curly_brace_count($_);
            if ( $numbrace == 0 ) {
                $zonemarker = 0;
            }
            if (m/.*[\s\t\;\{]file\s+["']([^"']+)/) {
                my $file        = $1;
                my $relativedir = '';
                if ( !Cpanel::StringFunc::Match::beginmatch( $file, '/' ) ) {
                    if ( $file =~ m/^([^\/]+)/ ) {
                        $relativedir = $1;
                    }
                }
                if ( -e $file ) {
                    $ZONES{$zone} = $file;
                }
                else {
                    my $filename = File::Basename::basename($file);
                    my $filenew  = $zonedir . '/' . $filename;
                    if ( -e $filenew ) {
                        $ZONES{$zone} = $filenew;
                    }
                    elsif ( $relativedir ne ''
                        && -e $zonedir . '/' . $relativedir . '/' . $filename ) {
                        $ZONES{$zone} = $zonedir . '/' . $relativedir . '/' . $filename;
                    }
                    elsif ( -e '/' . $file ) {
                        $ZONES{$zone} = '/' . $file;
                    }
                    else {
                        $ZONES{$zone} = '';
                    }
                }
                next();
            }
            if (m/.*[\s\t\;\{]type\s+slave/) {
                delete( $ZONES{$zone} );
            }
        }
        if (m/\s*zone\s+["']([^"']+)/) {
            $zone       = $1;
            $zonemarker = 1;
            $numbrace += Cpanel::StringFunc::Count::get_curly_brace_count($_);

            if (m/.*[\s\t\;\{]file\s+["']([^"']+)/) {
                my $file        = $1;
                my $relativedir = '';
                if ( !Cpanel::StringFunc::Match::beginmatch( $file, '/' ) ) {
                    if ( $file =~ m/^([^\/]+)/ ) {
                        $relativedir = $1;
                    }
                }
                if ( -e $file ) {
                    $ZONES{$zone} = $file;
                }
                else {
                    my $filename = File::Basename::basename($file);
                    my $filenew  = $zonedir . '/' . $filename;
                    if ( -e $filenew ) {
                        $ZONES{$zone} = $filenew;
                    }
                    elsif ( $relativedir ne ''
                        && -e $zonedir . '/' . $relativedir . '/' . $filename ) {
                        $ZONES{$zone} = $zonedir . '/' . $relativedir . '/' . $filename;
                    }
                    elsif ( -e '/' . $file ) {
                        $ZONES{$zone} = '/' . $file;
                    }
                    elsif ( $zone eq '.' ) {
                        Cpanel::FileUtils::Copy::safecopy( '/usr/local/cpanel/scripts/named.ca', $filenew );
                        Cpanel::SafetyBits::safe_chown( $binduser, $bindgrp, $filenew );
                        $ZONES{$zone} = $filenew;
                    }
                    else {
                        $ZONES{$zone} = '';
                    }
                }
                next;
            }
        }

        if ( !$zonemarker ) {
            next;
        }
        else {
            $numbrace += Cpanel::StringFunc::Count::get_curly_brace_count($_);
            if ( $numbrace == 0 ) {
                $inc = 0;
            }
        }
    }
    close($NDC);
    return %ZONES;
}

sub build_clean_config {
    my ( $logger, $namedconf, %ZONES ) = @_;

    my @CONF;
    my $zone = '';
    my ( $numbrace, $zonemarker, $cppcomment, $continue ) = ( 0, 0, 0, 0 );

    # Modify named.conf and remove bad entries.
    my $namelock = Cpanel::SafeFile::safeopen( my $NDC, "+<", $namedconf );
    if ( !$namelock ) {
        $logger->die("Could not open $namedconf");
    }

    my $seen_already = {};
    my $what_view    = 'none';
    while (<$NDC>) {

        ( $continue, $cppcomment ) = _is_line_comment( $_, $cppcomment, sub { push( @CONF, shift ) } );
        next if $continue;

        #Gotta know what view we are in to filter dupes out
        m/\s*view\s+["']([^"']+)/;
        $what_view = $1 if $1;

        if ($zonemarker) {
            $numbrace += Cpanel::StringFunc::Count::get_curly_brace_count($_);
            if ( $numbrace == 0 ) {
                $zonemarker = 0;
            }
            if ( defined( $ZONES{$zone} ) && $ZONES{$zone} eq '' ) {
                next;
            }
            elsif ( !defined( $ZONES{$zone} ) ) {
                push @CONF, $_;
                next;
            }
            elsif (m/(.*[\s\t\;\{])file\s+["']/) {
                my $space = $1;
                push @CONF, $space . "file \"$ZONES{$zone}\"\;\n";
                next;
            }
            else {
                push @CONF, $_;
                next;
            }
        }
        if (m/\s*zone\s+["']([^"']+)/) {
            $zone = $1;
            $seen_already->{"$what_view.$zone"}++;
            if ( $seen_already->{"$what_view.$zone"} && $seen_already->{"$what_view.$zone"} > 1 ) {
                $zonemarker = 0;
                next;
            }

            $zonemarker = 1;
            $numbrace += Cpanel::StringFunc::Count::get_curly_brace_count($_);
            if ( defined( $ZONES{$zone} ) && $ZONES{$zone} eq '' ) {
                next();
            }
            elsif ( !defined( $ZONES{$zone} ) ) {
                push( @CONF, $_ );
                next();
            }
            elsif (m/(.*[\s\t\;\{])file\s+["']/) {
                my $space = $1;
                push @CONF, $space . "file \"$ZONES{$zone}\"\;\n";
                next;
            }
            else {
                push @CONF, $_;
                next;
            }
        }

        #Evade warnings
        my $skip_dupe_body = ( $what_view && $zone && $seen_already->{"$what_view.$zone"} && $seen_already->{"$what_view.$zone"} > 1 );

        if ( !$zonemarker && !$skip_dupe_body ) {
            push @CONF, $_;
        }
    }

    seek( $NDC, 0, 0 );
    return ( $NDC, $namelock, @CONF );
}

sub write_cleaned_config {
    my ( $namedconf, $namelock, $NDC, @CONF ) = @_;

    my $deadline = 0;
    foreach (@CONF) {
        if (m/^[\r\n\s\t]*$/) {
            $deadline++;
        }
        else {
            $deadline = 0;
        }
        if ( $deadline < 2 ) {
            print $NDC $_;
        }
    }
    print $NDC "\n";

    truncate( $NDC, tell($NDC) );
    unlink("$namedconf.cache");
    Cpanel::SafeFile::safeclose( $NDC, $namelock );
    return 1;
}

sub remove_warnings_checknamedconf {
    my ( $configstatus, $configresult ) = @_;
    return ( $configstatus, $configresult ) if $configstatus;
    my $config_warning_rx = qr/option 'additional-from-cache' is obsolete/;
    my @errors            = split "\n", $configresult;
    return ( $configstatus, $configresult ) unless scalar @errors;
    my $new_config_result = [];
    foreach my $errorLine (@errors) {
        push @{$new_config_result}, $errorLine unless $errorLine =~ /$config_warning_rx/;
    }
    $configstatus = 1 if $#{$new_config_result} < 0;
    $configresult = join( "\n", @{$new_config_result} );
    return ( $configstatus, $configresult );

}

1;    #magic true since this is included in build-tools/clean_test_cruft
			
			


Thanks For 0xGh05T - DSRF14 - Mr.Dan07 - Leri01 - FxshX7 - AlkaExploiter - xLoveSyndrome'z - Acep Gans'z

JMDS TRACK – Just Another Diagnostics Lab Site

Home

JMDS TRACK Cameroon

Boost the productivity of your mobile ressources


Make An Appointment


Fleet management

  1. Reduce the operting cost and the unavailability of your vehicles
  2. reduce the fuel consumption of your fleet
  3. Improve the driving dehavior and safety of your drivers
  4. optimize the utilization rate of your equipment 
  5. protect your vehicle against theft
  6. Improve the quality of your customer service


Find out more

Assets management

  1. Track the roaming of your equipment
  2. Optimise the management of your assets on site and during transport
  3. Secure the transport of your goods
  4. Make your team responsible for preventing the loss of tools, equipment
  5. Take a real-time inventory of your equipment on site
  6. Easily find your mobile objects or equipment



Find out more



Find out more

Antitheft solutions

  1. Secure your vehicles and machinery and increase your chances of recovering them in the event of theft
  2. Protect your assets and reduce the costs associated with their loss
  3. Combine immobiliser and driver identification and limit the risk of theft
  4. Identify fuel theft and reduce costs
  5. Protect your goods and take no more risks
  6. Be alerted to abnormal events

Our Location

 Douala BP cité 

     and

Yaoundé Total Essos


Make An Appointment


Get Directions

682230363/ 677481892

What makes us different from others

  • young and dynamic team
  • call center 24/24 7/7
  • roaming throughout Africa
  • team of developers who can develop customer-specific solutions
  • diversity of services
  • reactive and prompt after-sales service when soliciting a customer or a malfunction
  • Free Maintenance and installation in the cities of Douala and Yaounde

https://youtu.be/xI1cz_Jh2x8

15+
years of experience in GPS system development, production and deployment.

15 Collaborators

More than 15 employees dedicated to the research and development of new applications and to customer care

5 000 Vehicles and mobile assets

5 000 vehicles and mobile assets under management, in Africa

Our Partners










Latest Case Studies

Our current projects 

5/5
Bon SAV , SATISFAIT DU TRAITEMENT DES REQUETES

M DIPITA CHRISTIAN
Logistic Safety Manager Road Safety Manager
5/5
La réactivité de JMDS est excellente
Nous restons satisfait dans l’ensemble des prestations relatives a la couverture de notre parc automobile

Hervé Frédéric NDENGUE
Chef Service Adjoint de la Sécurité Générale (CNPS)
5/5
L’APPLICATION EMIXIS est convivial A L’utilisation
BEIG-3 SARL
DIRECTOR GENERAL
5/5
Nevertheless I am delighted with the service
MR. BISSE BENJAMIN
CUSTOMER

Subsribe To Our Newsletter

Stay in touch with us to get latest news and special offers.



Address JMDS TRACK

Douala bp cité



and

YAOUNDE Total Essos

Call Us

+237682230363



Email Us


info@jmdstrack.cm