какой файловый менеджер используется в астре 1.5

azm9s

New member
Сообщения
57
#1
в мсвс можно было в навигаторе прописать скрипт в action, чтобы при нажатии правой кнопкой мыши на файле/директории появился пункт md5 хеш. при нажатии на который рассчитывался хеш файла и отправлялся в буфер обмена, чтобы потом можно было вставить куда угодно.

в астре же по аналогичному пути директория action имеется - только эти скрипты не работают уже...
как бы узнать, кто в предках у этого файлового менеджера, чтоб скрипты переделать на этот фм.
 

cogniter

Moderator
Team Astra Linux
Сообщения
142
#2
Добрый день, как вариант, могу предложить такое решение.

На Астре 1.5 поставить программу zenity (она входит в состав операционной системы):
sudo apt-get install zenity

Затем создать нижеуказанный скрипт и вывести ярлык на рабочий стол или в меню:

Bash:
#!/bin/bash

# ============================================================================================================================================================= #
# Hash Checker script for md5/sha1/sha256 hashes, version 4.0.7 by Cooleech
# e-mail to: cooleech@gmail.com
# English by Cooleech
# ============================================================================================================================================================= #

AppVer="4.0.8-shadowbq"
HConFile="$HOME/.HashCheck/HC.conf"
SavedSettings=`cat $HConFile`

which xdg-user-dirs-update
if [ $? = 0 ]; then
.    ~/.config/user-dirs.dirs # Import variables
fi

# Set desktop icon dir
if [ "$XDG_DESKTOP_DIR" = "" ]; then
    if [ -d "$HOME/Desktop" ]; then
        XDG_DESKTOP_DIR="$HOME/Desktop"
    else
        XDG_DESKTOP_DIR="$HOME"
    fi
fi

if [ -e $HConFile ]; then
.    $HConFile # Import variables
fi

if [ "$1" = "" ]; then
    SelectedFile=`zenity --title="Choose a file to check" --file-selection`
fi

if [ "$SelectedFile" = "" ]; then
    if [ $# -gt 1 ]; then
        zenity --error --text="You must select one file only!"
        exit 1
    fi
    if [ "$1" = "" ]; then
        exit 1
    fi
fi

if [ -d "$1" ]; then
    zenity --error --text="<b>$1</b> is a folder.
This script cannot work with folders!"
    exit 1
fi

if [ "$SelectedFile" = "" ]; then
    SelectedFile="$1"
fi

SelectedFileNameFix="${SelectedFile//'&'/&amp;}" # Fix for ampersand simbol

if [ `stat --printf="%s" "$SelectedFile"` = "0" ]; then
    zenity --warning --text="<b>$SelectedFileNameFix</b> has 0 bytes!
Checking hash of this file is pointless!"
    exit 1
fi

if [ -d "${SelectedFile%/*}" ]; then # Check if dir or file
    FileNoPath="${SelectedFileNameFix##*/}"
    FilePath="${SelectedFile%/*}/" # md5sum, sha1sum and sha256sum need file path
else
    FileNoPath="$SelectedFileNameFix"
    FilePath="./" # md5sum, sha1sum and sha256sum need file path
fi

function DELETE_OLD_HASH_FILE {
zenity --question --title="Hash Checker $AppVer" --text="Found old hash file:\n<b>$FileNoPath$HashFile</b>\n\nWould you like to delete it (recommended)?" \
            --cancel-label="_Keep it" --ok-label="_Delete it"
if [ $? = 0 ]; then
    rm -f "$SelectedFile$HashFile" # Must keep path
fi
}

if [ -e "$SelectedFile".md5sum ]; then # Must keep path
    HashFile=".md5sum"
    DELETE_OLD_HASH_FILE
fi

if [ -e "$SelectedFile".sha1sum ]; then # Must keep path
    HashFile=".sha1sum"
    DELETE_OLD_HASH_FILE
fi

if [ -e "$SelectedFile".sha256sum ]; then # Must keep path
    HashFile=".sha256sum"
    DELETE_OLD_HASH_FILE
fi

# Get last states
if [ "$MD5_HASH_CHECKED" = "" ]; then
    MD5state="TRUE"
else
    MD5state="$MD5_HASH_CHECKED"
fi

if [ "$SHA1_HASH_CHECKED" = "" ]; then
    SHA1state="FALSE"
else
    SHA1state="$SHA1_HASH_CHECKED"
fi

if [ "$SHA256_HASH_CHECKED" = "" ]; then
    SHA256state="FALSE"
else
    SHA256state="$SHA256_HASH_CHECKED"
fi

if [ "$SAVE_TO_TEXT_FILE" = "" ]; then
    TextFileState="FALSE"
else
    TextFileState="$SAVE_TO_TEXT_FILE"
fi


TypeOfHash="MD5|SHA1|SHA256"

if ! [ -e "$SelectedFile" ]; then
    zenity --error --text "Cannot find <b>$FileNoPath</b> file!\nFile is either renamed, moved or removed!"
    exit 1
fi

echo $TypeOfHash

# Reset all
MD5state="FALSE"
SHA1state="FALSE"
SHA256state="FALSE"
TextFileState="FALSE"

case $TypeOfHash in
MD5*) # MD5 with any other
MD5state="TRUE"
(
echo "# Checking MD5 hash. Depending on '$FileNoPath' file size,\ndisc and CPU speed, it could take up to several minutes. Please wait..."
openssl md5 "$SelectedFile" |grep -o '= .*' > /tmp/"$FileNoPath".md5sum
) | zenity --width="400" --progress --title="Checking MD5 hash" --text="" --percentage=0 --auto-close --pulsate
esac

