Skip to content

Instantly share code, notes, and snippets.

@c1b3rh4ck
Last active December 20, 2015 12:09
Show Gist options
  • Save c1b3rh4ck/6128892 to your computer and use it in GitHub Desktop.
Save c1b3rh4ck/6128892 to your computer and use it in GitHub Desktop.
This script was created not for ilegal porpouses or something like that I was bored and a friend of mine just ask me how to download files from issuu.com and that's it.Please don't abuse and use just when you need it,you can download,and convert to pdf or jpg files.
#!/bin/bash
# Copyright (c) c1b3rh4ck's
#This is a PoC for Download images using curl from issuu's site
#
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#Contributtion :
#Thank you Pepee for the help and hints with the final regexp.
#atributes
#00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
#colors :
#30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
r='\e[1;31m'
endc='\E[0m'
w='\e[1;37m'
gr='\e[0;32m'
b='\e[0;34m'
y='\E[33m'
echo -e "${r}
DDDDD iii
DD DD sss sss uu uu uu uu
DD DD iii s s uu uu uu uu
DD DD iii sss sss uu uu uu uu
DDDDDD iii s s uuuu u uuuu u
sss sss \n
${y}PoC for curl usage By ${w}@c1b3rh4ck
feedback:[email protected] ${endc}
----------------------------------------------------------------"
echo -e "
Description: This script was created not for ilegal porpouses or something
like that i's bored and a friend of mine just ask me how to download files from
issuu.com and that's it.Please don't abuse and use just when you need it,
\nDon0t forget to give the proper permissions : chmod +x filename.sh
"
#------------------------------------------------------
#Functions
#Checking for package:
function check(){
for p
do
dpkg -s "$P" > /dev/null 2>&1 && {echo "$P is installed."}|| {echo "$P is not installed."}
done
}
#Check Connection
function internet () {
ping -c 1 google.com > /dev/null
if [[ "$?" != 0 ]]
then
echo -e " Internet Connection: ${r}FAILED${endc}\n ${y}This Script Needs An Active Internet Connection${endc}"
echo -e " ${r}Exiting...${enda}\n"
sleep 2
exit
else
echo -e " Internet Connection: ${gr}OK${endc}"
sleep 1
fi
}
greping() {
#Url is greped from stdout after that we search for id the first search in the html file,the second print
#//image.issuu.com/130728235046-10dfdf188010cb50467cd4b57e0951da/jpg/page_1_thumb_large.jpg and the last is for the id
echo -n -e "${r}Insert the name of the book:\t"
read name
echo -e "${r}[+]Insert the url :\t"
read url
idgrep=$(curl $url |grep '<meta property="og:image'|awk '{match($0,"image.issuu.com/(.[^/]*)",a)}END{print a[1]}')
echo -n -e "[+]Insert the number of pages:"
read numpages
echo -n -e "[+]Do you want to create a new directory for the book ?{Y/N}"
read choice
if [[ $choice == "Y" || $choice == "y" ]]
then
mkdir -p "${name}" && cd ${name}
fi
echo -e "${r}[+]Downloading Files in JPG format${endc}"
curl http://image.issuu.com/${idgrep}/jpg/page_[1-${numpages}].jpg -o "#1.jpg"
cd ${name}
echo -e "${y}[+]Do you want a pdf output ?{Y/N}${endc}"
read pdf
if [[ $pdf == "Y" || $pdf == "y" ]]
then
convert *.jpg output.pdf
sleep 1
fi
echo -e "${r}[+]Done\nExiting....${endc}"
}
withouturl() {
echo -n -e "${r}Insert the name of the book:\t"
read name
echo -n -e "${y}Insert the issuu ID to download the book:\t"
read idbook
echo -n -e "Insert the number of pages:\t"
read numpages
echo -n -e "Do you want to create a new directory for the book ?{Y/N}${endc}"
read choice
if [[ $choice == "Y" || $choice == "y" ]]
then
mkdir -p "${name}" && cd ${name}
fi
echo -e "${r}[+]Downloading Files in JPG format${endc}"
curl http://image.issuu.com/${idbook}/jpg/page_[1-${numpages}].jpg -o "#1.jpg"
cd ${name}
echo -e "${y}[+]Do you want a pdf output ?{Y/N}${endc}"
read pdf
if [[ $pdf == "Y" || $pdf == "y" ]]
then
convert *.jpg output.pdf
sleep 1
fi
echo -e "${r}[+]Done\nExiting....${endc}"
exit
#
#url like this http://issuu.com/zuzupopo/docs/2010_defcon
#script :
#function setName()
#{
#document.forms[0].flname.value = 'http://image.issuu.com/' +
#document.forms[0].fname.value + '/jpg/page_' + document.forms[0].lname.#value + '.jpg';
# }
}
internet
#check
echo -n -e "${r}Do you have the url or link?{Y/N}"
read choice2
if [[ $choice2 == "Y" || $choice2 == "y" ]]
then
greping
sleep 1
else
withouturl
sleep 1
echo -e "${r}[+]Done.Exiting...${endc}"
exit
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment