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
/ usr/ bin/

//usr/bin/abrt-handle-upload

#!/usr/bin/python -u
# Called by abrtd when a new file is noticed in upload directory.
# The task of this script is to unpack the file and move
# problem data found in it to abrtd spool directory.

import sys
import stat
import os
import getopt
import tempfile
import shutil
import datetime
import grp

from reportclient import set_verbosity, error_msg_and_die, error_msg, log

GETTEXT_PROGNAME = "abrt"
import locale
import gettext

_ = lambda x: gettext.lgettext(x)

def init_gettext():
    try:
        locale.setlocale(locale.LC_ALL, "")
    except locale.Error:
        os.environ['LC_ALL'] = 'C'
        locale.setlocale(locale.LC_ALL, "")
    # Defeat "AttributeError: 'module' object has no attribute 'nl_langinfo'"
    try:
        gettext.bind_textdomain_codeset(GETTEXT_PROGNAME, locale.nl_langinfo(locale.CODESET))
    except AttributeError:
        pass
    gettext.bindtextdomain(GETTEXT_PROGNAME, '/usr/share/locale')
    gettext.textdomain(GETTEXT_PROGNAME)


import problem

def write_str_to(filename, s, uid, gid, mode):
    fd = os.open(filename, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, mode)
    if fd >= 0:
        os.fchown(fd, uid, gid)
        os.write(fd, s)
        os.close(fd)


def validate_transform_move_and_notify(uploaded_dir_path, problem_dir_path, dest=None):
    fsuid = 0
    fsgid = 0

    try:
        gabrt = grp.getgrnam("abrt")
        fsgid = gabrt.gr_gid
    except KeyError as ex:
        error_msg("Failed to get GID of 'abrt' (using 0 instead): {0}'".format(str(ex)))

    try:
        # give the uploaded directory to 'root:abrt' or 'root:root'
        os.chown(uploaded_dir_path, fsuid, fsgid)
        # set the right permissions for this machine
        # (allow the owner and the group to access problem elements,
        #  the default dump dir mode lacks x bit for both)
        os.chmod(uploaded_dir_path, 0640 | stat.S_IXUSR | stat.S_IXGRP)

        # sanitize problem elements
        for item in os.listdir(uploaded_dir_path):
            apath = os.path.join(uploaded_dir_path, item)
            if os.path.islink(apath):
                # remove symbolic links
                os.remove(apath)
            elif os.path.isdir(apath):
                # remove directories
                shutil.rmtree(apath)
            elif os.path.isfile(apath):
                # set file ownership to 'root:abrt' or 'root:root'
                os.chown(apath, fsuid, fsgid)
                # set the right file permissions for this machine
                os.chmod(apath, 0640)
            else:
                # remove things that are neither files, symlinks nor directories
                os.remove(apath)
    except OSError as ex:
        error_msg("Removing uploaded dir '{0}': '{1}'".format(uploaded_dir_path, str(ex)))
        try:
            shutil.rmtree(uploaded_dir_path)
        except OSError as ex2:
            error_msg_and_die("Failed to clean up dir '{0}': '{1}'".format(uploaded_dir_path, str(ex2)))
        return

    # overwrite remote if it exists
    remote_path = os.path.join(uploaded_dir_path, "remote")
    write_str_to(remote_path, "1", fsuid, fsgid, 0640)

    # abrtd would increment count value and abrt-server refuses to process
    # problem directories containing 'count' element when PrivateReports is on.
    count_path = os.path.join(uploaded_dir_path, "count")
    if os.path.exists(count_path):
        # overwrite remote_count if it exists
        remote_count_path = os.path.join(uploaded_dir_path, "remote_count")
        os.rename(count_path, remote_count_path)

    if not dest:
        dest = problem_dir_path

    shutil.move(uploaded_dir_path, dest)

    problem.notify_new_path(problem_dir_path)