case $TypeOfHash in
*SHA1*) # SHA1 with any other
SHA1state="TRUE"
(
echo "# Checking SHA1 hash. Depending on '$FileNoPath' file size,\ndisc and CPU speed, it could take up to several minutes. Please wait..."
openssl sha1 "$SelectedFile" |grep -o '= .*' > /tmp/"$FileNoPath".sha1sum
) | zenity --width="400" --progress --title="Checking SHA1 hash" --text="" --percentage=0 --auto-close --pulsate
esac

case $TypeOfHash in
*SHA256*) # SHA256 with any other
SHA256state="TRUE"
(
echo "# Checking SHA256 hash. Depending on '$FileNoPath' file size,\ndisc and CPU speed, it could take up to several minutes. Please wait..."
openssl sha256 "$SelectedFile" |grep -o '= .*' > /tmp/"$FileNoPath".sha256sum
) | zenity --width="400" --progress --title="Checking SHA256 hash" --text="" --percentage=0 --auto-close --pulsate
esac

case $TypeOfHash in
*Save*) # Save in text file with any other
TextFileState="TRUE"
esac

case $TypeOfHash in
Save*) # Save in text file only
exit 1
esac

case $TypeOfHash in
"") # No selection
exit 1
esac

CurrentSettings="# HASH CHECKER SETTINGS
MD5_HASH_CHECKED=$MD5state
SHA1_HASH_CHECKED=$SHA1state
SHA256_HASH_CHECKED=$SHA256state
SAVE_TO_TEXT_FILE=$TextFileState"

if [ ! "$SavedSettings" = "$CurrentSettings" ]; then
    echo "$CurrentSettings" > $HConFile
fi

if [ -e /tmp/"$FileNoPath".md5sum ]; then
    MD5hash=`cat /tmp/"$FileNoPath".md5sum`
    MD5WithoutPath="${MD5hash%%  $SelectedFile}"
else
    MD5WithoutPath="N/A"
fi

if [ -e /tmp/"$FileNoPath".sha1sum ]; then
    SHA1hash=`cat /tmp/"$FileNoPath".sha1sum`
    SHA1WithoutPath="${SHA1hash%%  $SelectedFile}"
