Return Entire Thread First 100 Posts Prev 100 Next 100 Last 50 Posts Report Thread Style: Yotsuba, Pseud0ch, Terminal

Pages: 1-40 41-80 81-120 121-160 161-200 201-240 241-280 281-320 321-360 361-400 401-440 441-480 481-520 521-560 561-600 601-640 641-680 681-720 721-760 761-800 801-840 841-880 881-920 921-960 961-1000 1001-

4chan dump script

1

any ideas on how i could improve this?

#!/bin/bash

# 4chan image dumper -- rimjob.sh -- ENTERPRISE QUALITY BASH SCRIPT
# last update: 16.02.2010 - Version 0.9.7
# direct cool stories, monnies, bug reports, etc. to blargh on #/g/tv - Rizon or blargh.macfag@googlemail.com
#
# improved rape.sh script (v5) => http://pastebin.com/f70ec1e29
#
# creates automagically new threads
# posts old thread URL into new thread and vice versa
# self tuning sleep timer to avoid flood
# uploads biggest files at first to avoid flood protection kicking in too early (default)
# to upload your shit sorted by name add -s as option
# http proxy support

# todo:
# fix those vars
# change flood retry function
# improve proxy function
# handle curl failures properly
# add some curl timeouts
# needs more colors

##### CHECK IF CURL IS AVAILABLE
CURL=`which curl`
if [ -z "$CURL" ]; then
    echo "This script depends on cURL, make sure it's installed and in your path."
    exit 1
fi

