mad/hosts/up_axfc.sh
kittykat e6804e01e1
# 2024.12.26 - [up_kouploader / up_axfc / up_torup] Fixed failedRetryUpload (was using download logging)
#               * Thanks Belky
# 2024.12.26 - [anonfile / up_anonfile] Add anonfile.de as upload / download host
# 2024.12.25 - [dashfile / up_dashfile] Add dashfile.net as upload / download host
# 2024.12.25 - [isupload] Change to use tor_curl_request_extended (server response is often slow)
#               - Accept 200 OK response to continue (do not require filename / filesize)
# 2024.12.25 - [fileblade] Add response handling for free file download dissallowed > 100MB.
#               "The file owner does not allow FREE users to download files which are over 100 MB"
# 2024.12.25 - [mad] Add "UploadHiveRandomizeExt" option to config with default=true
# 2024.12.25 - [uploadhive / up_uploadhive] Update renaming random ext files to their original names
#               - Handle multipart 7z & rar (abc.7z.###, abc.part#.rar)
# 2024.12.25 - [syspro / up_syspro] Add share.syspro.com.br as upload / download host
# 2024.12.24 - [mad] Add EnabledUploadHosts / EnabledDownloadHosts setting to fine-tune which hosts to use
#               ** Options: recommended, online, all (Default=recommended)
#               - recommended: loads all hosts verified working with MAD
#               - online: loads all hosts available online / working (includes captcha / js restricted)
#               - all: loads all hosts in hosts folder
# 2024.12.24 - [up_ateasystems / ateasystems] Add share.ateasystems.com as upload / download host
# 2024.12.23 - [up_uploadbay / uploadbay] Add uploadbay.net as upload / download host
# 2024.12.23 - [up_herbolistique / herbolistique] Add transfert.herbolistique.com as upload / download host
# 2024.12.23 - [uploadhive] Auto-rename random extension downloads
# 2024.12.23 - [up_uploadhive] Change upload file extension to random 3 letters (uhive blocks .7z, .zip, .rar now)
# 2024.12.23 - [up_offshorecat] Fixed upload. Updated apikey.
# 2024.12.23 - [up_fileditch] Fixed upload. Added response handling for Tor Blocked node (retries)
# 2024.12.23 - [up_freesocial / freesocial] Add files.freesocial.co as upload / download host
# 2024.12.23 - [up_cyssoux / cyssoux] Add partage.cyssoux.fr as upload / download host
# 2024.12.22 - [mad] Add jira_Upload function -- used for all jirafeau hosts
# 2024.12.22 - [up_*AllJiraHosts*] Consolidated / moved all hosts upload functions to mad.sh
#               - Minimized jira host code (~6000 lines of duplicates removed)
#               - Jira hosts: acid, anarchaserver, depotkaz, dictvm, eddowding, familleflender, filesquid,
#                 free4e, harrault, linxx, moocloud, nantes, netlib, skrepr, soyjak
# 2024.12.20 - [fileblade / up_fileblade] Add fileblade.com as upload / download host
# 2024.12.20 - [isupload / up_isupload] Add isupload.com as upload / download host
# 2024.12.15 - [mediafire] Add mediafire download link processing
# 2024.12.12 - [dictvm / up_dictvm] Add dictvm.org as upload / download host
# 2024.12.12 - [eddowding / up_eddowding] Add eddowding.com as upload / download host
# 2024.12.12 - [up_pixeldrain] Modify upload to use PUT
# 2024.12.12 - [mad] Update pixeldrain api key
# 2024.12.09 - [ranoz] Fix filenames with spaces
# 2024.11.29 - [innocent] Update to use tor_curl_request_extended for head/get
# 2024.11.29 - [quax] Update 404 Not found response handling
2024-12-27 19:47:09 +00:00