else
    SHA1WithoutPath="N/A"
fi

if [ -e /tmp/"$FileNoPath".sha256sum ]; then
    SHA256hash=`cat /tmp/"$FileNoPath".sha256sum`
    SHA256WithoutPath="${SHA256hash%%  $SelectedFile}"
else
    SHA256WithoutPath="N/A"
fi

if [ "$TextFileState" = "TRUE" ]; then
    if [ -e /tmp/"$FileNoPath".md5sum ]; then
        md5hashFile=`cat /tmp/"$FileNoPath".md5sum`
        echo "$md5hashFile" >> "$SelectedFile".md5sum
    fi
    if [ -e /tmp/"$FileNoPath".sha1sum ]; then
        sha1hashFile=`cat /tmp/"$FileNoPath".sha1sum`
        echo "$sha1hashFile" >> "$SelectedFile".sha1sum
    fi
    if [ -e /tmp/"$FileNoPath".sha256sum ]; then
        sha256hashFile=`cat /tmp/"$FileNoPath".sha256sum`
        echo "$sha256hashFile" >> "$SelectedFile".sha256sum
    fi
fi

zenity --info --title="Hash Checker $AppVer" --no-wrap --text="File: <b>$FileNoPath</b>
\nMD5 hash: <b>$MD5WithoutPath</b>\nSHA1 hash: <b>$SHA1WithoutPath</b>\nSHA256 hash: <b>$SHA256WithoutPath</b>"
# Cleanup /tmp
if [ -e /tmp/"$FileNoPath".md5sum ]; then
    rm -f /tmp/"$FileNoPath".md5sum
fi
if [ -e /tmp/"$FileNoPath".sha1sum ]; then
    rm -f /tmp/"$FileNoPath".sha1sum
fi
if [ -e /tmp/"$FileNoPath".sha256sum ]; then
    rm -f /tmp/"$FileNoPath".sha256sum
fi

exit 0

Пример работы скрипта на видео:

 

Rayman

New member
Сообщения
39
#3
Добрый день, как вариант, могу предложить такое решение.

На Астре 1.5 поставить программу zenity (она входит в состав операционной системы):
sudo apt-get install zenity

Затем создать нижеуказанный скрипт и вывести ярлык на рабочий стол или в меню:

Bash:
#!/bin/bash

# ============================================================================================================================================================= #
# Hash Checker script for md5/sha1/sha256 hashes, version 4.0.7 by Cooleech
# e-mail to: cooleech@gmail.com
# English by Cooleech
# ============================================================================================================================================================= #

AppVer="4.0.8-shadowbq"
HConFile="$HOME/.HashCheck/HC.conf"
SavedSettings=`cat $HConFile`

which xdg-user-dirs-update
if [ $? = 0 ]; then
.    ~/.config/user-dirs.dirs # Import variables
fi

# Set desktop icon dir
if [ "$XDG_DESKTOP_DIR" = "" ]; then
    if [ -d "$HOME/Desktop" ]; then
        XDG_DESKTOP_DIR="$HOME/Desktop"
    else
        XDG_DESKTOP_DIR="$HOME"
    fi
fi

if [ -e $HConFile ]; then
.    $HConFile # Import variables
fi

if [ "$1" = "" ]; then
    SelectedFile=`zenity --title="Choose a file to check" --file-selection`
fi

