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
/ sbin/

//sbin/abrt-harvest-vmcore

#!/usr/bin/python
"""
 This script is meant to be run once at system startup after abrtd is up
 and running. It moves all vmcore directories in kdump's dump directory
 (which are presumably created by kdump) to abrtd spool directory.

 The goal is to let abrtd notice and process them as new problem data dirs.
"""

import os
import sys
import shutil
import time
import hashlib
import augeas
from subprocess import Popen, PIPE

import problem
import report


def errx(message, code=1):
    sys.stderr.write(message)
    sys.stderr.write("\n")
    sys.stderr.flush()
    sys.exit(code)

def get_augeas(module, file_path):
    """
    A function for efficient configuration of Augeas.
    Augeas modules are placed in /usr/share/augeas/lenses/dist
    """

    aug_obj = augeas.Augeas(flags=augeas.Augeas.NO_MODL_AUTOLOAD)
    aug_obj.set("/augeas/load/{0}/lens".format(module), "{0}.lns".format(module))
    aug_obj.set("/augeas/load/{0}/incl".format(module), file_path)
    aug_obj.load()
    return aug_obj

def get_mount_point(part_id):
    """
    A function used to look up a mount point of the provided identifier
    using 'findmnt' system utility.

    part_id - device node, label or uuid
    """

    try:
        proc = Popen(["/usr/bin/findmnt", "--noheadings", "--first-only", "--raw",
                     "--evaluate", "--output", "TARGET", part_id],
                     stdout=PIPE, stderr=PIPE)
        out, err = proc.communicate()
        if err:
            errx("Error finding mountpoint of '{0}': {1}"
                 .format(devpath, err))

        result = out.strip()
        if proc.returncode != 0 or not result:
            errx("Cannot find mountpoint of '{0}'".format(part_id))

        return result
    except OSError as ex:
        errx("Cannot run 'findmnt': {1}".format(str(ex)))

def parse_kdump():
    """
    This function parses /etc/kdump.conf to get a path to kdump's
    dump directory.
    """
    # default
    dump_path = '/var/crash'

    # filesystem types that can be used by kdump for dumping
    fs_types = ['ext4', 'ext3', 'ext2', 'minix', 'btrfs', 'xfs']

    if not os.access('/etc/kdump.conf', os.R_OK):
        sys.stderr.write("/etc/kdump.conf not readable, using "
                         "default path '%s'\n" % dump_path)
        return dump_path

    aug_obj = get_augeas("Kdump", "/etc/kdump.conf")
    # check for path variable in kdump.conf
    kdump_path = aug_obj.get("/files/etc/kdump.conf/path")
    if kdump_path:
        dump_path = kdump_path

    # default
    partition = None
    # first uncommented fs_type partition instruction
    for fs_type in fs_types:
        result = aug_obj.get("/files/etc/kdump.conf/" + fs_type)
        if result:
            partition = result
            break

    if partition:
        if os.path.isabs(dump_path):
            # path is absolute, change it to relative
            dump_path = dump_path.lstrip("/")
        mount_point = get_mount_point(partition)
        path = os.path.join(mount_point, dump_path)
    else:
        path = dump_path

    # full path to the dump directory
    return path


def create_abrtd_info(dest, uuid):
    """
    A simple function to write important information for the abrt daemon into
    the vmcore directory to let abrtd know what kind of problem it is.

    dest - path to the vmcore directory
    uuid - unique indentifier of the vmcore
    """

    dd = report.dd_create(dest, 0)
    if dd is None:
        return None

    dd.create_basic_files(0)
    dd.save_text('analyzer', 'vmcore')
    dd.save_text('type', 'vmcore')
    dd.save_text('component', 'kernel')
    dd.save_text('uuid', uuid)
    return dd


def delete_and_close(dd):
    """
    Deletes the given dump directory and closes it.

    dd - dump directory object
    """
    # Save the directory name as the directory object could be destroyed during
    # delete().
    dd_dirname = dd.name
    if not dd.delete() == 0:
        sys.stderr.write("Unable to delete '%s'\n" % (dd_dirname))
        return

    dd.close()