if __name__ == "__main__":

    # Helper: exit with cleanup
    die_exitcode = 1
    delete_on_exit = None
    def print_clean_and_die(fmt, *args):
        sys.stderr.write("%s\n" % (fmt % args))
        if delete_on_exit:
            shutil.rmtree(delete_on_exit, True) # True: ignore_errors
        sys.exit(die_exitcode)

    # localization
    init_gettext()

    verbose = 0
    ABRT_VERBOSE = os.getenv("ABRT_VERBOSE")
    if ABRT_VERBOSE:
        try:
            verbose = int(ABRT_VERBOSE)
        except:
            pass

    progname = os.path.basename(sys.argv[0])
    help_text = _(
        "Usage: %s [-vd] ABRT_SPOOL_DIR UPLOAD_DIR FILENAME"
      "\n"
      "\n   -v             - Verbose"
      "\n   -d             - Delete uploaded archive"
      "\n   ABRT_SPOOL_DIR - Directory where valid uploaded archives are unpacked to"
      "\n   UPLOAD_DIR     - Directory where uploaded archives are stored"
      "\n   FILENAME       - Uploaded archive file name"
      "\n"
    ) % progname

    try:
        opts, args = getopt.getopt(sys.argv[1:], "vdh", ["help"])
    except getopt.GetoptError as err:
        error_msg(err)  # prints something like "option -a not recognized"
        error_msg_and_die(help_text)

    delete_archive = False
    for opt, arg in opts:
        if opt in ("-h", "--help"):
            print help_text
            sys.exit(0)
        if opt == "-v":
            verbose += 1
        if opt == "-d":
            delete_archive = True

    set_verbosity(verbose)

    if len(args) < 3:
        error_msg_and_die(help_text)

    abrt_dir = args[0]
    upload_dir = args[1]
    archive = args[2]

    if not os.path.isdir(abrt_dir):
        error_msg_and_die(_("Not a directory: '{0}'").format(abrt_dir))

    if not os.path.isdir(upload_dir):
        error_msg_and_die(_("Not a directory: '{0}'").format(upload_dir))

    if archive[0] == "/":
        error_msg_and_die(_("Skipping: '{0}' (starts with slash)").format(archive))

    if archive[0] == ".":
        error_msg_and_die(_("Skipping: '{0}' (starts with dot)").format(archive))

    if ".." in archive:
        error_msg_and_die(_("Skipping: '{0}' (contains ..)").format(archive))

    if " " in archive:
        error_msg_and_die(_("Skipping: '{0}' (contains space)").format(archive))

    if "\t" in archive:
        error_msg_and_die(_("Skipping: '{0}' (contains tab)").format(archive))

    try:
        os.chdir(upload_dir)
    except OSError:
        error_msg_and_die(_("Can't change directory to '{0}'").format(upload_dir))

    if archive.endswith(".tar.gz"):
        unpacker = "gunzip"
    elif archive.endswith(".tgz"):
        unpacker = "gunzip"
    elif archive.endswith(".tar.bz2"):
        unpacker = "bunzip2"
    elif archive.endswith(".tar.xz"):
        unpacker = "unxz"
    else:
        error_msg_and_die(_("Unknown file type: '{0}'").format(archive))

    try:
        working_dir = tempfile.mkdtemp(prefix="abrt_handle_upload.", dir="/var/tmp")
    except OSError:
        error_msg_and_die(_("Can't create working directory in '{0}'").format("/var/tmp"))
    delete_on_exit = working_dir

    try:
        tempdir = working_dir + "/remote." + datetime.datetime.now().strftime("%Y-%m-%d-%H:%M:%S.%f.") + str(os.getpid())
        working_archive = working_dir + "/" + archive

        if delete_archive:
            try:
                shutil.move(archive, working_archive)
            except IOError:
                print_clean_and_die(_("Can't move '{0}' to '{1}'").format(archive, working_archive))
        else:
            try:
                shutil.copy(archive, working_archive)
            except IOError:
                print_clean_and_die(_("Can't copy '{0}' to '{1}'").format(archive, working_archive))

        ex = os.spawnlp(os.P_WAIT, unpacker, unpacker, "-t", "--", working_archive)
        if ex != 0:
            print_clean_and_die(_("Verification error on '{0}'").format(archive))

        log(_("Unpacking '{0}'").format(archive))
        try:
            os.mkdir(tempdir)
        except OSError:
            print_clean_and_die(_("Can't create '{0}' directory").format(tempdir))

        ex = os.system(unpacker+" <"+working_archive+" | tar xf - -C "+tempdir)
        if ex != 0:
            print_clean_and_die(_("Can't unpack '{0}'").format(archive))

        # The archive can contain either plain dump files
        # or one or more complete problem data directories.
        # Checking second possibility first.
        if os.path.exists(tempdir+"/analyzer") and os.path.exists(tempdir+"/time"):
            validate_transform_move_and_notify(tempdir, abrt_dir+"/"+os.path.basename(tempdir), dest=abrt_dir)
        else:
            for d in os.listdir(tempdir):
                if not os.path.isdir(tempdir+"/"+d):
                    continue
                dst = abrt_dir+"/"+d
                if os.path.exists(dst):
                    dst += "."+str(os.getpid())
                if os.path.exists(dst):
                    continue
                validate_transform_move_and_notify(tempdir+"/"+d, dst)

        die_exitcode = 0
        # This deletes working_dir (== delete_on_exit)
        print_clean_and_die(_("'{0}' processed successfully").format(archive))

    except:
        if delete_on_exit:
            shutil.rmtree(delete_on_exit, True) # True: ignore_errors
        raise
			
			


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