##### CHANGE ME
USERAGENT="furryfox"
PWD=ad8fas3fsw
SLEEP=10
PROXY="" # edit like this: "-x proxyURL:port"
##### YOU MAY CHANGE THIS TOO
TMP=`mktemp -t rimjob.curlout.XXXX`
TMP2=`mktemp -t rimjob.lsout.XXXX`
##### OMG WTF ARE YOU DOING??
BIFS=$IFS; SUM=0; CNT=1; DUP=0; UPD=0; DRP=0; TRD=1; NWTRD=0; FLR=0
##### LOL COLORS
BLACK=\\033[30m; RED=\\033[31m; GREEN=\\033[32m; YELLOW=\\033[33m
BLUE=\\033[34m; MAGENTA=\\033[35m; CYAN=\\033[36m; WHITE=\\033[37m
L_BLACK=\\033[1\;30m; L_RED=\\033[1\;31m; L_GREEN=\\033[1\;32m; L_YELLOW=\\033[1\;33m
L_BLUE=\\033[1\;34m; L_MAGENTA=\\033[1\;35m; L_CYAN=\\033[1\;36m; L_WHITE=\\033[1\;37m
B_BLACK=\\033[40m; B_RED=\\033[41m; B_GREEN=\\033[42m; B_YELLOW=\\033[43m
B_BLUE=\\033[44m; B_MAGENTA=\\033[45m; B_CYAN=\\033[46m; B_WHITE=\\033[47m
C_RESET=\\033[m

replies() {
    cat $TMP | awk '/Post successful!/ {print "POST SUCCESSFUL!"} /Error: Duplicate file entry detected./ {print "Duplicate."} /Error: Flood detected./ {print "Flood detected."} /Max limit of/ {print "Max limit reached."} /Abnormal reply/ {print "Abnormal reply."} /Error: No file selected./ {print "No file selected."} /Error: Cannot find record./ {print "Cannot find record."} /Error: No text entered./ {print "No text entered."} /404 - Not Found/ {print "404 - Not found."} /Thread specified does/ {print "Thread does not exist."} /You are banned ;_;/ {print "Banned."} /Error: Field too long./ {print "Field too long."} /Error: File too large./ {print "File too large."} /Detected possible malicious code in image file./ {print "Detected possible malicious code in image file."} /Error: Image resolution is too large./ {print "Image resolution too large."} /Updating index.../ {print "Updating index..."} /Error: Upload failed./ {print "Upload failed."} /Error: Invalid tag specified./ {print "Invalid tag."} /Image file contains embedded archive./ {print "Image contains embedded archive."} /This board doesn/ {print "This board does not exist."} /Please post about something else!/ {print "Post something else!"}'
}

rim_stats() {
    echo -ne "\nThreads: $TRD\nUploaded: $UPD of $SUM\nDupes: $DUP\nDropped: $DRP (flood)\nFailures: $FLR\n"
}

clean_up() {
    rm -f $TMP $TMP2
}

choose() {
echo -ne "Choose a board >
 (a,b,c,d,e,f,g,gif,h,hr,k,m,o,p,r,s,t,u,v,w,wg,i,ic,cm,y,r9k
  3,adv,an,cgl,ck,co,fa,fit,int,jp,lit,mu,n,new,po,sci,sp,tg,toy,trv,tv,x): "
read -e IBOARD

case "$IBOARD" in
    a|b|c|g|k|m|o|p|v|w|cm|an|ck|co|mu|po|tg|tv|x|gif|h|r|s|t|i|ic|d|e|hr|u|wg|y|cgl|n|r9k|3|adv|int|lit|sci|new)
    ISERVER="boards"
    PSERVER="sys"
    POST="post";;
    f|fk|rs)
    echo -e "\n/$IBOARD/ is not supported\n"
    choose;;
    *)
    echo -e "\n/$IBOARD/ doesn't exist yet :|\n"
    choose;;
esac
}

trap "clean_up; rim_stats; exit 1" 1 2 15

clear
choose
#####
BOARD="http://$PSERVER.4chan.org/$IBOARD/$POST"
#####
echo -ne "\nSelect dir(s) to dump, separate multiple dirs with a semicolon
 (eg. /users/derp/pics;/users/hurrr/durr derp):\n"
read ADIR
IFS=";"
for DIR1 in $ADIR; do
    IFS=$BIFS
    cd "$DIR1"
    if [ "$1" = "-s" ]; then
        # sorted by name
        ls -1 | sed "s,^\([^/]\),${DIR1}/\1," >> $TMP2; else
        # sorted by size
        ls -1S | sed "s,^\([^/]\),${DIR1}/\1," >> $TMP2
    fi
done

echo
cat $TMP2

SUM=`cat $TMP2 | grep -c .`
echo -ne "\n${GREEN}${SUM} files selected.${C_RESET}\n"

echo -ne "\nName>
 (leave blank for none): "
read -e NAME
echo -ne "\nEmail>
 (leave blank for none): "
read -e EMAIL
echo -ne "\nInitial subject>
 (leave blank for none): "
read -e ISUB
SUB2=$ISUB
echo -ne "\nInitial comment>
 (leave blank for none): "
read -e ICOM
echo -ne "\nThread ID>
 (eg. 1993711 or blank for new thread): "
read -e URL

##### CHECK IF WE CREATE A NEW THREAD OR NOT
if [ "$URL" = "" ]; then
    NWTRD=1
fi

echo -e "\n\n${L_BLUE}starting dump. pause with${C_RESET}${BLUE} ctrl-s${L_BLUE}, continue with${C_RESET}${BLUE} ctrl-q.${C_RESET}"

while read FILE; do
    if [ -d "$FILE" ]; then
        echo -e "\n${L_RED} * $FILE is a directory.${C_RESET}"
        let "FLR += 1"
        continue
    fi
    if [ ! -f "$FILE" ]; then
        echo -e "\n${L_RED} * $FILE doesn't exist.${C_RESET}"
        let "FLR += 1"
        continue
    fi
   
    BFILE=`basename "$FILE"`
    SIZE=`du -sh "$FILE" | awk '{print $1}'`
   
##### MAIN DUMPER
    echo -e "\n[$TRD/$CNT/$SUM] [ ($SIZE) $BFILE => http://$ISERVER.4chan.org/$IBOARD/res/$URL ]"
    curl -# $PROXY -A $USERAGENT -F "resto=$URL" -F "name=$NAME" -F "email=$EMAIL" -F "sub=$ISUB" -F "com=$ICOM" -F "upfile=@$FILE" -F "pwd=$PWD" -F "mode=regist" -F "submit=submit" $BOARD > $TMP
    ANSW=`replies`
    echo " >> $ANSW"

##### GET THE THREAD URL
    if [ "$URL" = "" ]; then
        URL=`cat $TMP | egrep -o 'thread:0,no:[0-9]+' | egrep -o '[0-9]{4,}'`
    fi

##### FLOOD DETECTION RETRY #1
    if [ "$ANSW" = "Flood detected." ] || [ "$ANSW" = "Updating index..." ] || [ "$ANSW" = "Upload failed." ] || [ "$ANSW" = "" ]; then
        echo -e "${L_RED}[Retry #1/2] [ ($SIZE) $BFILE => http://$ISERVER.4chan.org/$IBOARD/res/$URL ]${C_RESET}"
        sleep 10
        if [ "$ANSW" = "Flood detected." ]; then
            let "SLEEP += 5"
        fi
        curl -# $PROXY -A $USERAGENT -F "resto=$URL" -F "name=$NAME" -F "email=$EMAIL" -F "sub=$ISUB" -F "com=$ICOM" -F "upfile=@$FILE" -F "pwd=$PWD" -F "mode=regist" -F "submit=submit" $BOARD > $TMP
        ANSW=`replies`
        echo " >> $ANSW"
    fi

##### FLOOD DETECTION RETRY #2
    if [ "$ANSW" = "Flood detected." ]; then
        echo -e "${L_RED}[Retry #2/2] [ ($SIZE) $BFILE => http://$ISERVER.4chan.org/$IBOARD/res/$URL ]${C_RESET}"
        echo -e "${L_MAGENTA}SET THE SLEEP TIMER A BIT HIGHER IF YOU STILL GET THE FLOOD DETECTED MESSAGE!${C_RESET}"
        sleep 7
        let "SLEEP += 5"
        curl -# $PROXY -A $USERAGENT -F "resto=$URL" -F "name=$NAME" -F "email=$EMAIL" -F "sub=$ISUB" -F "com=$ICOM" -F "upfile=@$FILE" -F "pwd=$PWD" -F "mode=regist" -F "submit=submit" $BOARD > $TMP
        ANSW=`replies`
        echo " >> $ANSW"
        if [ "$ANSW" = "Flood detected." ]; then
            let "DRP += 1"
            echo " >> Picture dropped!"
        fi
    fi

##### CREATE NEW THREAD WHEN PIC LIMIT IS REACHED, POST A LINK TO THE OLD THREAD IN THE NEW THREAD AND VICE VERSA
    if [ "$ANSW" = "Max limit reached." ]; then
        let "TRD += 1"
        COM2="Thread #$TRD
Continued from: >>$URL"
        echo -e "${L_GREEN}[$TRD/$CNT/$SUM] [ ($SIZE) $BFILE => Creating new thread. ]${C_RESET}"
        curl -# $PROXY -A $USERAGENT -F "name=$NAME" -F "email=$EMAIL" -F "sub=$SUB2" -F "com=$COM2" -F "upfile=@$FILE" -F "pwd=$PWD" -F "mode=regist" -F "submit=submit" $BOARD > $TMP
        ANSW=`replies`
        URL2=$URL
        URL=`cat $TMP | egrep -o 'thread:0,no:[0-9]+' | egrep -o '[0-9]{4,}'`
        echo " >> $ANSW"
        echo -e "${GREEN} >> Posting new thread URL into old thread...${C_RESET}"
        curl -# $PROXY -A $USERAGENT -F "resto=$URL2" -F "name=$NAME" -F "email=$EMAIL" -F "com=Continued here: >>$URL" -F "pwd=$PWD" -F "mode=regist" -F "submit=submit" $BOARD > /dev/null
        ANSW=`replies`
        echo " >> $ANSW"
    fi

##### KEEP POSTING AFTER DUPLICATE
    if [ "$ANSW" = "Duplicate." ]; then
        let "DUP = DUP + 1"
        let "CNT = CNT + 1"
        continue
    fi

##### KEEP POSTING IF A NEGLIGIBLE FAILURE OCCURS
    if [ "$ANSW" = "Image resolution too large." ] || [ "$ANSW" = "Cannot find record." ] || [ "$ANSW" = "Abnormal reply." ] || [ "$ANSW" = "Detected possible malicious code in image file." ] || [ "$ANSW" = "Error: File too large." ] || [ "$ANSW" = "Updating index..." ] || [ "$ANSW" = "Upload failed." ] || [ "$ANSW" = "Image contains embedded archive." ]; then
        let "FLR += 1"
        let "CNT += 1"
        continue
    fi
   
##### QUIT SCRIPT AFTER A SERIOUS FAILURE
    if [ "$ANSW" = "No file selected." ] || [ "$ANSW" = "No text entered." ] || [ "$ANSW" = "404 - Not found." ] || [ "$ANSW" = "Thread does not exist." ] || [ "$ANSW" = "Banned." ] || [ "$ANSW" = "Field too long." ] || [ "$ANSW" = "This board does not exist." ] || [ "$ANSW" = "Post something else!" ]; then
        clean_up
        rim_stats
        exit 1
    fi
   
##### IF CURL FAILS OR 4CHAN REPLY IS NOT SPECIFIED
    if [ "$ANSW" = "" ]; then
        echo -e "${L_RED}Curl failed or 4chan reply is not specified.${C_RESET}"
        cat $TMP >> $HOME/Desktop/rimjob_debug.txt
        let "FLR += 1"
        let "CNT += 1"
        continue
    fi
       
    let "UPD += 1"
    let "CNT += 1"
    ICOM=""
    ISUB=""

##### IGNORE TIMEOUT IF ALL PICS WERE POSTED OR A NEW THREAD WAS CREATED
    if [ "$CNT" -gt "$SUM" ] || [ "$NWTRD" = "1" ]; then
        NWTRD=0
        continue
    fi
   
    echo -e "\n * Waiting $SLEEP seconds..."
    sleep $SLEEP
    continue
done < $TMP2
clean_up; rim_stats; exit 0

2

inb4 someone reposts my todo notes...

3

>>2
inb4
http://boards.4chan.org/b/

4

#!/bin/bash
You're problem is right here, buddy.

5

I tried asking Google for a comparison of Java and Bash, but nothing came up. I'm pretty sure that means Bash is better.

6

>>5
That like comparing Sepples and oranges.

7

>>6
UMENAbbcode

8

so, can someone give link here and pack a working image dumping program ? please

9

more like, ``4chan dumb script''

10

BAMMMMMMP

11

>>8
Why do you think everyone and their mother roll their own image dumper? That's because they don't want to get caught up in a massive bannage because some retards abused their scripts.

So, write your own or get out. Or even better, just get out!

12

>>11
BAWWWW

13

>>12
No really, get out.

14

>>13
BAWWWWWW

15

>>14
I beseech thee, depart from this place.

16

>>15
BAWWWWWWWWWWWWWWWWW

17

>>16
I'd tell you to leave, but it wouldn't help anyway; /prog/ has been nothing but a parade of insufferable bullshit for weeks now.

You deserve this place.  I'm out.

18

>>17
BAWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW

19

>>17
OUT MY ANUS

20

>>19
Stop the bullshit, dude. You're a little bitch behind a keyboard and nothing more. You will never be accepted and you're going to die alone and forgotten and not even your family will miss you.

You're an impotent little coward who's too fucking stupid and deranged to OUT MY ANUS.

21

>>20
FORGET MY ANUS

ACCEPT MY ANUS

22

>>19
>>20
>>21
BAWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW

23

This thread is going to go on forever, and OP is never going to get what he wants from it. Long after OP leaves, this thread will have 400 posts before threadstop.

24

This thread has over 23 posts. You cannot troll anymore.

25

>>24
Damn you almost got me there for a second.

26

>>23
>>24
>>25
BAWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW
I'm not even sure whats happening

27

BAWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW

28

>>26-27
Back to the imageboards, please

29

>>28
Fuck off, ``faggot''.

30

>>29
http://boards.4chan.org/b/

31

>>30
Fuck off, ``faggot''.

32

I feel sorry to break it to you, >>1, but you will never receive what you seek.

In fact, you are a fucking ingrate. You will receive NOTHING from me[1].


______
[1] - Spooky, before or after being thrown in jail, I cannot remember.

33

wtf is this?

34

[tt]this seems like a fairly nice piece of code. i think i'll cut it up and learn/use[/tt]

35

>>31
http://boards.4chan.org/b/

36

>>35
Fuck off, ``faggot''.

37

>>36
http://boards.4chan.org/b/

38

HAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XDHAY GUIZE
NIGGER OVER 900 MEMES.
LULZ XD

39

>>37
Fuck off, ``faggot''.

40

>>38-39
http://boards.4chan.org/b/


Newer Posts

Name: Email:
1027
Entire Thread Last 50 Posts First 100 Posts Thread List Report Thread
This thread is threadstopped. You can't reply anymore.