#!/bin/sh # Variables VERSION="v0.2.4" download_util="curl" base_domain="zippyshare.com" # Text Processors err(){ [ -n "${*}" ] && printf "\033[38;5;1m%b\033[0m\n" "${*}" >&2 } die(){ err "${1}" exit 1 } inf(){ printf "\033[38;5;3m%b\033[0m\n" "${1}" } suc(){ printf "\033[38;5;2m%b\033[0m\n" "${1}" } dep_check(){ for deppack; do if ! command -v "${deppack}" >/dev/null ; then err "Program \"${deppack}\" is not installed." is_err="1" fi done [ "${is_err}" = "1" ] && exit 1 } # -- Main Functions -- # get_file_dir(){ if [ -z "${1}" ]; then printf '%s' "Enter File Location to Upload: " read -r file_dir fi } checkif(){ [ -e "${1}" ] || die "${1}: No such file or directory" } is_dir(){ file_name="${1}" if [ -d "${file_name}" ]; then dep_check "zip" file_name="${1##*/}.tmp.zip" zip -r -o "${file_name}" "${1}" >/dev/null 2>&1 fi if [ "$(stat -c '%s' "${file_name}")" -gt 524288000 ]; then [ -d "${file_name}" ] && rm "${file_name}" die "File size is higher than 500mb" fi } get_infos(){ index_jsp="$(curl -sLfk "https://www.${base_domain}/sites/index_old.jsp")" || return 1 id_up="$(printf '%s' "${index_jsp}" | sed -E '/var.*uploadId/!d;s_.*=.\x27([^\x27]*)\x27.*_\1_')" serv_up="$(printf '%s' "${index_jsp}" | sed -E '/var.*server/!d;s_.*=.\x27([^\x27]*)\x27.*_\1_')" if [ -z "${id_up}" ] || [ -z "${serv_up}" ]; then die "An error occured" fi } # Param "${file_name}" "${id_up}" upload_file(){ ret_url="$(curl -ko "-" -F "upload_form=@${1}" -F "uploadId=${2}" "https://${serv_up}.${base_domain}/upload" -# | sed -E '/