Fetch assets from vendor portal
I think this vendor uses a generic Salesforce or similar SAAS for their customer support portal, so this might be applicable to more than just this one vendor.
Load your secrets, in this case from ~/.config/helpcenter, and then dot-source the library. Then authenticate, and if it prints a success message, you can then download large assets.
. download-vendor-asset.sh auth_to_vendor4 fetch_vendor4 https://release.example.com/downLoadArtifact?id=8823
It supports any number of assets all on one line.
files/2026/listings/download-vendor-asset.sh (Source)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
#!/bin/sh # File: download-vendor-asset.sh # Location: blog exclusive # Author: bgstack15 # Startdate: 2026-04-22-4 17:07 # Title: Download Vendor4 Assets # Project: Vendor4 deployment # Purpose: authenticate to release.example.com and download indicated assets as desired filename, directly from ec2 node, to avoid the download-to-laptop and upload-to-ec2 loop # History: # Usage: # Reference: # Improve: # Use traps to clean temp files if script is cancelled # Dependencies: # curl . ~/.config/helpcenter _cj=~/.cookies _silent="--silent" _opts="-c ${_cj} -b ${_cj}" _b="----separator47" auth_to_vendor4(){ rm -f "${_cj:-${HOME}/.cookies}" curl ${_silent} -L ${_opts} 'https://release.example.com/login' \ --compressed \ -X POST \ -H "Content-Type: multipart/form-data; boundary=${_b}" \ -H 'Referer: https://release.example.com/Login' \ --data-binary $'--'"${_b}"$'\r\nContent-Disposition: form-data; name="username"\r\n\r\n'"${username}"$'\r\n--'"${_b}"$'\r\nContent-Disposition: form-data; name="password"\r\n\r\n'"${password}"$'\r\n--'"${_b}"$'--\r\n' printf '\n' } fetch_vendor4(){ tmpfile1="$( mktemp )" for word in "${@}" ; do #-OJ saves the file, but we need to record the header used _output="$( curl -v -L -OJ ${_opts} "${word}" 2>&1 )" trimmed="$( echo "${_output}" | awk -F"'" '/filename=/{print $2}' )" dl="$( ls -1 b\'* 2>/dev/null )" if test -n "${dl}" ; then mv -f "${dl}" "${trimmed}" echo "${trimmed}" >> "${tmpfile1}" fi done cat "${tmpfile1}" | xargs md5sum rm -f "${tmpfile1:-NOTHINGTODEL}" } |
Comments