if [ "$SelectedFile" = "" ]; then
    if [ $# -gt 1 ]; then
        zenity --error --text="You must select one file only!"
        exit 1
    fi
    if [ "$1" = "" ]; then
        exit 1
    fi
fi

if [ -d "$1" ]; then
    zenity --error --text="<b>$1</b> is a folder.
This script cannot work with folders!"
    exit 1
fi

if [ "$SelectedFile" = "" ]; then
    SelectedFile="$1"
fi

SelectedFileNameFix="${SelectedFile//'&'/&amp;}" # Fix for ampersand simbol

if [ `stat --printf="%s" "$SelectedFile"` = "0" ]; then
    zenity --warning --text="<b>$SelectedFileNameFix</b> has 0 bytes!
Checking hash of this file is pointless!"
    exit 1
fi

if [ -d "${SelectedFile%/*}" ]; then # Check if dir or file
    FileNoPath="${SelectedFileNameFix##*/}"
    FilePath="${SelectedFile%/*}/" # md5sum, sha1sum and sha256sum need file path
else
    FileNoPath="$SelectedFileNameFix"
    FilePath="./" # md5sum, sha1sum and sha256sum need file path
fi

function DELETE_OLD_HASH_FILE {
zenity --question --title="Hash Checker $AppVer" --text="Found old hash file:\n<b>$FileNoPath$HashFile</b>\n\nWould you like to delete it (recommended)?" \
            --cancel-label="_Keep it" --ok-label="_Delete it"
if [ $? = 0 ]; then
    rm -f "$SelectedFile$HashFile" # Must keep path
fi
}

if [ -e "$SelectedFile".md5sum ]; then # Must keep path
    HashFile=".md5sum"
    DELETE_OLD_HASH_FILE
fi

if [ -e "$SelectedFile".sha1sum ]; then # Must keep path
    HashFile=".sha1sum"
    DELETE_OLD_HASH_FILE
fi

if [ -e "$SelectedFile".sha256sum ]; then # Must keep path
    HashFile=".sha256sum"
    DELETE_OLD_HASH_FILE
fi

# Get last states
if [ "$MD5_HASH_CHECKED" = "" ]; then
    MD5state="TRUE"
else
    MD5state="$MD5_HASH_CHECKED"
fi

if [ "$SHA1_HASH_CHECKED" = "" ]; then
    SHA1state="FALSE"
else
    SHA1state="$SHA1_HASH_CHECKED"
fi

if [ "$SHA256_HASH_CHECKED" = "" ]; then
    SHA256state="FALSE"
else
    SHA256state="$SHA256_HASH_CHECKED"
fi

if [ "$SAVE_TO_TEXT_FILE" = "" ]; then
    TextFileState="FALSE"
else
    TextFileState="$SAVE_TO_TEXT_FILE"
fi


TypeOfHash="MD5|SHA1|SHA256"

if ! [ -e "$SelectedFile" ]; then
    zenity --error --text "Cannot find <b>$FileNoPath</b> file!\nFile is either renamed, moved or removed!"
    exit 1
fi

echo $TypeOfHash

# Reset all
MD5state="FALSE"
SHA1state="FALSE"
SHA256state="FALSE"
TextFileState="FALSE"

case $TypeOfHash in
MD5*) # MD5 with any other
MD5state="TRUE"
(
echo "# Checking MD5 hash. Depending on '$FileNoPath' file size,\ndisc and CPU speed, it could take up to several minutes. Please wait..."
openssl md5 "$SelectedFile" |grep -o '= .*' > /tmp/"$FileNoPath".md5sum
) | zenity --width="400" --progress --title="Checking MD5 hash" --text="" --percentage=0 --auto-close --pulsate
esac

case $TypeOfHash in
*SHA1*) # SHA1 with any other
SHA1state="TRUE"
(
echo "# Checking SHA1 hash. Depending on '$FileNoPath' file size,\ndisc and CPU speed, it could take up to several minutes. Please wait..."
openssl sha1 "$SelectedFile" |grep -o '= .*' > /tmp/"$FileNoPath".sha1sum
) | zenity --width="400" --progress --title="Checking SHA1 hash" --text="" --percentage=0 --auto-close --pulsate
esac

