kanotix.com

Scripte - Script mit kdialog hat einen fehler...

stalin2000 - 26.12.2008, 17:49 Uhr
Titel: Script mit kdialog hat einen fehler...
hallo, habe von kdelook.org folgendes Script heruntergeladen:

Steghide
http://www.kde-look.org/content/show.ph ... tent=45323

Also das einbinden von Dateien in eine jpg-datei klappt. Was leider nicht geht, ist das Entpacken via Menü. Wenn ich in die Konsole aber gehe und das Verzeichnis wähle und dort

steghide extract -sf "123.jpg"

Ich glabue, im Script ist folgender Text falsch, welcher genau das tun sollte wie

steghide extract -sf "123.jpg"


Zitat:

else #for extracting file
current_path=$(echo ${1%/*}) #where is the file which should contain embedded file

pass=$(kdialog --password "Type password") then
steghide extract -sf "$1" -p "$pass"
fi
fi


Weiß jemand, wo der Fehler liegt?

Gruß Christopher
retabell - 29.12.2008, 16:47 Uhr
Titel:
moin
in dem Script sind verschiedene Dinge anzupassen.

hiermit funktioniert es so halbwegs

musst mal noch ein bischen anpassen

und Dateien mit Leerzeichen mag es auch nicht.

Code:
--- steghide_servicemenu.sh.org 2006-09-06 00:52:06.000000000 +0200
+++ steghide_servicemenu.sh     2008-12-29 17:30:51.000000000 +0100
@@ -8,7 +8,7 @@

                #comparing if passwords match
                pass=$(kdialog --password "Choose password")
-               pass2=$(kdialog --password "Retype password (for sure)")
+               pass2=$(kdialog --password "Retype password for sure ")
                if [ $pass = $pass2 ]; then
                        kdialog --yesno "Replace original file?"
                        if [ $? = 0 ]; then
@@ -28,16 +28,16 @@
        fi

 else #for extracting file
-       current_path=$(echo ${1%/*}) #where is the file which should contain embedded file
-
+       #current_path=$(echo ${1%/*}) #where is the file which should contain embedded file
+       current_path=$(pwd)
        pass=$(kdialog --password "Type password")

        #testing if the file realy contain another file and if so, getting its name
-       name=$(steghide info $1 -p "$pass" | grep "embedded file" | awk '{print $3}')
+       name=$(steghide info $1 -p "$pass" | grep "Eingebettete Datei" | awk '{print $3}' )
        name=$(echo ${name%'":'})
        name=$(echo ${name#'"'})
-
-       if [ ${#name} == 0 ]; then
+       echo "name ist $name"
+       if [ ${name} == '' ]; then
                kdialog --sorry "This file doesn't contain any embedded file or the password is wrong."
        else
                if [[ -f "$current_path/$name" ]]; then #if the name of the embedded file is allready used in this directory, user have to choose another name for saving this file


gruss retabell
stalin2000 - 29.12.2008, 18:55 Uhr
Titel:
Hey.... Danke!

Was genau muß ich denn da anpassen? und was haben diese Dinger zu bedeuten und was bedeuten die ganzen plus und minus Zeichen?
Zitat:

--- steghide_servicemenu.sh.org 2006-09-06 00:52:06.000000000 +0200
+++ steghide_servicemenu.sh 2008-12-29 17:30:51.000000000 +0100
@@ -8,7 +8,7 @@


ich hatte jetzt einfach mal das hier eingefügt und es ging noch nicht (die Paßworteingabe kam bevor man die zu versteckende Datei auswählen konnte... außerdem funktionierte der obere Teil des Scripts, der zum Einbetten in die Jpg Datei ja schon. Das Problem bestand ja ausschließlich beim wieder Auspacken der Datei...):

Zitat:

#comparing if passwords match
pass=$(kdialog --password "Choose password")
- pass2=$(kdialog --password "Retype password (for sure)")
+ pass2=$(kdialog --password "Retype password for sure ")
if [ $pass = $pass2 ]; then
kdialog --yesno "Replace original file?"
if [ $? = 0 ]; then
fi

else #for extracting file
- current_path=$(echo ${1%/*}) #where is the file which should contain embedded file
-
+ #current_path=$(echo ${1%/*}) #where is the file which should contain embedded file
+ current_path=$(pwd)
pass=$(kdialog --password "Type password")

#testing if the file realy contain another file and if so, getting its name
- name=$(steghide info $1 -p "$pass" | grep "embedded file" | awk '{print $3}')
+ name=$(steghide info $1 -p "$pass" | grep "Eingebettete Datei" | awk '{print $3}' )
name=$(echo ${name%'":'})
name=$(echo ${name#'"'})
-
- if [ ${#name} == 0 ]; then
+ echo "name ist $name"
+ if [ ${name} == '' ]; then
kdialog --sorry "This file doesn't contain any embedded file or the password is wrong."
else
if [[ -f "$current_path/$name" ]]; then #if the name of the embedded file is allready used in this directory, user have to choose another name for saving this file

Kano - 29.12.2008, 19:41 Uhr
Titel:
Das ist doch schwachsinn was ihr da ändert, seit wann parst man denn deutsche ausgaben von nem programm? Wenn dann macht man nen lang override wie

LANG= LC_ALL= programm

davor.
stalin2000 - 30.12.2008, 14:37 Uhr
Titel:
Hallo Kano,

also ich hab keine Ahnung vom "scripten"... ich versuch das nur so anzupassen, daß es läuft....

weißt Du eventuell, wo in diesem Teil der Fehler liegen könnte ?

Zitat:
else #for extracting file
current_path=$(echo ${1%/*}) #where is the file which should contain embedded file

pass=$(kdialog --password "Type password") then
steghide extract -sf "$1" -p "$pass"
fi
fi

stalin2000 - 03.08.2009, 14:05 Uhr
Titel:
also so funktioniert's zumindest:

/home/[user]/bin/steghide_servicemenu.sh



Zitat:
#/bin/sh

if [ $2 = e ]; then #for embedding file

file_to_hide=$(kdialog --getopenfilename .) #choose which file to embed

if [ $? = 0 ]; then #if user does't press cancel

#comparing if passwords match
pass=$(kdialog --password "Choose password")
pass2=$(kdialog --password "Retype password for sure ")
if [ $pass = $pass2 ]; then
kdialog --yesno "Replace original file?"
if [ $? = 0 ]; then
steghide embed -cf "$1" -ef "$file_to_hide" -p "$pass"
else
file_to_save=$(kdialog --getsavefilename .)
if [ $? = 0 ]; then
wrong=$(steghide embed -cf "$1" -ef "$file_to_hide" -p "$pass" -sf "$file_to_save")
if [ $wrong = 1 ]; then
kdialog --error "Steghide ended with error"
fi
fi
fi
else
kdialog --sorry "Passwords don't match. Ending script."
fi
fi

else #for extracting file
#current_path=$(echo ${1%/*}) #where is the file which should contain embedded file
current_path=$(pwd)
pass=$(kdialog --password "Type password")

#testing if the file realy contain another file and if so, getting its name
name=$(steghide info $1 -p "$pass" | grep "Eingebettete Datei" | awk '{print $3}' )
name=$(echo ${name%'":'})
name=$(echo ${name#'"'})
echo "name ist $name"
if [ ${name} == '' ]; then
kdialog --sorry "This file doesn't contain any embedded file or the password is wrong."
else
if [[ -f "$current_path/$name" ]]; then #if the name of the embedded file is allready used in this directory, user have to choose another name for saving this file
kdialog --sorry "The embedded file would be saved as $current_path/$name but this file allready exists. Choose another place."
file_to_save=$(kdialog --getsavefilename .)
if [ $? = 0 ]; then
wrong=$(steghide extract -sf "$1" -xf "$file_to_save" -p "$pass")
if [ $wrong = 1 ]; then
kdialog --error "Steghide ended with error"
fi
fi
else #if the name is possible to use, script just inform the user where the file was saved
wrong=$(steghide extract -sf "$1" -p "$pass")
if [ $wrong = 1 ]; then
kdialog --error "Steghide ended with error"
else
kdialog --msgbox "The embedded file was saved as $current_path/$name."
fi
fi
fi
fi

Alle Zeiten sind GMT + 1 Stunde
PNphpBB2 © 2003-2007