218 lines
9.2 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#! Name: up_axfc.sh
#! Author: kittykat
#! Version: 2024.12.26
#! Desc: Add support for uploading files to a new host
#! Info: Files are accessible at https://www.axfc.net/<hash>
#! MaxSize: 2GB
#! Expire: ?
#! Usage: Copy this file into the ./${WorkDir}/hosts_upload/ folder
#!
#!
#! ------------ REQUIRED SECTION ---------------
#! @[UPDATE] ListUploadHosts: This string is loaded into mad.sh and allows dynamic handling of new url data
#! Format: '/HostCode/HostNick/HostFuncPrefix@'
#! HostCode: <aUniqueCodeForHost> (ie. 'fh' for filehaus -- cannot be used by other hosts)
#! HostNick: What is displayed throughout MAD output
#! HostFuncPrefix: <aUniqueStringThatMustPrefixHostFunctions> ie. 'fh' -- fh_UploadFile()
#! * Note: Must begin with a letter a-z (functions beginning with numbers are no bueno)
HostCode='axfc'
HostNick='axfc.net'
HostFuncPrefix='axfc'
#!
#! !! DO NOT UPDATE OR REMOVE !!
#! This merges the Required HostAndDomainRegexes into mad.sh
ListUploadHosts=${ListUploadHosts}'/'${HostCode}'/'${HostNick}'/'${HostFuncPrefix}'@'
#!
#!
#! Configurables
#! -------------
#!
#! ------------ (1) Host Main Upload Function --------------- #
#!
#! @REQUIRED: Host Main Upload function
#! Must be named specifically as such:
#! <HostFuncPrefix>_UploadFile()
axfc_UploadFile() {
local _hostCode=${1}
local filepath=${2}
local filecnt=${3}
local pline=${4}
local filename="${filepath##*/}"
warnAndRetryUnknownError=false
exitUploadError=false
exitUploadNotAvailable=false
fileAlreadyDone=false
tor_identity="${RANDOM}"
UploadTicket="${WorkDir}/.flocks/upload_${_hostCode}_${filepath//[^a-zA-Z0-9]/}"
MaxUploadSizeInBytes=2147483648
fsize=$(GetFileSize "$filepath" "false")
if ((fsize > MaxUploadSizeInBytes)); then
rm -f "${UploadTicket}"
echo -e "${YELLOW}| SKIP${NC}: The size of $filename is to large for $_hostCode. ($fsize > $MaxUploadSizeInBytes)"
failedUpload "${filepath}" "${_hostCode}" "Skipping upload. The size of $filename is to large for $_hostCode. ($fsize > $MaxUploadSizeInBytes)"
return 1
fi
finalAttempt="false"
for ((z=0; z<=$MaxUploadRetries; z++)); do
if [ $z -eq $MaxUploadRetries ] ; then
finalAttempt="true"
fi
trap "rm -f "${UploadTicket}"; echo ""; tput cnorm; exit" 0 1 2 3 6 15
if axfc_PostFile "${filepath}" "${_hostCode}" "${filename}" "${filecnt}" $((z+1)) $finalAttempt $pline ; then
return 0
elif [ $z -lt $MaxUploadRetries ]; then
if [ "${fileAlreadyDone}" == "true" ] ; then
rm -f "${UploadTicket}"
break
fi
if [[ "${warnAndRetryUnknownError}" == "true" ]] ; then
if [ "${DebugAllEnabled}" == "true" ] ; then
debugHtml "${filepath##*/}" "error" "Retry due to an unknown issue: attempt #$((z+1)) of ${MaxUploadRetries}"
fi
fi
if [[ "${exitUploadError}" == "true" || "${exitUploadNotAvailable}" == "true" ]] ; then
if [ "${DebugAllEnabled}" == "true" ] ; then
debugHtml "${filepath##*/}" "error" "Exit due to unrecoverable issue"
fi
rm -f "${UploadTicket}"
break
fi
echo -e "\n${YELLOW}A recoverable error occurred, retry attempt $((z+1))/${MaxUploadRetries}${NC}"
sleep 3
fi
done
rm -f "${UploadTicket}"
}
#!
#! ----------- (2) Post File / Upload File Function --------------- #
#!
axfc_PostFile() {
local filepath=$1
local _hostCode=$2
local filename=$3
local fileCnt=$4
local retryCnt=$5
local finalAttempt=$6
local pline=${7}
UploadTicket="${WorkDir}/.flocks/upload_${_hostCode}_${filepath//[^a-zA-Z0-9]/}"
echo -e "[${YELLOW}${_hostCode}${NC}] Uploading ${GREEN}${filename}${NC}"
tor_identity="${RANDOM}"
fixed_url='https://www.axfc.net/u/post_m.pl'
maxfetchretries=3
echo -e "${GREEN}# Fetching upload post…${NC}"
for ((i=1; i<=$maxfetchretries; i++)); do
mkdir -p "${WorkDir}/.temp"
axfc_cookie_jar=$(mktemp "${WorkDir}/.temp/axfc_cookies""${instance_no}"".XXXXXX")
printf " ."
tor_identity="${RANDOM}"
trap "rm -f ${UploadTicket}; rm -f ${axfc_cookie_jar}; echo ""; tput cnorm; exit" 0 1 2 3 6 15
response=$(tor_curl_request --insecure -L -s -b "${axfc_cookie_jar}" -c "${axfc_cookie_jar}" "$fixed_url")
if [ "${DebugAllEnabled}" == "true" ] ; then
debugHtml "${filepath##*/}" "axfc_fetch$i" "${response}"
fi
if [[ -z $response ]] ; then
rm -f "${axfc_cookie_jar}";
if [ $i == $maxfetchretries ] ; then
printf "\\n"
echo -e "${RED}| Failed to start an upload [1]${NC}"
warnAndRetryUnknownError=true
if [ "${finalAttempt}" == "true" ] ; then
failedRetryUpload "$pline" "${filepath}" "${_hostCode}" "Failed to start an upload [1]" ""
fi
return 1
else
continue
fi
fi
printf "\\n"
break
done
maxfetchretries=3
echo -e "${GREEN}# Fetching token info and token url…${NC}"
for ((i=1; i<=$maxfetchretries; i++)); do
printf " ."
randelkey=$(( RANDOM % (9999 - 1000 + 1) + 1000 ))
trap "rm -f ${UploadTicket}; rm -f ${axfc_cookie_jar}; echo ""; tput cnorm; exit" 0 1 2 3 6 15
response=$(tor_curl_upload --insecure -L -s -X POST \
-H 'Referer: https://www.axfc.net/u/post_m.pl' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Origin: https://www.axfc.net' \
-H 'Connection: keep-alive' \
-b "${axfc_cookie_jar}" -c "${axfc_cookie_jar}" \
--data-raw "method=upload&ext=ext&filename=1&comment=&address=&delpass=$randelkey&keyword=1234&count=&term=0&term_y=2024&term_mon=10&term_d=1&term_h=15&term_min=0&term_s=0&term_ps=&term_mp=3600" \
-w "\n\nHTTP_CODE: %{http_code}\nEFFECTIVE_URL: %{url_effective}\n" \
"$fixed_url")
if [ "${DebugAllEnabled}" == "true" ] ; then
debugHtml "${filepath##*/}" "axfc_ticket$i" "${response}"
fi
if [[ -z $response ]] ; then
rm -f "${axfc_cookie_jar}";
if [ $i == $maxfetchretries ] ; then
printf "\\n"
echo -e "${RED}| Failed to extract token link [1].${NC}"
warnAndRetryUnknownError=true
if [ "${finalAttempt}" == "true" ] ; then
failedUpload "$pline" "${filepath}" "${_hostCode}" "Failed to extract token link [1]" ""
fi
return 1
else
continue
fi
fi
if grep -Eqi 'ACTION\="https\://' <<< "$response"; then
PostUrlHost=$(grep -oPi -m 1 '(?<=ACTION\=").*?(?=">.*$)' <<< "$response")
break
else
rm -f "${axfc_cookie_jar}";
if [ $i == $maxfetchretries ] ; then
printf "\\n"
echo -e "${RED}| Ticket url not found [1].${NC}"
warnAndRetryUnknownError=true
if [ "${finalAttempt}" == "true" ] ; then
failedRetryUpload "$pline" "${filepath}" "${_hostCode}" "Ticket url not found [1]" ""
fi
return 1
else
continue
fi
fi
done
arrFiles=("$filepath")
printf "\\n"
echo -e "${GREEN}# Posting file…${NC}"
trap "rm -f ${UploadTicket}; rm -f ${axfc_cookie_jar}; echo ""; tput cnorm; exit" 0 1 2 3 6 15
response=$(tor_curl_upload --insecure -L -i -X POST \
-H "Content-Type: multipart/form-data" \
-H 'Connection: keep-alive' \
-F "filedata=@$filepath" \
-b "${axfc_cookie_jar}" -c "${axfc_cookie_jar}" \
"$PostUrlHost")
if [ "${DebugAllEnabled}" == "true" ] ; then
debugHtml "${filepath##*/}" "${_hostCode}_upload" "post_url: ${PostUrlHost}"$'\n'"${response}"
fi
if grep -Eqi 'Axfc Uploader -投稿完了.*キーワード付きURL.*a href="https://www.axfc.net.*(QueryString無しVer)' <<< "${response}" ; then
subSearch=$(awk '/Axfc Uploader -投稿完了/,/(QueryString無しVer)/' <<< "$response")
url=$(grep -oPi -m 1 '(?<=キーワード付きURL\</td\>\</tr\>\<tr\>\<td\>\<a href\=").*?(?=" target="_blank">ファイルIDのみ.*$)' <<< "$subSearch")
filesize=$(GetFileSize "$filepath" "false")
downloadLink="${url%%$'\n'*}"
echo -e "${GREEN}| Upload Success${NC}"
echo -e "| Size: ${BLUE}${filesize}${NC} bytes${NC}"
echo -e "| Link: ${YELLOW}${downloadLink}${NC}"
successUpload "$pline" "${filepath}" "${_hostCode}" "${filesize}" "${downloadLink}" "{$response}"
return 0
else
err=$(grep -oPi '(?<=HTTP/).*?(?=")' <<< "$response")
if [ "${finalAttempt}" == "true" ] ; then
printf "\\n"
echo -e "${RED}| Upload failed. Status: ${err}${NC}"
failedRetryUpload "$pline" "${filepath}" "${_hostCode}" "Failed to upload file" "Status: $err"
exitUploadError=true
return 1
else
return 1
fi
fi
}
#!
#! --------------- Host Extra Functions ------------------- #
#!