case $TypeOfHash in
*SHA256*) # SHA256 with any other
SHA256state="TRUE"
(
echo "# Checking SHA256 hash. Depending on '$FileNoPath' file size,\ndisc and CPU speed, it could take up to several minutes. Please wait..."
openssl sha256 "$SelectedFile" |grep -o '= .*' > /tmp/"$FileNoPath".sha256sum
) | zenity --width="400" --progress --title="Checking SHA256 hash" --text="" --percentage=0 --auto-close --pulsate
esac

case $TypeOfHash in
*Save*) # Save in text file with any other
TextFileState="TRUE"
esac

case $TypeOfHash in
Save*) # Save in text file only
exit 1
esac

case $TypeOfHash in
"") # No selection
exit 1
esac

CurrentSettings="# HASH CHECKER SETTINGS
MD5_HASH_CHECKED=$MD5state
SHA1_HASH_CHECKED=$SHA1state
SHA256_HASH_CHECKED=$SHA256state
SAVE_TO_TEXT_FILE=$TextFileState"

if [ ! "$SavedSettings" = "$CurrentSettings" ]; then
    echo "$CurrentSettings" > $HConFile
fi

if [ -e /tmp/"$FileNoPath".md5sum ]; then
    MD5hash=`cat /tmp/"$FileNoPath".md5sum`
    MD5WithoutPath="${MD5hash%%  $SelectedFile}"
else
    MD5WithoutPath="N/A"
fi

if [ -e /tmp/"$FileNoPath".sha1sum ]; then
    SHA1hash=`cat /tmp/"$FileNoPath".sha1sum`
    SHA1WithoutPath="${SHA1hash%%  $SelectedFile}"
else
    SHA1WithoutPath="N/A"
fi

if [ -e /tmp/"$FileNoPath".sha256sum ]; then
    SHA256hash=`cat /tmp/"$FileNoPath".sha256sum`
    SHA256WithoutPath="${SHA256hash%%  $SelectedFile}"
else
    SHA256WithoutPath="N/A"
fi

if [ "$TextFileState" = "TRUE" ]; then
    if [ -e /tmp/"$FileNoPath".md5sum ]; then
        md5hashFile=`cat /tmp/"$FileNoPath".md5sum`
        echo "$md5hashFile" >> "$SelectedFile".md5sum
    fi
    if [ -e /tmp/"$FileNoPath".sha1sum ]; then
        sha1hashFile=`cat /tmp/"$FileNoPath".sha1sum`
        echo "$sha1hashFile" >> "$SelectedFile".sha1sum
    fi
    if [ -e /tmp/"$FileNoPath".sha256sum ]; then
        sha256hashFile=`cat /tmp/"$FileNoPath".sha256sum`
        echo "$sha256hashFile" >> "$SelectedFile".sha256sum
    fi
fi

zenity --info --title="Hash Checker $AppVer" --no-wrap --text="File: <b>$FileNoPath</b>
\nMD5 hash: <b>$MD5WithoutPath</b>\nSHA1 hash: <b>$SHA1WithoutPath</b>\nSHA256 hash: <b>$SHA256WithoutPath</b>"
# Cleanup /tmp
if [ -e /tmp/"$FileNoPath".md5sum ]; then
    rm -f /tmp/"$FileNoPath".md5sum
fi
if [ -e /tmp/"$FileNoPath".sha1sum ]; then
    rm -f /tmp/"$FileNoPath".sha1sum
fi
if [ -e /tmp/"$FileNoPath".sha256sum ]; then
    rm -f /tmp/"$FileNoPath".sha256sum
fi

exit 0

Пример работы скрипта на видео:

а для gostsum есть подобное?
 

Vvvadim

New member
Сообщения
2
#4
Добрый день! Подскажите, не могу установить zenity, пишет, что нет в комплекте. Устанавливаю с диска.
 

azm9s

New member
Сообщения
57
#7
как сделаю сначала полноценно рабочую АРМ, займусь.
как оказалось, под юзверем домена алд у меня запись на диски не работает, и с днс проблемы, нет корневых зон в методике