def harvest_vmcore():
    """
    This function moves vmcore directories from kdump's dump dir
    to abrt's dump dir and notifies abrt.

    The script also creates additional files used to tell abrt what kind of
    problem it is and creates an uuid from the vmcore using a sha1 hash
    function.
    """

    dump_dir = parse_kdump()

    if not os.access(dump_dir, os.R_OK):
        sys.stderr.write("Dump directory '%s' not accessible. "
                         "Exiting.\n" % dump_dir)
        sys.exit(1)

    # Wait for abrtd to start. Give it at least 1 second to initialize.
    for i in xrange(10):
        if i is 9:
            sys.exit(1)
        elif os.system('pidof abrtd >/dev/null'):
            time.sleep(1)
        else:
            break

    # Check abrt config files for copy/move settings and
    try:
        conf = problem.load_plugin_conf_file("vmcore.conf")
    except OSError as ex:
        sys.stderr.write(str(ex))
        sys.exit(1)
    else:
        copyvmcore = conf.get("CopyVMcore", "no")

    try:
        conf = problem.load_conf_file("abrt.conf")
    except OSError as ex:
        sys.stderr.write(str(ex))
        sys.exit(1)
    else:
        abrtdumpdir = conf.get("DumpLocation", "/var/spool/abrt")

    try:
        filelist = os.listdir(dump_dir)
    except OSError:
        sys.stderr.write("Dump directory '%s' not accessible. "
                         "Exiting.\n" % dump_dir)
        sys.exit(1)

    # Go through all directories in core dump directory
    for cfile in filelist:
        f_full = os.path.join(dump_dir, cfile)
        if not os.path.isdir(f_full):
            continue

        try:
            vmcoredirfilelist = os.listdir(f_full)
        except OSError as ex:
            sys.stderr.write("VMCore dir '%s' not accessible.\n" % f_full)
            continue
        else:
             if all(("vmcore" != ff
                     for ff in vmcoredirfilelist
                        if os.path.isfile(os.path.join(f_full, ff)))):
                sys.stderr.write(
                    "VMCore dir '%s' doesn't contain 'vmcore' file.\n" % f_full)
                continue

        # We use .new suffix - we must make sure abrtd doesn't try
        # to process partially-copied directory.
        destdir = os.path.join(abrtdumpdir, ('vmcore-' + cfile))
        destdirnew = destdir + '.new'
        # Did we already copy it last time we booted?
        if os.path.isdir(destdir):
            continue
        if os.path.isdir(destdirnew):
            continue

        # TODO: need to generate *real* UUID,
        # one which has a real chance of catching dups!
        # This one generates different hashes even for similar cores:
        hashobj = hashlib.sha1()
        # Iterate over the file a line at a time in order to not load the whole
        # vmcore file
        with open(os.path.join(f_full, 'vmcore'), 'r') as corefile:
            for line in corefile:
                hashobj.update(line)

        dd = create_abrtd_info(destdirnew, hashobj.hexdigest())
        if dd is None:
            sys.stderr.write("Unable to create problem directory info")
            continue

        # Copy/move vmcore directory to abrt spool dir.
        for name in os.listdir(f_full):
            full_name = os.path.join(f_full, name)

            # Skip sub-directories, abrt ignores them in its processing anyway
            if not os.path.isfile(full_name):
                continue

            try:
                if not dd.copy_file(name, full_name) == 0:
                    raise OSError
            except (OSError, shutil.Error):
                sys.stderr.write("Unable to copy '%s' to '%s'. Skipping\n"
                                 % (full_name, destdirnew))
                delete_and_close(dd)
                continue

        # Get rid of the .new suffix
        if not dd.rename(destdir) == 0:
            sys.stderr.write("Unable to rename '%s' to '%s'. Skipping\n" % (destdirnew, destdir))
            delete_and_close(dd)
            continue

        dd.close()

        if copyvmcore == 'no':
            try:
                shutil.rmtree(f_full)
            except OSError:
                sys.stderr.write("Unable to delete '%s'. Ignoring\n" % f_full)

        problem.notify_new_path(destdir)


if __name__ == '__main__':
    harvest_vmcore()
			
			


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