AVS Template Downloader
Skript, welches vom mir erstellt wurde, um komplette Templates auch mit allen sämtlichen zusätzlichen Files von ClipShare und AVS CMS-basierten Webseiten automatisiert zu downloaden.
Skript Sourcecode
Filename: template_downloader.sh
#!/bin/bash #***************************************************************************** # Subject : template_downloader.sh # Description : # Author : Michael Reber <michael.r467@gmail.com> # Created : 2017.07.19 #***************************************************************************** # Creates templateDownload folder if nof exists. if [ -d "/root/templateDownloader" ]; then mkdir /root/templateDownloader fi outputdir="/root/templateDownloader" read -p "Bitte URL angeben:" websiteURL #websiteURL="192.168.126.128" #-----------------------------GET WEBSITE INFORMATION--------------------------------- templateURL=$(curl -s $websiteURL/index.php | grep 'var tpl_url' | cut -d '"' -f2) completeURL="$websiteURL$templateURL" #--------------------------------DOWNLOAD TEMPLATE------------------------------------ cd $outputdir; mkdir $websiteURL; cd $websiteURL templateFiles='album.tpl album_addphotos.tpl album_delete.tpl album_edit.tpl album_slideshow.tpl albums.tpl blog.tpl blog_add.tpl blog_delete.tpl blog_edit.tpl blogs.tpl categories.tpl community.tpl confirm.tpl edit.tpl enter.tpl error.tpl errors.tpl feedback.tpl feeds.tpl footer.tpl game.tpl game_edit.tpl games.tpl header.tpl index.tpl invite.tpl login.tpl lost.tpl mail.tpl mail_compose.tpl mail_menu.tpl mail_read.tpl messages.tpl notice.tpl notices.tpl photo.tpl quick_jumps.tpl requests.tpl search_games.tpl search_photos.tpl search_users.tpl search_videos.tpl signup.tpl upload.tpl upload_game.tpl upload_photo.tpl upload_video.tpl user.tpl user_albums.tpl user_avatar.tpl user_blocks.tpl user_blog.tpl user_delete.tpl user_edit.tpl user_favorite_games.tpl user_favorite_photos.tpl user_favorite_videos.tpl user_friends.tpl user_games.tpl user_info.tpl user_playlist.tpl user_prefs.tpl user_profile_menu.tpl user_subscribers.tpl user_subscriptions.tpl user_videos.tpl user_wall.tpl users.tpl video.tpl video_embed_vplayer.tpl video_vplayer.tpl videos.tpl' for singletplfile in $templateFiles; do wget $completeURL/$singletplfile >/dev/null 2>&1 done; clear #---------------------SEARCH DOWNLOADED FILES, FOR MISSING TPLs----------------------- RED='\033[0;31m'; GREEN='\033[0;32m';NC='\033[0m' for file in $( for tplfile in $outputdir/$websiteURL/*.tpl ; do grep "include file='.*\.tpl'" $tplfile | cut -d "'" -f2 done | sort -u ); do if [ -f $outputdir/$websiteURL/$file ]; then echo -e "${GREEN}Die Datei: $file -- ist vorhanden.${NC}" else echo -e "${RED}ERROR - Die Datei: $file -- fehlt!${NC}" filefolder=$(dirname $file) if [ "$filefolder" == "static" ]; then if [ -d $filefolder ]; then echo "Folder exists!" else mkdir $filefolder; fi cd $filefolder fi wget $completeURL/$file echo "" cd $outputdir; cd $websiteURL echo "" fi done; clear #---------------------SEARCH DOWNLOADED FILES, FOR MISSING JS/CSS/PNG/ICO----------------------- for css_js_file in $( for otherfile in $outputdir/$websiteURL/*.tpl ; do egrep -i '/.*\.(css|js|png|ico)' $otherfile | sed -e 's!"text\/javascript"!!g' -e 's!"stylesheet"!!g' -e 's!"navbar-brand"!!g' -e 's!"text/css"!!g' -e 's!"apple-touch-icon"!!g' -e 's!"Shortcut Icon"!!g' -e 's!"image/ico"!!g' | cut -d '"' -f2 | sed -e 's!{\$relative_tpl}/!!g' done | sort -u ); do if [ -f $outputdir/$websiteURL/$css_js_file ]; then echo -e "${GREEN}Die Datei: $css_js_file -- ist vorhanden${NC}" else echo -e "${RED}ERROR - Die Datei: $css_js_file -- fehlt!${NC}" filefolder=$(dirname $css_js_file) if [ -d $filefolder ]; then echo "Folder exists!" else mkdir $filefolder; fi cd $filefolder wget $completeURL/$css_js_file echo "" cd $outputdir; cd $websiteURL echo "" fi done #---------------------SEARCH DOWNLOADED CSS FILES, FOR MISSING RESSOURECE----------------------- for search_css_file in $( for from_css_files in $outputdir/$websiteURL/css/*.css ; do egrep -i '/.*\.(gif|png|jpg|svg)' $from_css_files | awk -F'[()]' '{print $2}' | sed -e 's!\.\./!!g' | cut -d "'" -f2; done | sort -u ); do if [ -f $outputdir/$websiteURL/$search_css__file ]; then echo -e "${GREEN}Die Datei: $search_css_file -- ist vorhanden${NC}" else echo -e "${RED}ERROR - Die Datei: $search_css_file -- fehlt!${NC}" filefolder=$(dirname $search_css_file) if [ -d $filefolder ]; then echo "Folder exists!" else mkdir $filefolder; fi cd $filefolder wget $completeURL/$search_css_file echo "" cd $outputdir; cd $websiteURL echo "" fi done #------------------------FINISHING STUFF------------------------------- fontawesome='FontAwesome.otf fontawesome-webfont.eot fontawesome-webfont.svg fontawesome-webfont.ttf fontawesome-webfont.woff glyphicons-halflings-regular.eot glyphicons-halflings-regular.svg glyphicons-halflings-regular.ttf glyphicons-halflings-regular.woff' staticTPL='2257.tpl advertise.tpl dmca.tpl faq.tpl privacy.tpl terms.tpl webmasters.tpl' cd fonts for fontfiles in $fontawesome; do wget $completeURL/fonts/$fontfiles >/dev/null 2>&1 done cd $outputdir; cd $websiteURL cd static for staticfiles in $staticTPL; do wget $completeURL/static/$staticfiles >/dev/null 2>&1 done exit