Change config files for upload tools
This commit is contained in:
parent
e6c738fc38
commit
e1f657c6be
|
@ -707,8 +707,8 @@ while [ ${show_menu} -eq 0 ] ; do
|
||||||
source ${HOME}/.ks-tools/ks-oga
|
source ${HOME}/.ks-tools/ks-oga
|
||||||
echo " o - Edit ks-oga/ks-oga-album config (${acodec}/${b_acodec}/${default_lang_audio})"
|
echo " o - Edit ks-oga/ks-oga-album config (${acodec}/${b_acodec}/${default_lang_audio})"
|
||||||
echo ""
|
echo ""
|
||||||
user_config=$(cat ${HOME}/.ks-tools/USER 2> /dev/null)
|
user_config=$(cat ${HOME}/.ks-tools/ks-upload-user 2> /dev/null)
|
||||||
server_config=$(cat ${HOME}/.ks-tools/SERVER 2> /dev/null)
|
server_config=$(cat ${HOME}/.ks-tools/ks-upload-server 2> /dev/null)
|
||||||
echo " u - Edit ks-upv/ks-upa/ks-upf/ks-upr config (${user_config}/${server_config})"
|
echo " u - Edit ks-upv/ks-upa/ks-upf/ks-upr config (${user_config}/${server_config})"
|
||||||
echo ""
|
echo ""
|
||||||
echo " q - Exit"
|
echo " q - Exit"
|
||||||
|
|
167
src/ks-upa
167
src/ks-upa
|
@ -194,34 +194,106 @@ function checkChecksum() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Generate random codes
|
||||||
|
function generate_codes() {
|
||||||
|
chars="abcdefghijklmnopqrstywxz1234567890ABCDEFHIJKLMNOPQRSTYWXZ@/"
|
||||||
|
long_code="${1}"
|
||||||
|
for i in {1} ; do
|
||||||
|
echo -n "${chars:RANDOM%${#chars}:1}"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to encrypt pass on config file
|
||||||
|
# Syntax: encrypt_kstools <password>
|
||||||
|
function encrypt_kstools() {
|
||||||
|
raw_pass="${1}"
|
||||||
|
characters_pass_raw=$(echo ${raw_pass} | wc -m)
|
||||||
|
characters_pass=$(expr ${characters_pass_raw} - 1)
|
||||||
|
total_characters=0
|
||||||
|
mkdir -p ${HOME}/.ks-tools/
|
||||||
|
rm -rf ${HOME}/.ks-tools/.seq-codes
|
||||||
|
while [ ${total_characters} -le ${characters_pass} ] ; do
|
||||||
|
num_gen=$(echo -n ${RANDOM} | cut -c1)
|
||||||
|
echo -n ${num_gen} >> ${HOME}/.ks-tools/.seq-codes
|
||||||
|
total_characters=$(expr ${total_characters} + 1)
|
||||||
|
done
|
||||||
|
characters_seq_raw=$(cat ${HOME}/.ks-tools/.seq-codes 2> /dev/null | wc -m)
|
||||||
|
characters_seq=$(expr ${characters_seq_raw} - 1)
|
||||||
|
total_characters=1
|
||||||
|
encrypted_pass=""
|
||||||
|
while [ ${total_characters} -le ${characters_pass} ] ; do
|
||||||
|
num_seq_read=$(cat ${HOME}/.ks-tools/.seq-codes 2> /dev/null | cut -c${total_characters})
|
||||||
|
character=$(echo ${raw_pass} | cut -c${total_characters})
|
||||||
|
repeat_seq=0
|
||||||
|
while [ ${repeat_seq} -lt ${num_seq_read} ] ; do
|
||||||
|
code_gen=$(generate_codes)
|
||||||
|
encrypted_pass="${encrypted_pass}${code_gen}"
|
||||||
|
repeat_seq=$(expr ${repeat_seq} + 1)
|
||||||
|
done
|
||||||
|
encrypted_pass="${encrypted_pass}${character}"
|
||||||
|
total_characters=$(expr ${total_characters} + 1)
|
||||||
|
done
|
||||||
|
code_gen=$(generate_codes)
|
||||||
|
encrypted_pass="${encrypted_pass}${code_gen}"
|
||||||
|
echo ${encrypted_pass}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to decrypt pass on config file
|
||||||
|
# Syntax: decrypt_kstools <password>
|
||||||
|
function decrypt_kstools() {
|
||||||
|
raw_pass_encrypted="${1}"
|
||||||
|
total_characters=1
|
||||||
|
codes_seq=$(cat ${HOME}/.ks-tools/.seq-codes 2> /dev/null)
|
||||||
|
num_codes_seq=$(cat ${HOME}/.ks-tools/.seq-codes 2> /dev/null | wc -m)
|
||||||
|
pass_decrypt=""
|
||||||
|
total_characters=1
|
||||||
|
pos_codes_pass=0
|
||||||
|
while [ ${total_characters} -lt ${num_codes_seq} ] ; do
|
||||||
|
pos_codes=$(echo ${codes_seq} | cut -c${total_characters})
|
||||||
|
pos_codes_pass=$(expr ${pos_codes_pass} + ${pos_codes} + 1)
|
||||||
|
pos_pass=$(expr ${raw_pass_encrypted} | cut -c${pos_codes_pass})
|
||||||
|
pass_decrypt="${pass_decrypt}${pos_pass}"
|
||||||
|
total_characters=$(expr ${total_characters} + 1)
|
||||||
|
done
|
||||||
|
echo ${pass_decrypt}
|
||||||
|
}
|
||||||
|
|
||||||
# Function to show config
|
# Function to show config
|
||||||
function showConfig() {
|
function showConfig() {
|
||||||
configAvailable=0
|
configAvailable=0
|
||||||
echo ""
|
echo ""
|
||||||
echo "* ks-upa (ks-tools) v${VERSION} (${M_DATE})"
|
echo "* ks-upa (ks-tools) v${VERSION} (${M_DATE})"
|
||||||
echo ""
|
echo ""
|
||||||
if [ -f ${dirConfig}/USER ] ; then
|
if [ -f ${dirConfig}/ks-upload-user ] ; then
|
||||||
showUser=$(cat ${dirConfig}/USER)
|
showUser=$(cat ${dirConfig}/ks-upload-user)
|
||||||
echo "- Server User: ${showUser}"
|
echo "- Server User: ${showUser}"
|
||||||
configAvailable=1
|
configAvailable=1
|
||||||
fi
|
fi
|
||||||
if [ -f ${dirConfig}/PASS ] ; then
|
if [ -f ${dirConfig}/ks-upload-pass ] ; then
|
||||||
showPassword=$(cat ${dirConfig}/PASS)
|
readPasswordEncrypted=$(cat ${dirConfig}/ks-upload-pass)
|
||||||
|
readPasswordDecrypted=$(decrypt_kstools "${readPasswordEncrypted}")
|
||||||
|
readPasswordChars=$(echo ${readPasswordDecrypted} | wc -m)
|
||||||
|
totalchars=0
|
||||||
|
showPassword=""
|
||||||
|
while [ ${totalchars} -lt ${readPasswordChars} ] ; do
|
||||||
|
showPassword="${showPassword}*"
|
||||||
|
totalchars=$(expr ${totalchars} + 1)
|
||||||
|
done
|
||||||
echo "- Server Password: ${showPassword}"
|
echo "- Server Password: ${showPassword}"
|
||||||
configAvailable=1
|
configAvailable=1
|
||||||
fi
|
fi
|
||||||
if [ -f ${dirConfig}/SERVER ] ; then
|
if [ -f ${dirConfig}/ks-upload-server ] ; then
|
||||||
showServer=$(cat ${dirConfig}/SERVER)
|
showServer=$(cat ${dirConfig}/ks-upload-server)
|
||||||
echo "- URL (or IP) Server: ${showServer}"
|
echo "- URL (or IP) Server: ${showServer}"
|
||||||
configAvailable=1
|
configAvailable=1
|
||||||
fi
|
fi
|
||||||
if [ -f ${dirConfig}/DIR_SERVER ] ; then
|
if [ -f ${dirConfig}/ks-upload-dirserver ] ; then
|
||||||
showDirServer=$(cat ${dirConfig}/DIR_SERVER)
|
showDirServer=$(cat ${dirConfig}/ks-upload-dirserver)
|
||||||
echo "- Destination Path (Server): ${showDirServer}"
|
echo "- Destination Path (Server): ${showDirServer}"
|
||||||
configAvailable=1
|
configAvailable=1
|
||||||
fi
|
fi
|
||||||
if [ -f ${dirConfig}/DIR ] ; then
|
if [ -f ${dirConfig}/ks-upload-dirlocal ] ; then
|
||||||
showDirLocal=$(cat ${dirConfig}/DIR)
|
showDirLocal=$(cat ${dirConfig}/ks-upload-dirlocal)
|
||||||
echo "- Scan Path (Local): ${showDirLocal}"
|
echo "- Scan Path (Local): ${showDirLocal}"
|
||||||
configAvailable=1
|
configAvailable=1
|
||||||
fi
|
fi
|
||||||
|
@ -237,11 +309,19 @@ function editConfig() {
|
||||||
editConfig=0
|
editConfig=0
|
||||||
while [ ${editConfig} -eq 0 ] ; do
|
while [ ${editConfig} -eq 0 ] ; do
|
||||||
clear
|
clear
|
||||||
editUser=$(cat ${dirConfig}/USER 2> /dev/null)
|
editUser=$(cat ${dirConfig}/ks-upload-user 2> /dev/null)
|
||||||
editPassword=$(cat ${dirConfig}/PASS 2> /dev/null)
|
readPasswordEncrypted=$(cat ${dirConfig}/ks-upload-pass)
|
||||||
editServer=$(cat ${dirConfig}/SERVER 2> /dev/null)
|
readPasswordDecrypted=$(decrypt_kstools "${readPasswordEncrypted}")
|
||||||
editDirServer=$(cat ${dirConfig}/DIR_SERVER 2> /dev/null)
|
readPasswordChars=$(echo ${readPasswordDecrypted} | wc -m)
|
||||||
editDirLocal=$(cat ${dirConfig}/DIR 2> /dev/null)
|
totalchars=0
|
||||||
|
editPassword=""
|
||||||
|
while [ ${totalchars} -lt ${readPasswordChars} ] ; do
|
||||||
|
editPassword="${editPassword}*"
|
||||||
|
totalchars=$(expr ${totalchars} + 1)
|
||||||
|
done
|
||||||
|
editServer=$(cat ${dirConfig}/ks-upload-server 2> /dev/null)
|
||||||
|
editDirServer=$(cat ${dirConfig}/ks-upload-dirserver 2> /dev/null)
|
||||||
|
editDirLocal=$(cat ${dirConfig}/ks-upload-dirlocal 2> /dev/null)
|
||||||
echo ""
|
echo ""
|
||||||
echo "* ks-upa (ks-tools) v${VERSION} (${M_DATE})"
|
echo "* ks-upa (ks-tools) v${VERSION} (${M_DATE})"
|
||||||
echo ""
|
echo ""
|
||||||
|
@ -258,23 +338,24 @@ function editConfig() {
|
||||||
if [ "${EDIT}" == "1" ] ; then
|
if [ "${EDIT}" == "1" ] ; then
|
||||||
echo -n "* Enter the server user: " ; read USER
|
echo -n "* Enter the server user: " ; read USER
|
||||||
user=${USER}
|
user=${USER}
|
||||||
echo ${user} > ${dirConfig}/USER
|
echo ${user} > ${dirConfig}/ks-upload-user
|
||||||
elif [ "${EDIT}" == "2" ] ; then
|
elif [ "${EDIT}" == "2" ] ; then
|
||||||
echo -n "* Enter the server key: " ; read PASS
|
echo -n "* Enter the server key: " ; read PASS
|
||||||
password=${PASS}
|
raw_password_enter=${PASS}
|
||||||
echo ${password} > ${dirConfig}/PASS
|
encrypt_password_enter=$(encrypt_kstools "${raw_password_enter}")
|
||||||
|
echo ${encrypt_password_enter} > ${dirConfig}/ks-upload-pass
|
||||||
elif [ "${EDIT}" == "3" ] ; then
|
elif [ "${EDIT}" == "3" ] ; then
|
||||||
echo -n "* Enter the server URL: " ; read SERVER
|
echo -n "* Enter the server URL: " ; read SERVER
|
||||||
server=${SERVER}
|
server=${SERVER}
|
||||||
echo ${server} > ${dirConfig}/SERVER
|
echo ${server} > ${dirConfig}/ks-upload-server
|
||||||
elif [ "${EDIT}" == "4" ] ; then
|
elif [ "${EDIT}" == "4" ] ; then
|
||||||
echo -n "* Enter the path on the server: " ; read DIR_SERVER
|
echo -n "* Enter the path on the server: " ; read DIR_SERVER
|
||||||
dirServer=${DIR_SERVER}
|
dirServer=${DIR_SERVER}
|
||||||
echo ${dirServer} > ${dirConfig}/DIR_SERVER
|
echo ${dirServer} > ${dirConfig}/ks-upload-dirserver
|
||||||
elif [ "${EDIT}" == "5" ] ; then
|
elif [ "${EDIT}" == "5" ] ; then
|
||||||
echo -n "* Enter the local path to scan: " ; read DIR
|
echo -n "* Enter the local path to scan: " ; read DIR
|
||||||
dirLocal=${DIR}
|
dirLocal=${DIR}
|
||||||
echo ${dirLocal} > ${dirConfig}/DIR
|
echo ${dirLocal} > ${dirConfig}/ks-upload-dirlocal
|
||||||
elif [ "${EDIT}" == "6" ] ; then
|
elif [ "${EDIT}" == "6" ] ; then
|
||||||
editConfig=1
|
editConfig=1
|
||||||
else
|
else
|
||||||
|
@ -366,11 +447,11 @@ fi
|
||||||
|
|
||||||
# Delete the existing configuration.
|
# Delete the existing configuration.
|
||||||
if [ "$1" == "-r" ] ; then
|
if [ "$1" == "-r" ] ; then
|
||||||
rm -rf ${dirConfig}/USER
|
rm -rf ${dirConfig}/ks-upload-user
|
||||||
rm -rf ${dirConfig}/PASS
|
rm -rf ${dirConfig}/ks-upload-pass
|
||||||
rm -rf ${dirConfig}/SERVER
|
rm -rf ${dirConfig}/ks-upload-server
|
||||||
rm -rf ${dirConfig}/DIR_SERVER
|
rm -rf ${dirConfig}/ks-upload-dirserver
|
||||||
rm -rf ${dirConfig}/DIR
|
rm -rf ${dirConfig}/ks-upload-dirlocal
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -395,44 +476,46 @@ elif [ "$1" == "-i" ] ; then
|
||||||
echo ""
|
echo ""
|
||||||
checkDependencies
|
checkDependencies
|
||||||
# Ask the user and if it exists, read it from the config.
|
# Ask the user and if it exists, read it from the config.
|
||||||
if [ -f ${dirConfig}/USER ] ; then
|
if [ -f ${dirConfig}/ks-upload-user ] ; then
|
||||||
user=$(cat ${dirConfig}/USER)
|
user=$(cat ${dirConfig}/ks-upload-user)
|
||||||
else
|
else
|
||||||
echo -n "* Enter the server user: " ; read USER
|
echo -n "* Enter the server user: " ; read USER
|
||||||
user=${USER}
|
user=${USER}
|
||||||
echo ${user} > ${dirConfig}/USER
|
echo ${user} > ${dirConfig}/ks-upload-user
|
||||||
fi
|
fi
|
||||||
# Ask the password and if it exists, read it from the config.
|
# Ask the password and if it exists, read it from the config.
|
||||||
if [ -f ${dirConfig}/PASS ] ; then
|
if [ -f ${dirConfig}/ks-upload-pass ] ; then
|
||||||
password=$(cat ${dirConfig}/PASS)
|
raw_password=$(cat ${dirConfig}/ks-upload-pass)
|
||||||
|
password=$(decrypt_kstools "${raw_password}")
|
||||||
else
|
else
|
||||||
echo -n "* Enter the server key: " ; read PASS
|
echo -n "* Enter the server key: " ; read PASS
|
||||||
password=${PASS}
|
raw_password_enter=${PASS}
|
||||||
echo ${password} > ${dirConfig}/PASS
|
encrypt_password_enter=$(encrypt_kstools "${raw_password_enter}")
|
||||||
|
echo ${encrypt_password_enter} > ${dirConfig}/ks-upload-pass
|
||||||
fi
|
fi
|
||||||
# Ask the server URL and if it exists, read it from the config.
|
# Ask the server URL and if it exists, read it from the config.
|
||||||
if [ -f ${dirConfig}/SERVER ] ; then
|
if [ -f ${dirConfig}/ks-upload-server ] ; then
|
||||||
server=$(cat ${dirConfig}/SERVER)
|
server=$(cat ${dirConfig}/ks-upload-server)
|
||||||
else
|
else
|
||||||
echo -n "* Enter the server URL: " ; read SERVER
|
echo -n "* Enter the server URL: " ; read SERVER
|
||||||
server=${SERVER}
|
server=${SERVER}
|
||||||
echo ${server} > ${dirConfig}/SERVER
|
echo ${server} > ${dirConfig}/ks-upload-server
|
||||||
fi
|
fi
|
||||||
# Ask the path on the server and if it exists, read it from the config.
|
# Ask the path on the server and if it exists, read it from the config.
|
||||||
if [ -f ${dirConfig}/DIR_SERVER ] ; then
|
if [ -f ${dirConfig}/ks-upload-dirserver ] ; then
|
||||||
dirServer=$(cat ${dirConfig}/DIR_SERVER)
|
dirServer=$(cat ${dirConfig}/ks-upload-dirserver)
|
||||||
else
|
else
|
||||||
echo -n "* Enter the path on the server: " ; read DIR_SERVER
|
echo -n "* Enter the path on the server: " ; read DIR_SERVER
|
||||||
dirServer=${DIR_SERVER}
|
dirServer=${DIR_SERVER}
|
||||||
echo ${dirServer} > ${dirConfig}/DIR_SERVER
|
echo ${dirServer} > ${dirConfig}/ks-upload-dirserver
|
||||||
fi
|
fi
|
||||||
# Ask the local path and if it exists, read it from the config.
|
# Ask the local path and if it exists, read it from the config.
|
||||||
if [ -f ${dirConfig}/DIR ] ; then
|
if [ -f ${dirConfig}/ks-upload-dirlocal ] ; then
|
||||||
dirLocal=$(cat ${dirConfig}/DIR)
|
dirLocal=$(cat ${dirConfig}/ks-upload-dirlocal)
|
||||||
else
|
else
|
||||||
echo -n "* Enter the local path to scan: " ; read DIR
|
echo -n "* Enter the local path to scan: " ; read DIR
|
||||||
dirLocal=${DIR}
|
dirLocal=${DIR}
|
||||||
echo ${dirLocal} > ${dirConfig}/DIR
|
echo ${dirLocal} > ${dirConfig}/ks-upload-dirlocal
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Call the functions to perform the whole process.
|
# Call the functions to perform the whole process.
|
||||||
|
|
167
src/ks-upf
167
src/ks-upf
|
@ -212,34 +212,106 @@ function checkChecksum() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Generate random codes
|
||||||
|
function generate_codes() {
|
||||||
|
chars="abcdefghijklmnopqrstywxz1234567890ABCDEFHIJKLMNOPQRSTYWXZ@/"
|
||||||
|
long_code="${1}"
|
||||||
|
for i in {1} ; do
|
||||||
|
echo -n "${chars:RANDOM%${#chars}:1}"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to encrypt pass on config file
|
||||||
|
# Syntax: encrypt_kstools <password>
|
||||||
|
function encrypt_kstools() {
|
||||||
|
raw_pass="${1}"
|
||||||
|
characters_pass_raw=$(echo ${raw_pass} | wc -m)
|
||||||
|
characters_pass=$(expr ${characters_pass_raw} - 1)
|
||||||
|
total_characters=0
|
||||||
|
mkdir -p ${HOME}/.ks-tools/
|
||||||
|
rm -rf ${HOME}/.ks-tools/.seq-codes
|
||||||
|
while [ ${total_characters} -le ${characters_pass} ] ; do
|
||||||
|
num_gen=$(echo -n ${RANDOM} | cut -c1)
|
||||||
|
echo -n ${num_gen} >> ${HOME}/.ks-tools/.seq-codes
|
||||||
|
total_characters=$(expr ${total_characters} + 1)
|
||||||
|
done
|
||||||
|
characters_seq_raw=$(cat ${HOME}/.ks-tools/.seq-codes 2> /dev/null | wc -m)
|
||||||
|
characters_seq=$(expr ${characters_seq_raw} - 1)
|
||||||
|
total_characters=1
|
||||||
|
encrypted_pass=""
|
||||||
|
while [ ${total_characters} -le ${characters_pass} ] ; do
|
||||||
|
num_seq_read=$(cat ${HOME}/.ks-tools/.seq-codes 2> /dev/null | cut -c${total_characters})
|
||||||
|
character=$(echo ${raw_pass} | cut -c${total_characters})
|
||||||
|
repeat_seq=0
|
||||||
|
while [ ${repeat_seq} -lt ${num_seq_read} ] ; do
|
||||||
|
code_gen=$(generate_codes)
|
||||||
|
encrypted_pass="${encrypted_pass}${code_gen}"
|
||||||
|
repeat_seq=$(expr ${repeat_seq} + 1)
|
||||||
|
done
|
||||||
|
encrypted_pass="${encrypted_pass}${character}"
|
||||||
|
total_characters=$(expr ${total_characters} + 1)
|
||||||
|
done
|
||||||
|
code_gen=$(generate_codes)
|
||||||
|
encrypted_pass="${encrypted_pass}${code_gen}"
|
||||||
|
echo ${encrypted_pass}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to decrypt pass on config file
|
||||||
|
# Syntax: decrypt_kstools <password>
|
||||||
|
function decrypt_kstools() {
|
||||||
|
raw_pass_encrypted="${1}"
|
||||||
|
total_characters=1
|
||||||
|
codes_seq=$(cat ${HOME}/.ks-tools/.seq-codes 2> /dev/null)
|
||||||
|
num_codes_seq=$(cat ${HOME}/.ks-tools/.seq-codes 2> /dev/null | wc -m)
|
||||||
|
pass_decrypt=""
|
||||||
|
total_characters=1
|
||||||
|
pos_codes_pass=0
|
||||||
|
while [ ${total_characters} -lt ${num_codes_seq} ] ; do
|
||||||
|
pos_codes=$(echo ${codes_seq} | cut -c${total_characters})
|
||||||
|
pos_codes_pass=$(expr ${pos_codes_pass} + ${pos_codes} + 1)
|
||||||
|
pos_pass=$(expr ${raw_pass_encrypted} | cut -c${pos_codes_pass})
|
||||||
|
pass_decrypt="${pass_decrypt}${pos_pass}"
|
||||||
|
total_characters=$(expr ${total_characters} + 1)
|
||||||
|
done
|
||||||
|
echo ${pass_decrypt}
|
||||||
|
}
|
||||||
|
|
||||||
# Function to show config
|
# Function to show config
|
||||||
function showConfig() {
|
function showConfig() {
|
||||||
configAvailable=0
|
configAvailable=0
|
||||||
echo ""
|
echo ""
|
||||||
echo "* ks-upf (ks-tools) v${VERSION} (${M_DATE})"
|
echo "* ks-upf (ks-tools) v${VERSION} (${M_DATE})"
|
||||||
echo ""
|
echo ""
|
||||||
if [ -f ${dirConfig}/USER ] ; then
|
if [ -f ${dirConfig}/ks-upload-user ] ; then
|
||||||
showUser=$(cat ${dirConfig}/USER)
|
showUser=$(cat ${dirConfig}/ks-upload-user)
|
||||||
echo "- Server User: ${showUser}"
|
echo "- Server User: ${showUser}"
|
||||||
configAvailable=1
|
configAvailable=1
|
||||||
fi
|
fi
|
||||||
if [ -f ${dirConfig}/PASS ] ; then
|
if [ -f ${dirConfig}/ks-upload-pass ] ; then
|
||||||
showPassword=$(cat ${dirConfig}/PASS)
|
readPasswordEncrypted=$(cat ${dirConfig}/ks-upload-pass)
|
||||||
|
readPasswordDecrypted=$(decrypt_kstools "${readPasswordEncrypted}")
|
||||||
|
readPasswordChars=$(echo ${readPasswordDecrypted} | wc -m)
|
||||||
|
totalchars=0
|
||||||
|
showPassword=""
|
||||||
|
while [ ${totalchars} -lt ${readPasswordChars} ] ; do
|
||||||
|
showPassword="${showPassword}*"
|
||||||
|
totalchars=$(expr ${totalchars} + 1)
|
||||||
|
done
|
||||||
echo "- Server Password: ${showPassword}"
|
echo "- Server Password: ${showPassword}"
|
||||||
configAvailable=1
|
configAvailable=1
|
||||||
fi
|
fi
|
||||||
if [ -f ${dirConfig}/SERVER ] ; then
|
if [ -f ${dirConfig}/ks-upload-server ] ; then
|
||||||
showServer=$(cat ${dirConfig}/SERVER)
|
showServer=$(cat ${dirConfig}/ks-upload-server)
|
||||||
echo "- URL (or IP) Server: ${showServer}"
|
echo "- URL (or IP) Server: ${showServer}"
|
||||||
configAvailable=1
|
configAvailable=1
|
||||||
fi
|
fi
|
||||||
if [ -f ${dirConfig}/DIR_SERVER ] ; then
|
if [ -f ${dirConfig}/ks-upload-dirserver ] ; then
|
||||||
showDirServer=$(cat ${dirConfig}/DIR_SERVER)
|
showDirServer=$(cat ${dirConfig}/ks-upload-dirserver)
|
||||||
echo "- Destination Path (Server): ${showDirServer}"
|
echo "- Destination Path (Server): ${showDirServer}"
|
||||||
configAvailable=1
|
configAvailable=1
|
||||||
fi
|
fi
|
||||||
if [ -f ${dirConfig}/DIR ] ; then
|
if [ -f ${dirConfig}/ks-upload-dirlocal ] ; then
|
||||||
showDirLocal=$(cat ${dirConfig}/DIR)
|
showDirLocal=$(cat ${dirConfig}/ks-upload-dirlocal)
|
||||||
echo "- Scan Path (Local): ${showDirLocal}"
|
echo "- Scan Path (Local): ${showDirLocal}"
|
||||||
configAvailable=1
|
configAvailable=1
|
||||||
fi
|
fi
|
||||||
|
@ -255,11 +327,19 @@ function editConfig() {
|
||||||
editConfig=0
|
editConfig=0
|
||||||
while [ ${editConfig} -eq 0 ] ; do
|
while [ ${editConfig} -eq 0 ] ; do
|
||||||
clear
|
clear
|
||||||
editUser=$(cat ${dirConfig}/USER 2> /dev/null)
|
editUser=$(cat ${dirConfig}/ks-upload-user 2> /dev/null)
|
||||||
editPassword=$(cat ${dirConfig}/PASS 2> /dev/null)
|
readPasswordEncrypted=$(cat ${dirConfig}/ks-upload-pass)
|
||||||
editServer=$(cat ${dirConfig}/SERVER 2> /dev/null)
|
readPasswordDecrypted=$(decrypt_kstools "${readPasswordEncrypted}")
|
||||||
editDirServer=$(cat ${dirConfig}/DIR_SERVER 2> /dev/null)
|
readPasswordChars=$(echo ${readPasswordDecrypted} | wc -m)
|
||||||
editDirLocal=$(cat ${dirConfig}/DIR 2> /dev/null)
|
totalchars=0
|
||||||
|
editPassword=""
|
||||||
|
while [ ${totalchars} -lt ${readPasswordChars} ] ; do
|
||||||
|
editPassword="${editPassword}*"
|
||||||
|
totalchars=$(expr ${totalchars} + 1)
|
||||||
|
done
|
||||||
|
editServer=$(cat ${dirConfig}/ks-upload-server 2> /dev/null)
|
||||||
|
editDirServer=$(cat ${dirConfig}/ks-upload-dirserver 2> /dev/null)
|
||||||
|
editDirLocal=$(cat ${dirConfig}/ks-upload-dirlocal 2> /dev/null)
|
||||||
echo ""
|
echo ""
|
||||||
echo "* ks-upf (ks-tools) v${VERSION} (${M_DATE})"
|
echo "* ks-upf (ks-tools) v${VERSION} (${M_DATE})"
|
||||||
echo ""
|
echo ""
|
||||||
|
@ -276,23 +356,24 @@ function editConfig() {
|
||||||
if [ "${EDIT}" == "1" ] ; then
|
if [ "${EDIT}" == "1" ] ; then
|
||||||
echo -n "* Enter the server user: " ; read USER
|
echo -n "* Enter the server user: " ; read USER
|
||||||
user=${USER}
|
user=${USER}
|
||||||
echo ${user} > ${dirConfig}/USER
|
echo ${user} > ${dirConfig}/ks-upload-user
|
||||||
elif [ "${EDIT}" == "2" ] ; then
|
elif [ "${EDIT}" == "2" ] ; then
|
||||||
echo -n "* Enter the server key: " ; read PASS
|
echo -n "* Enter the server key: " ; read PASS
|
||||||
password=${PASS}
|
raw_password_enter=${PASS}
|
||||||
echo ${password} > ${dirConfig}/PASS
|
encrypt_password_enter=$(encrypt_kstools "${raw_password_enter}")
|
||||||
|
echo ${encrypt_password_enter} > ${dirConfig}/ks-upload-pass
|
||||||
elif [ "${EDIT}" == "3" ] ; then
|
elif [ "${EDIT}" == "3" ] ; then
|
||||||
echo -n "* Enter the server URL: " ; read SERVER
|
echo -n "* Enter the server URL: " ; read SERVER
|
||||||
server=${SERVER}
|
server=${SERVER}
|
||||||
echo ${server} > ${dirConfig}/SERVER
|
echo ${server} > ${dirConfig}/ks-upload-server
|
||||||
elif [ "${EDIT}" == "4" ] ; then
|
elif [ "${EDIT}" == "4" ] ; then
|
||||||
echo -n "* Enter the path on the server: " ; read DIR_SERVER
|
echo -n "* Enter the path on the server: " ; read DIR_SERVER
|
||||||
dirServer=${DIR_SERVER}
|
dirServer=${DIR_SERVER}
|
||||||
echo ${dirServer} > ${dirConfig}/DIR_SERVER
|
echo ${dirServer} > ${dirConfig}/ks-upload-dirserver
|
||||||
elif [ "${EDIT}" == "5" ] ; then
|
elif [ "${EDIT}" == "5" ] ; then
|
||||||
echo -n "* Enter the local path to scan: " ; read DIR
|
echo -n "* Enter the local path to scan: " ; read DIR
|
||||||
dirLocal=${DIR}
|
dirLocal=${DIR}
|
||||||
echo ${dirLocal} > ${dirConfig}/DIR
|
echo ${dirLocal} > ${dirConfig}/ks-upload-dirlocal
|
||||||
elif [ "${EDIT}" == "6" ] ; then
|
elif [ "${EDIT}" == "6" ] ; then
|
||||||
editConfig=1
|
editConfig=1
|
||||||
else
|
else
|
||||||
|
@ -384,11 +465,11 @@ fi
|
||||||
|
|
||||||
# Delete the existing configuration.
|
# Delete the existing configuration.
|
||||||
if [ "$1" == "-r" ] ; then
|
if [ "$1" == "-r" ] ; then
|
||||||
rm -rf ${dirConfig}/USER
|
rm -rf ${dirConfig}/ks-upload-user
|
||||||
rm -rf ${dirConfig}/PASS
|
rm -rf ${dirConfig}/ks-upload-pass
|
||||||
rm -rf ${dirConfig}/SERVER
|
rm -rf ${dirConfig}/ks-upload-server
|
||||||
rm -rf ${dirConfig}/DIR_SERVER
|
rm -rf ${dirConfig}/ks-upload-dirserver
|
||||||
rm -rf ${dirConfig}/DIR
|
rm -rf ${dirConfig}/ks-upload-dirlocal
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -413,44 +494,46 @@ elif [ "$1" == "-i" ] ; then
|
||||||
echo ""
|
echo ""
|
||||||
checkDependencies
|
checkDependencies
|
||||||
# Ask the user and if it exists, read it from the config.
|
# Ask the user and if it exists, read it from the config.
|
||||||
if [ -f ${dirConfig}/USER ] ; then
|
if [ -f ${dirConfig}/ks-upload-user ] ; then
|
||||||
user=$(cat ${dirConfig}/USER)
|
user=$(cat ${dirConfig}/ks-upload-user)
|
||||||
else
|
else
|
||||||
echo -n "* Enter the server user: " ; read USER
|
echo -n "* Enter the server user: " ; read USER
|
||||||
user=${USER}
|
user=${USER}
|
||||||
echo ${user} > ${dirConfig}/USER
|
echo ${user} > ${dirConfig}/ks-upload-user
|
||||||
fi
|
fi
|
||||||
# Ask the password and if it exists, read it from the config.
|
# Ask the password and if it exists, read it from the config.
|
||||||
if [ -f ${dirConfig}/PASS ] ; then
|
if [ -f ${dirConfig}/ks-upload-pass ] ; then
|
||||||
password=$(cat ${dirConfig}/PASS)
|
raw_password=$(cat ${dirConfig}/ks-upload-pass)
|
||||||
|
password=$(decrypt_kstools "${raw_password}")
|
||||||
else
|
else
|
||||||
echo -n "* Enter the server key: " ; read PASS
|
echo -n "* Enter the server key: " ; read PASS
|
||||||
password=${PASS}
|
raw_password_enter=${PASS}
|
||||||
echo ${password} > ${dirConfig}/PASS
|
encrypt_password_enter=$(encrypt_kstools "${raw_password_enter}")
|
||||||
|
echo ${encrypt_password_enter} > ${dirConfig}/ks-upload-pass
|
||||||
fi
|
fi
|
||||||
# Ask the server URL and if it exists, read it from the config.
|
# Ask the server URL and if it exists, read it from the config.
|
||||||
if [ -f ${dirConfig}/SERVER ] ; then
|
if [ -f ${dirConfig}/ks-upload-server ] ; then
|
||||||
server=$(cat ${dirConfig}/SERVER)
|
server=$(cat ${dirConfig}/ks-upload-server)
|
||||||
else
|
else
|
||||||
echo -n "* Enter the server URL: " ; read SERVER
|
echo -n "* Enter the server URL: " ; read SERVER
|
||||||
server=${SERVER}
|
server=${SERVER}
|
||||||
echo ${server} > ${dirConfig}/SERVER
|
echo ${server} > ${dirConfig}/ks-upload-server
|
||||||
fi
|
fi
|
||||||
# Ask the path on the server and if it exists, read it from the config.
|
# Ask the path on the server and if it exists, read it from the config.
|
||||||
if [ -f ${dirConfig}/DIR_SERVER ] ; then
|
if [ -f ${dirConfig}/ks-upload-dirserver ] ; then
|
||||||
dirServer=$(cat ${dirConfig}/DIR_SERVER)
|
dirServer=$(cat ${dirConfig}/ks-upload-dirserver)
|
||||||
else
|
else
|
||||||
echo -n "* Enter the path on the server: " ; read DIR_SERVER
|
echo -n "* Enter the path on the server: " ; read DIR_SERVER
|
||||||
dirServer=${DIR_SERVER}
|
dirServer=${DIR_SERVER}
|
||||||
echo ${dirServer} > ${dirConfig}/DIR_SERVER
|
echo ${dirServer} > ${dirConfig}/ks-upload-dirserver
|
||||||
fi
|
fi
|
||||||
# Ask the local path and if it exists, read it from the config.
|
# Ask the local path and if it exists, read it from the config.
|
||||||
if [ -f ${dirConfig}/DIR ] ; then
|
if [ -f ${dirConfig}/ks-upload-dirlocal ] ; then
|
||||||
dirLocal=$(cat ${dirConfig}/DIR)
|
dirLocal=$(cat ${dirConfig}/ks-upload-dirlocal)
|
||||||
else
|
else
|
||||||
echo -n "* Enter the local path to scan: " ; read DIR
|
echo -n "* Enter the local path to scan: " ; read DIR
|
||||||
dirLocal=${DIR}
|
dirLocal=${DIR}
|
||||||
echo ${dirLocal} > ${dirConfig}/DIR
|
echo ${dirLocal} > ${dirConfig}/ks-upload-dirlocal
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Call the functions to perform the whole process.
|
# Call the functions to perform the whole process.
|
||||||
|
|
167
src/ks-upr
167
src/ks-upr
|
@ -154,34 +154,106 @@ function sendFile() {
|
||||||
sshpass -p ${1} ssh ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
sshpass -p ${1} ssh ${3}@${4} rm -rf ${5}/.${6}.* &> /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Generate random codes
|
||||||
|
function generate_codes() {
|
||||||
|
chars="abcdefghijklmnopqrstywxz1234567890ABCDEFHIJKLMNOPQRSTYWXZ@/"
|
||||||
|
long_code="${1}"
|
||||||
|
for i in {1} ; do
|
||||||
|
echo -n "${chars:RANDOM%${#chars}:1}"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to encrypt pass on config file
|
||||||
|
# Syntax: encrypt_kstools <password>
|
||||||
|
function encrypt_kstools() {
|
||||||
|
raw_pass="${1}"
|
||||||
|
characters_pass_raw=$(echo ${raw_pass} | wc -m)
|
||||||
|
characters_pass=$(expr ${characters_pass_raw} - 1)
|
||||||
|
total_characters=0
|
||||||
|
mkdir -p ${HOME}/.ks-tools/
|
||||||
|
rm -rf ${HOME}/.ks-tools/.seq-codes
|
||||||
|
while [ ${total_characters} -le ${characters_pass} ] ; do
|
||||||
|
num_gen=$(echo -n ${RANDOM} | cut -c1)
|
||||||
|
echo -n ${num_gen} >> ${HOME}/.ks-tools/.seq-codes
|
||||||
|
total_characters=$(expr ${total_characters} + 1)
|
||||||
|
done
|
||||||
|
characters_seq_raw=$(cat ${HOME}/.ks-tools/.seq-codes 2> /dev/null | wc -m)
|
||||||
|
characters_seq=$(expr ${characters_seq_raw} - 1)
|
||||||
|
total_characters=1
|
||||||
|
encrypted_pass=""
|
||||||
|
while [ ${total_characters} -le ${characters_pass} ] ; do
|
||||||
|
num_seq_read=$(cat ${HOME}/.ks-tools/.seq-codes 2> /dev/null | cut -c${total_characters})
|
||||||
|
character=$(echo ${raw_pass} | cut -c${total_characters})
|
||||||
|
repeat_seq=0
|
||||||
|
while [ ${repeat_seq} -lt ${num_seq_read} ] ; do
|
||||||
|
code_gen=$(generate_codes)
|
||||||
|
encrypted_pass="${encrypted_pass}${code_gen}"
|
||||||
|
repeat_seq=$(expr ${repeat_seq} + 1)
|
||||||
|
done
|
||||||
|
encrypted_pass="${encrypted_pass}${character}"
|
||||||
|
total_characters=$(expr ${total_characters} + 1)
|
||||||
|
done
|
||||||
|
code_gen=$(generate_codes)
|
||||||
|
encrypted_pass="${encrypted_pass}${code_gen}"
|
||||||
|
echo ${encrypted_pass}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to decrypt pass on config file
|
||||||
|
# Syntax: decrypt_kstools <password>
|
||||||
|
function decrypt_kstools() {
|
||||||
|
raw_pass_encrypted="${1}"
|
||||||
|
total_characters=1
|
||||||
|
codes_seq=$(cat ${HOME}/.ks-tools/.seq-codes 2> /dev/null)
|
||||||
|
num_codes_seq=$(cat ${HOME}/.ks-tools/.seq-codes 2> /dev/null | wc -m)
|
||||||
|
pass_decrypt=""
|
||||||
|
total_characters=1
|
||||||
|
pos_codes_pass=0
|
||||||
|
while [ ${total_characters} -lt ${num_codes_seq} ] ; do
|
||||||
|
pos_codes=$(echo ${codes_seq} | cut -c${total_characters})
|
||||||
|
pos_codes_pass=$(expr ${pos_codes_pass} + ${pos_codes} + 1)
|
||||||
|
pos_pass=$(expr ${raw_pass_encrypted} | cut -c${pos_codes_pass})
|
||||||
|
pass_decrypt="${pass_decrypt}${pos_pass}"
|
||||||
|
total_characters=$(expr ${total_characters} + 1)
|
||||||
|
done
|
||||||
|
echo ${pass_decrypt}
|
||||||
|
}
|
||||||
|
|
||||||
# Function to show config
|
# Function to show config
|
||||||
function showConfig() {
|
function showConfig() {
|
||||||
configAvailable=0
|
configAvailable=0
|
||||||
echo ""
|
echo ""
|
||||||
echo "* ks-upr (ks-tools) v${VERSION} (${M_DATE})"
|
echo "* ks-upr (ks-tools) v${VERSION} (${M_DATE})"
|
||||||
echo ""
|
echo ""
|
||||||
if [ -f ${dirConfig}/USER ] ; then
|
if [ -f ${dirConfig}/ks-upload-user ] ; then
|
||||||
showUser=$(cat ${dirConfig}/USER)
|
showUser=$(cat ${dirConfig}/ks-upload-user)
|
||||||
echo "- Server User: ${showUser}"
|
echo "- Server User: ${showUser}"
|
||||||
configAvailable=1
|
configAvailable=1
|
||||||
fi
|
fi
|
||||||
if [ -f ${dirConfig}/PASS ] ; then
|
if [ -f ${dirConfig}/ks-upload-pass ] ; then
|
||||||
showPassword=$(cat ${dirConfig}/PASS)
|
readPasswordEncrypted=$(cat ${dirConfig}/ks-upload-pass)
|
||||||
|
readPasswordDecrypted=$(decrypt_kstools "${readPasswordEncrypted}")
|
||||||
|
readPasswordChars=$(echo ${readPasswordDecrypted} | wc -m)
|
||||||
|
totalchars=0
|
||||||
|
showPassword=""
|
||||||
|
while [ ${totalchars} -lt ${readPasswordChars} ] ; do
|
||||||
|
showPassword="${showPassword}*"
|
||||||
|
totalchars=$(expr ${totalchars} + 1)
|
||||||
|
done
|
||||||
echo "- Server Password: ${showPassword}"
|
echo "- Server Password: ${showPassword}"
|
||||||
configAvailable=1
|
configAvailable=1
|
||||||
fi
|
fi
|
||||||
if [ -f ${dirConfig}/SERVER ] ; then
|
if [ -f ${dirConfig}/ks-upload-server ] ; then
|
||||||
showServer=$(cat ${dirConfig}/SERVER)
|
showServer=$(cat ${dirConfig}/ks-upload-server)
|
||||||
echo "- URL (or IP) Server: ${showServer}"
|
echo "- URL (or IP) Server: ${showServer}"
|
||||||
configAvailable=1
|
configAvailable=1
|
||||||
fi
|
fi
|
||||||
if [ -f ${dirConfig}/DIR_SERVER ] ; then
|
if [ -f ${dirConfig}/ks-upload-dirserver ] ; then
|
||||||
showDirServer=$(cat ${dirConfig}/DIR_SERVER)
|
showDirServer=$(cat ${dirConfig}/ks-upload-dirserver)
|
||||||
echo "- Destination Path (Server): ${showDirServer}"
|
echo "- Destination Path (Server): ${showDirServer}"
|
||||||
configAvailable=1
|
configAvailable=1
|
||||||
fi
|
fi
|
||||||
if [ -f ${dirConfig}/DIR ] ; then
|
if [ -f ${dirConfig}/ks-upload-dirlocal ] ; then
|
||||||
showDirLocal=$(cat ${dirConfig}/DIR)
|
showDirLocal=$(cat ${dirConfig}/ks-upload-dirlocal)
|
||||||
echo "- Scan Path (Local): ${showDirLocal}"
|
echo "- Scan Path (Local): ${showDirLocal}"
|
||||||
configAvailable=1
|
configAvailable=1
|
||||||
fi
|
fi
|
||||||
|
@ -197,11 +269,19 @@ function editConfig() {
|
||||||
editConfig=0
|
editConfig=0
|
||||||
while [ ${editConfig} -eq 0 ] ; do
|
while [ ${editConfig} -eq 0 ] ; do
|
||||||
clear
|
clear
|
||||||
editUser=$(cat ${dirConfig}/USER 2> /dev/null)
|
editUser=$(cat ${dirConfig}/ks-upload-user 2> /dev/null)
|
||||||
editPassword=$(cat ${dirConfig}/PASS 2> /dev/null)
|
readPasswordEncrypted=$(cat ${dirConfig}/ks-upload-pass)
|
||||||
editServer=$(cat ${dirConfig}/SERVER 2> /dev/null)
|
readPasswordDecrypted=$(decrypt_kstools "${readPasswordEncrypted}")
|
||||||
editDirServer=$(cat ${dirConfig}/DIR_SERVER 2> /dev/null)
|
readPasswordChars=$(echo ${readPasswordDecrypted} | wc -m)
|
||||||
editDirLocal=$(cat ${dirConfig}/DIR 2> /dev/null)
|
totalchars=0
|
||||||
|
editPassword=""
|
||||||
|
while [ ${totalchars} -lt ${readPasswordChars} ] ; do
|
||||||
|
editPassword="${editPassword}*"
|
||||||
|
totalchars=$(expr ${totalchars} + 1)
|
||||||
|
done
|
||||||
|
editServer=$(cat ${dirConfig}/ks-upload-server 2> /dev/null)
|
||||||
|
editDirServer=$(cat ${dirConfig}/ks-upload-dirserver 2> /dev/null)
|
||||||
|
editDirLocal=$(cat ${dirConfig}/ks-upload-dirlocal 2> /dev/null)
|
||||||
echo ""
|
echo ""
|
||||||
echo "* ks-upr (ks-tools) v${VERSION} (${M_DATE})"
|
echo "* ks-upr (ks-tools) v${VERSION} (${M_DATE})"
|
||||||
echo ""
|
echo ""
|
||||||
|
@ -218,23 +298,24 @@ function editConfig() {
|
||||||
if [ "${EDIT}" == "1" ] ; then
|
if [ "${EDIT}" == "1" ] ; then
|
||||||
echo -n "* Enter the server user: " ; read USER
|
echo -n "* Enter the server user: " ; read USER
|
||||||
user=${USER}
|
user=${USER}
|
||||||
echo ${user} > ${dirConfig}/USER
|
echo ${user} > ${dirConfig}/ks-upload-user
|
||||||
elif [ "${EDIT}" == "2" ] ; then
|
elif [ "${EDIT}" == "2" ] ; then
|
||||||
echo -n "* Enter the server key: " ; read PASS
|
echo -n "* Enter the server key: " ; read PASS
|
||||||
password=${PASS}
|
raw_password_enter=${PASS}
|
||||||
echo ${password} > ${dirConfig}/PASS
|
encrypt_password_enter=$(encrypt_kstools "${raw_password_enter}")
|
||||||
|
echo ${encrypt_password_enter} > ${dirConfig}/ks-upload-pass
|
||||||
elif [ "${EDIT}" == "3" ] ; then
|
elif [ "${EDIT}" == "3" ] ; then
|
||||||
echo -n "* Enter the server URL: " ; read SERVER
|
echo -n "* Enter the server URL: " ; read SERVER
|
||||||
server=${SERVER}
|
server=${SERVER}
|
||||||
echo ${server} > ${dirConfig}/SERVER
|
echo ${server} > ${dirConfig}/ks-upload-server
|
||||||
elif [ "${EDIT}" == "4" ] ; then
|
elif [ "${EDIT}" == "4" ] ; then
|
||||||
echo -n "* Enter the path on the server: " ; read DIR_SERVER
|
echo -n "* Enter the path on the server: " ; read DIR_SERVER
|
||||||
dirServer=${DIR_SERVER}
|
dirServer=${DIR_SERVER}
|
||||||
echo ${dirServer} > ${dirConfig}/DIR_SERVER
|
echo ${dirServer} > ${dirConfig}/ks-upload-dirserver
|
||||||
elif [ "${EDIT}" == "5" ] ; then
|
elif [ "${EDIT}" == "5" ] ; then
|
||||||
echo -n "* Enter the local path to scan: " ; read DIR
|
echo -n "* Enter the local path to scan: " ; read DIR
|
||||||
dirLocal=${DIR}
|
dirLocal=${DIR}
|
||||||
echo ${dirLocal} > ${dirConfig}/DIR
|
echo ${dirLocal} > ${dirConfig}/ks-upload-dirlocal
|
||||||
elif [ "${EDIT}" == "6" ] ; then
|
elif [ "${EDIT}" == "6" ] ; then
|
||||||
editConfig=1
|
editConfig=1
|
||||||
else
|
else
|
||||||
|
@ -326,11 +407,11 @@ fi
|
||||||
|
|
||||||
# Delete the existing configuration.
|
# Delete the existing configuration.
|
||||||
if [ "$1" == "-r" ] ; then
|
if [ "$1" == "-r" ] ; then
|
||||||
rm -rf ${dirConfig}/USER
|
rm -rf ${dirConfig}/ks-upload-user
|
||||||
rm -rf ${dirConfig}/PASS
|
rm -rf ${dirConfig}/ks-upload-pass
|
||||||
rm -rf ${dirConfig}/SERVER
|
rm -rf ${dirConfig}/ks-upload-server
|
||||||
rm -rf ${dirConfig}/DIR_SERVER
|
rm -rf ${dirConfig}/ks-upload-dirserver
|
||||||
rm -rf ${dirConfig}/DIR
|
rm -rf ${dirConfig}/ks-upload-dirlocal
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -355,44 +436,46 @@ elif [ "$1" == "-i" ] ; then
|
||||||
echo ""
|
echo ""
|
||||||
checkDependencies
|
checkDependencies
|
||||||
# Ask the user and if it exists, read it from the config.
|
# Ask the user and if it exists, read it from the config.
|
||||||
if [ -f ${dirConfig}/USER ] ; then
|
if [ -f ${dirConfig}/ks-upload-user ] ; then
|
||||||
user=$(cat ${dirConfig}/USER)
|
user=$(cat ${dirConfig}/ks-upload-user)
|
||||||
else
|
else
|
||||||
echo -n "* Enter the server user: " ; read USER
|
echo -n "* Enter the server user: " ; read USER
|
||||||
user=${USER}
|
user=${USER}
|
||||||
echo ${user} > ${dirConfig}/USER
|
echo ${user} > ${dirConfig}/ks-upload-user
|
||||||
fi
|
fi
|
||||||
# Ask the password and if it exists, read it from the config.
|
# Ask the password and if it exists, read it from the config.
|
||||||
if [ -f ${dirConfig}/PASS ] ; then
|
if [ -f ${dirConfig}/ks-upload-pass ] ; then
|
||||||
password=$(cat ${dirConfig}/PASS)
|
raw_password=$(cat ${dirConfig}/ks-upload-pass)
|
||||||
|
password=$(decrypt_kstools "${raw_password}")
|
||||||
else
|
else
|
||||||
echo -n "* Enter the server key: " ; read PASS
|
echo -n "* Enter the server key: " ; read PASS
|
||||||
password=${PASS}
|
raw_password_enter=${PASS}
|
||||||
echo ${password} > ${dirConfig}/PASS
|
encrypt_password_enter=$(encrypt_kstools "${raw_password_enter}")
|
||||||
|
echo ${encrypt_password_enter} > ${dirConfig}/ks-upload-pass
|
||||||
fi
|
fi
|
||||||
# Ask the server URL and if it exists, read it from the config.
|
# Ask the server URL and if it exists, read it from the config.
|
||||||
if [ -f ${dirConfig}/SERVER ] ; then
|
if [ -f ${dirConfig}/ks-upload-server ] ; then
|
||||||
server=$(cat ${dirConfig}/SERVER)
|
server=$(cat ${dirConfig}/ks-upload-server)
|
||||||
else
|
else
|
||||||
echo -n "* Enter the server URL: " ; read SERVER
|
echo -n "* Enter the server URL: " ; read SERVER
|
||||||
server=${SERVER}
|
server=${SERVER}
|
||||||
echo ${server} > ${dirConfig}/SERVER
|
echo ${server} > ${dirConfig}/ks-upload-server
|
||||||
fi
|
fi
|
||||||
# Ask the path on the server and if it exists, read it from the config.
|
# Ask the path on the server and if it exists, read it from the config.
|
||||||
if [ -f ${dirConfig}/DIR_SERVER ] ; then
|
if [ -f ${dirConfig}/ks-upload-dirserver ] ; then
|
||||||
dirServer=$(cat ${dirConfig}/DIR_SERVER)
|
dirServer=$(cat ${dirConfig}/ks-upload-dirserver)
|
||||||
else
|
else
|
||||||
echo -n "* Enter the path on the server: " ; read DIR_SERVER
|
echo -n "* Enter the path on the server: " ; read DIR_SERVER
|
||||||
dirServer=${DIR_SERVER}
|
dirServer=${DIR_SERVER}
|
||||||
echo ${dirServer} > ${dirConfig}/DIR_SERVER
|
echo ${dirServer} > ${dirConfig}/ks-upload-dirserver
|
||||||
fi
|
fi
|
||||||
# Ask the local path and if it exists, read it from the config.
|
# Ask the local path and if it exists, read it from the config.
|
||||||
if [ -f ${dirConfig}/DIR ] ; then
|
if [ -f ${dirConfig}/ks-upload-dirlocal ] ; then
|
||||||
dirLocal=$(cat ${dirConfig}/DIR)
|
dirLocal=$(cat ${dirConfig}/ks-upload-dirlocal)
|
||||||
else
|
else
|
||||||
echo -n "* Enter the local path to scan: " ; read DIR
|
echo -n "* Enter the local path to scan: " ; read DIR
|
||||||
dirLocal=${DIR}
|
dirLocal=${DIR}
|
||||||
echo ${dirLocal} > ${dirConfig}/DIR
|
echo ${dirLocal} > ${dirConfig}/ks-upload-dirlocal
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Call the functions to perform the whole process.
|
# Call the functions to perform the whole process.
|
||||||
|
|
170
src/ks-upv
170
src/ks-upv
|
@ -14,7 +14,7 @@ dirTemp="/tmp"
|
||||||
listCompTemp="ks-tools.list-full"
|
listCompTemp="ks-tools.list-full"
|
||||||
listCompTempTest="ks-tools.list-full.test"
|
listCompTempTest="ks-tools.list-full.test"
|
||||||
listTemp="ks-tools.list"
|
listTemp="ks-tools.list"
|
||||||
dirConfig="$HOME/.ks-tools"
|
dirConfig="${HOME}/.ks-tools"
|
||||||
ksToolsTempFolder="/tmp/ks-tools"
|
ksToolsTempFolder="/tmp/ks-tools"
|
||||||
|
|
||||||
# Check cygwin alias (for Windows)
|
# Check cygwin alias (for Windows)
|
||||||
|
@ -129,6 +129,7 @@ function showPathFile() {
|
||||||
echo ${pathFile}
|
echo ${pathFile}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Function to send file to server.
|
# Function to send file to server.
|
||||||
# Syntax: sendFile <password> <file path> <user> <server> <server path> [file name]
|
# Syntax: sendFile <password> <file path> <user> <server> <server path> [file name]
|
||||||
function sendFile() {
|
function sendFile() {
|
||||||
|
@ -194,34 +195,106 @@ function checkChecksum() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Generate random codes
|
||||||
|
function generate_codes() {
|
||||||
|
chars="abcdefghijklmnopqrstywxz1234567890ABCDEFHIJKLMNOPQRSTYWXZ@/"
|
||||||
|
long_code="${1}"
|
||||||
|
for i in {1} ; do
|
||||||
|
echo -n "${chars:RANDOM%${#chars}:1}"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to encrypt pass on config file
|
||||||
|
# Syntax: encrypt_kstools <password>
|
||||||
|
function encrypt_kstools() {
|
||||||
|
raw_pass="${1}"
|
||||||
|
characters_pass_raw=$(echo ${raw_pass} | wc -m)
|
||||||
|
characters_pass=$(expr ${characters_pass_raw} - 1)
|
||||||
|
total_characters=0
|
||||||
|
mkdir -p ${HOME}/.ks-tools/
|
||||||
|
rm -rf ${HOME}/.ks-tools/.seq-codes
|
||||||
|
while [ ${total_characters} -le ${characters_pass} ] ; do
|
||||||
|
num_gen=$(echo -n ${RANDOM} | cut -c1)
|
||||||
|
echo -n ${num_gen} >> ${HOME}/.ks-tools/.seq-codes
|
||||||
|
total_characters=$(expr ${total_characters} + 1)
|
||||||
|
done
|
||||||
|
characters_seq_raw=$(cat ${HOME}/.ks-tools/.seq-codes 2> /dev/null | wc -m)
|
||||||
|
characters_seq=$(expr ${characters_seq_raw} - 1)
|
||||||
|
total_characters=1
|
||||||
|
encrypted_pass=""
|
||||||
|
while [ ${total_characters} -le ${characters_pass} ] ; do
|
||||||
|
num_seq_read=$(cat ${HOME}/.ks-tools/.seq-codes 2> /dev/null | cut -c${total_characters})
|
||||||
|
character=$(echo ${raw_pass} | cut -c${total_characters})
|
||||||
|
repeat_seq=0
|
||||||
|
while [ ${repeat_seq} -lt ${num_seq_read} ] ; do
|
||||||
|
code_gen=$(generate_codes)
|
||||||
|
encrypted_pass="${encrypted_pass}${code_gen}"
|
||||||
|
repeat_seq=$(expr ${repeat_seq} + 1)
|
||||||
|
done
|
||||||
|
encrypted_pass="${encrypted_pass}${character}"
|
||||||
|
total_characters=$(expr ${total_characters} + 1)
|
||||||
|
done
|
||||||
|
code_gen=$(generate_codes)
|
||||||
|
encrypted_pass="${encrypted_pass}${code_gen}"
|
||||||
|
echo ${encrypted_pass}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to decrypt pass on config file
|
||||||
|
# Syntax: decrypt_kstools <password>
|
||||||
|
function decrypt_kstools() {
|
||||||
|
raw_pass_encrypted="${1}"
|
||||||
|
total_characters=1
|
||||||
|
codes_seq=$(cat ${HOME}/.ks-tools/.seq-codes 2> /dev/null)
|
||||||
|
num_codes_seq=$(cat ${HOME}/.ks-tools/.seq-codes 2> /dev/null | wc -m)
|
||||||
|
pass_decrypt=""
|
||||||
|
total_characters=1
|
||||||
|
pos_codes_pass=0
|
||||||
|
while [ ${total_characters} -lt ${num_codes_seq} ] ; do
|
||||||
|
pos_codes=$(echo ${codes_seq} | cut -c${total_characters})
|
||||||
|
pos_codes_pass=$(expr ${pos_codes_pass} + ${pos_codes} + 1)
|
||||||
|
pos_pass=$(expr ${raw_pass_encrypted} | cut -c${pos_codes_pass})
|
||||||
|
pass_decrypt="${pass_decrypt}${pos_pass}"
|
||||||
|
total_characters=$(expr ${total_characters} + 1)
|
||||||
|
done
|
||||||
|
echo ${pass_decrypt}
|
||||||
|
}
|
||||||
|
|
||||||
# Function to show config
|
# Function to show config
|
||||||
function showConfig() {
|
function showConfig() {
|
||||||
configAvailable=0
|
configAvailable=0
|
||||||
echo ""
|
echo ""
|
||||||
echo "* ks-upv (ks-tools) v${VERSION} (${M_DATE})"
|
echo "* ks-upv (ks-tools) v${VERSION} (${M_DATE})"
|
||||||
echo ""
|
echo ""
|
||||||
if [ -f ${dirConfig}/USER ] ; then
|
if [ -f ${dirConfig}/ks-upload-user ] ; then
|
||||||
showUser=$(cat ${dirConfig}/USER)
|
showUser=$(cat ${dirConfig}/ks-upload-user)
|
||||||
echo "- Server User: ${showUser}"
|
echo "- Server User: ${showUser}"
|
||||||
configAvailable=1
|
configAvailable=1
|
||||||
fi
|
fi
|
||||||
if [ -f ${dirConfig}/PASS ] ; then
|
if [ -f ${dirConfig}/ks-upload-pass ] ; then
|
||||||
showPassword=$(cat ${dirConfig}/PASS)
|
readPasswordEncrypted=$(cat ${dirConfig}/ks-upload-pass)
|
||||||
|
readPasswordDecrypted=$(decrypt_kstools "${readPasswordEncrypted}")
|
||||||
|
readPasswordChars=$(echo ${readPasswordDecrypted} | wc -m)
|
||||||
|
totalchars=0
|
||||||
|
showPassword=""
|
||||||
|
while [ ${totalchars} -lt ${readPasswordChars} ] ; do
|
||||||
|
showPassword="${showPassword}*"
|
||||||
|
totalchars=$(expr ${totalchars} + 1)
|
||||||
|
done
|
||||||
echo "- Server Password: ${showPassword}"
|
echo "- Server Password: ${showPassword}"
|
||||||
configAvailable=1
|
configAvailable=1
|
||||||
fi
|
fi
|
||||||
if [ -f ${dirConfig}/SERVER ] ; then
|
if [ -f ${dirConfig}/ks-upload-server ] ; then
|
||||||
showServer=$(cat ${dirConfig}/SERVER)
|
showServer=$(cat ${dirConfig}/ks-upload-server)
|
||||||
echo "- URL (or IP) Server: ${showServer}"
|
echo "- URL (or IP) Server: ${showServer}"
|
||||||
configAvailable=1
|
configAvailable=1
|
||||||
fi
|
fi
|
||||||
if [ -f ${dirConfig}/DIR_SERVER ] ; then
|
if [ -f ${dirConfig}/ks-upload-dirserver ] ; then
|
||||||
showDirServer=$(cat ${dirConfig}/DIR_SERVER)
|
showDirServer=$(cat ${dirConfig}/ks-upload-dirserver)
|
||||||
echo "- Destination Path (Server): ${showDirServer}"
|
echo "- Destination Path (Server): ${showDirServer}"
|
||||||
configAvailable=1
|
configAvailable=1
|
||||||
fi
|
fi
|
||||||
if [ -f ${dirConfig}/DIR ] ; then
|
if [ -f ${dirConfig}/ks-upload-dirlocal ] ; then
|
||||||
showDirLocal=$(cat ${dirConfig}/DIR)
|
showDirLocal=$(cat ${dirConfig}/ks-upload-dirlocal)
|
||||||
echo "- Scan Path (Local): ${showDirLocal}"
|
echo "- Scan Path (Local): ${showDirLocal}"
|
||||||
configAvailable=1
|
configAvailable=1
|
||||||
fi
|
fi
|
||||||
|
@ -237,11 +310,19 @@ function editConfig() {
|
||||||
editConfig=0
|
editConfig=0
|
||||||
while [ ${editConfig} -eq 0 ] ; do
|
while [ ${editConfig} -eq 0 ] ; do
|
||||||
clear
|
clear
|
||||||
editUser=$(cat ${dirConfig}/USER 2> /dev/null)
|
editUser=$(cat ${dirConfig}/ks-upload-user 2> /dev/null)
|
||||||
editPassword=$(cat ${dirConfig}/PASS 2> /dev/null)
|
readPasswordEncrypted=$(cat ${dirConfig}/ks-upload-pass)
|
||||||
editServer=$(cat ${dirConfig}/SERVER 2> /dev/null)
|
readPasswordDecrypted=$(decrypt_kstools "${readPasswordEncrypted}")
|
||||||
editDirServer=$(cat ${dirConfig}/DIR_SERVER 2> /dev/null)
|
readPasswordChars=$(echo ${readPasswordDecrypted} | wc -m)
|
||||||
editDirLocal=$(cat ${dirConfig}/DIR 2> /dev/null)
|
totalchars=0
|
||||||
|
editPassword=""
|
||||||
|
while [ ${totalchars} -lt ${readPasswordChars} ] ; do
|
||||||
|
editPassword="${editPassword}*"
|
||||||
|
totalchars=$(expr ${totalchars} + 1)
|
||||||
|
done
|
||||||
|
editServer=$(cat ${dirConfig}/ks-upload-server 2> /dev/null)
|
||||||
|
editDirServer=$(cat ${dirConfig}/ks-upload-dirserver 2> /dev/null)
|
||||||
|
editDirLocal=$(cat ${dirConfig}/ks-upload-dirlocal 2> /dev/null)
|
||||||
echo ""
|
echo ""
|
||||||
echo "* ks-upv (ks-tools) v${VERSION} (${M_DATE})"
|
echo "* ks-upv (ks-tools) v${VERSION} (${M_DATE})"
|
||||||
echo ""
|
echo ""
|
||||||
|
@ -258,23 +339,24 @@ function editConfig() {
|
||||||
if [ "${EDIT}" == "1" ] ; then
|
if [ "${EDIT}" == "1" ] ; then
|
||||||
echo -n "* Enter the server user: " ; read USER
|
echo -n "* Enter the server user: " ; read USER
|
||||||
user=${USER}
|
user=${USER}
|
||||||
echo ${user} > ${dirConfig}/USER
|
echo ${user} > ${dirConfig}/ks-upload-user
|
||||||
elif [ "${EDIT}" == "2" ] ; then
|
elif [ "${EDIT}" == "2" ] ; then
|
||||||
echo -n "* Enter the server key: " ; read PASS
|
echo -n "* Enter the server key: " ; read PASS
|
||||||
password=${PASS}
|
raw_password_enter=${PASS}
|
||||||
echo ${password} > ${dirConfig}/PASS
|
encrypt_password_enter=$(encrypt_kstools "${raw_password_enter}")
|
||||||
|
echo ${encrypt_password_enter} > ${dirConfig}/ks-upload-pass
|
||||||
elif [ "${EDIT}" == "3" ] ; then
|
elif [ "${EDIT}" == "3" ] ; then
|
||||||
echo -n "* Enter the server URL: " ; read SERVER
|
echo -n "* Enter the server URL: " ; read SERVER
|
||||||
server=${SERVER}
|
server=${SERVER}
|
||||||
echo ${server} > ${dirConfig}/SERVER
|
echo ${server} > ${dirConfig}/ks-upload-server
|
||||||
elif [ "${EDIT}" == "4" ] ; then
|
elif [ "${EDIT}" == "4" ] ; then
|
||||||
echo -n "* Enter the path on the server: " ; read DIR_SERVER
|
echo -n "* Enter the path on the server: " ; read DIR_SERVER
|
||||||
dirServer=${DIR_SERVER}
|
dirServer=${DIR_SERVER}
|
||||||
echo ${dirServer} > ${dirConfig}/DIR_SERVER
|
echo ${dirServer} > ${dirConfig}/ks-upload-dirserver
|
||||||
elif [ "${EDIT}" == "5" ] ; then
|
elif [ "${EDIT}" == "5" ] ; then
|
||||||
echo -n "* Enter the local path to scan: " ; read DIR
|
echo -n "* Enter the local path to scan: " ; read DIR
|
||||||
dirLocal=${DIR}
|
dirLocal=${DIR}
|
||||||
echo ${dirLocal} > ${dirConfig}/DIR
|
echo ${dirLocal} > ${dirConfig}/ks-upload-dirlocal
|
||||||
elif [ "${EDIT}" == "6" ] ; then
|
elif [ "${EDIT}" == "6" ] ; then
|
||||||
editConfig=1
|
editConfig=1
|
||||||
else
|
else
|
||||||
|
@ -366,11 +448,11 @@ fi
|
||||||
|
|
||||||
# Delete the existing configuration.
|
# Delete the existing configuration.
|
||||||
if [ "$1" == "-r" ] ; then
|
if [ "$1" == "-r" ] ; then
|
||||||
rm -rf ${dirConfig}/USER
|
rm -rf ${dirConfig}/ks-upload-user
|
||||||
rm -rf ${dirConfig}/PASS
|
rm -rf ${dirConfig}/ks-upload-pass
|
||||||
rm -rf ${dirConfig}/SERVER
|
rm -rf ${dirConfig}/ks-upload-server
|
||||||
rm -rf ${dirConfig}/DIR_SERVER
|
rm -rf ${dirConfig}/ks-upload-dirserver
|
||||||
rm -rf ${dirConfig}/DIR
|
rm -rf ${dirConfig}/ks-upload-dirlocal
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -395,44 +477,46 @@ elif [ "$1" == "-i" ] ; then
|
||||||
echo ""
|
echo ""
|
||||||
checkDependencies
|
checkDependencies
|
||||||
# Ask the user and if it exists, read it from the config.
|
# Ask the user and if it exists, read it from the config.
|
||||||
if [ -f ${dirConfig}/USER ] ; then
|
if [ -f ${dirConfig}/ks-upload-user ] ; then
|
||||||
user=$(cat ${dirConfig}/USER)
|
user=$(cat ${dirConfig}/ks-upload-user)
|
||||||
else
|
else
|
||||||
echo -n "* Enter the server user: " ; read USER
|
echo -n "* Enter the server user: " ; read USER
|
||||||
user=${USER}
|
user=${USER}
|
||||||
echo ${user} > ${dirConfig}/USER
|
echo ${user} > ${dirConfig}/ks-upload-user
|
||||||
fi
|
fi
|
||||||
# Ask the password and if it exists, read it from the config.
|
# Ask the password and if it exists, read it from the config.
|
||||||
if [ -f ${dirConfig}/PASS ] ; then
|
if [ -f ${dirConfig}/ks-upload-pass ] ; then
|
||||||
password=$(cat ${dirConfig}/PASS)
|
raw_password=$(cat ${dirConfig}/ks-upload-pass)
|
||||||
|
password=$(decrypt_kstools "${raw_password}")
|
||||||
else
|
else
|
||||||
echo -n "* Enter the server key: " ; read PASS
|
echo -n "* Enter the server key: " ; read PASS
|
||||||
password=${PASS}
|
raw_password_enter=${PASS}
|
||||||
echo ${password} > ${dirConfig}/PASS
|
encrypt_password_enter=$(encrypt_kstools "${raw_password_enter}")
|
||||||
|
echo ${encrypt_password_enter} > ${dirConfig}/ks-upload-pass
|
||||||
fi
|
fi
|
||||||
# Ask the server URL and if it exists, read it from the config.
|
# Ask the server URL and if it exists, read it from the config.
|
||||||
if [ -f ${dirConfig}/SERVER ] ; then
|
if [ -f ${dirConfig}/ks-upload-server ] ; then
|
||||||
server=$(cat ${dirConfig}/SERVER)
|
server=$(cat ${dirConfig}/ks-upload-server)
|
||||||
else
|
else
|
||||||
echo -n "* Enter the server URL: " ; read SERVER
|
echo -n "* Enter the server URL: " ; read SERVER
|
||||||
server=${SERVER}
|
server=${SERVER}
|
||||||
echo ${server} > ${dirConfig}/SERVER
|
echo ${server} > ${dirConfig}/ks-upload-server
|
||||||
fi
|
fi
|
||||||
# Ask the path on the server and if it exists, read it from the config.
|
# Ask the path on the server and if it exists, read it from the config.
|
||||||
if [ -f ${dirConfig}/DIR_SERVER ] ; then
|
if [ -f ${dirConfig}/ks-upload-dirserver ] ; then
|
||||||
dirServer=$(cat ${dirConfig}/DIR_SERVER)
|
dirServer=$(cat ${dirConfig}/ks-upload-dirserver)
|
||||||
else
|
else
|
||||||
echo -n "* Enter the path on the server: " ; read DIR_SERVER
|
echo -n "* Enter the path on the server: " ; read DIR_SERVER
|
||||||
dirServer=${DIR_SERVER}
|
dirServer=${DIR_SERVER}
|
||||||
echo ${dirServer} > ${dirConfig}/DIR_SERVER
|
echo ${dirServer} > ${dirConfig}/ks-upload-dirserver
|
||||||
fi
|
fi
|
||||||
# Ask the local path and if it exists, read it from the config.
|
# Ask the local path and if it exists, read it from the config.
|
||||||
if [ -f ${dirConfig}/DIR ] ; then
|
if [ -f ${dirConfig}/ks-upload-dirlocal ] ; then
|
||||||
dirLocal=$(cat ${dirConfig}/DIR)
|
dirLocal=$(cat ${dirConfig}/ks-upload-dirlocal)
|
||||||
else
|
else
|
||||||
echo -n "* Enter the local path to scan: " ; read DIR
|
echo -n "* Enter the local path to scan: " ; read DIR
|
||||||
dirLocal=${DIR}
|
dirLocal=${DIR}
|
||||||
echo ${dirLocal} > ${dirConfig}/DIR
|
echo ${dirLocal} > ${dirConfig}/ks-upload-dirlocal
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Call the functions to perform the whole process.
|
# Call the functions to perform the whole process.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user