THE SCRIPTS ARE BROKEN AT THE MOMENT DUE TO CHANGE IN PASTEBIN.COM WEBSITE. I HAVE CREATED ANOTHER PASTEBIN SCRIPT USING THEIR API. FIND IT HERE: http://babilonline.blogspot.com/2010/10/post-to-pastebin-from-command-line.html
I created the following pair of scripts to paste text files on pastebin.com from console and fetching it may be from a different computer on a different network on console. Comes really handy when you just want to share some texts on two diffrent computers. And the best thing is it lets you paste things that are blocked by pastebin ;).
CHANGE THE VARIABLE "USER" TO CREATE YOUR OWN CLIPBOARD ON PASTEBIN.
=============
pastebin.sh
=============
1 #!/bin/bash
2 #
3
4 USER="YOURNAME_IN_ONE_WORD"
5
6 bold='\e[1;1m';
7 white='\e[1;37m'
8 yellow='\e[1;33m'
9 magenta='\e[1;35m'
10 blue='\e[1;34m'
11 red='\e[1;31m'
12 cyan='\e[1;36m'
13 reset='\e[0m'
14
15
16 if [ -z $1 ]; then
17 echo
18 echo "[*] usage: `basename $0` filename"
19 echo
20 exit
21 fi
22
23 case `file "$1"` in
24 *Bourne*)
25 TYPE="bash";;
26 *python*)
27 TYPE="python";;
28 *perl*)
29 TYPE="perl";;
30 *HTML*)
31 TYPE="html4strict";;
32 *)
33 TYPE="text";;
34 esac
35
36 DATA=`uuencode -m $1 $1`
37 #DATA=`cat "$@" | ./urlencode.sh`
38
39 url=`curl -d format=$TYPE -d code2="$DATA" -d poster=$USER -d expiry=expiry_day -d paste=Send -i -s http://babil.pastebin.com | grep Location | sed 's/Location:[[:blank:]]\+//g;'`
40
41 echo -e "${magenta} ${url} ${reset}"
42
43
============
getbin.sh
============
1 #!/bin/bash
2
3 bold='\e[1;1m';
4 white='\e[1;37m'
5 yellow='\e[1;33m'
6 magenta='\e[1;35m'
7 blue='\e[1;34m'
8 red='\e[1;31m'
9 cyan='\e[1;36m'
10 reset='\e[0m'
11
12 if [ -z $1 ];then
13 n=1
14 else
15 n=`echo $1/1 | bc`
16 fi
17
18 keys=`wget -nv -q -O - http://babil.pastebin.com | grep -E 'ago</li>$' | awk -F '"' '{print $2}'| awk -F '/' '{print $NF}'`
19
20 if [ -z "$keys" ]; then
21 echo
22 echo "[*] no saved post found in pastebin.com"
23 exit
24 fi
25
26 for i in $keys
27 do
28 echo -e "[[${cyan} $i ${reset}]]"
29 wget -nv -q http://babil.pastebin.com/pastebin.php?dl=$i -O - | uudecode -o -
30 n=$((n-1))
31 if [ $n -eq 0 ];then
32 exit
33 fi
34 done
35
36
I created the following pair of scripts to paste text files on pastebin.com from console and fetching it may be from a different computer on a different network on console. Comes really handy when you just want to share some texts on two diffrent computers. And the best thing is it lets you paste things that are blocked by pastebin ;).
CHANGE THE VARIABLE "USER" TO CREATE YOUR OWN CLIPBOARD ON PASTEBIN.
=============
pastebin.sh
=============
1 #!/bin/bash
2 #
3
4 USER="YOURNAME_IN_ONE_WORD"
5
6 bold='\e[1;1m';
7 white='\e[1;37m'
8 yellow='\e[1;33m'
9 magenta='\e[1;35m'
10 blue='\e[1;34m'
11 red='\e[1;31m'
12 cyan='\e[1;36m'
13 reset='\e[0m'
14
15
16 if [ -z $1 ]; then
17 echo
18 echo "[*] usage: `basename $0` filename"
19 echo
20 exit
21 fi
22
23 case `file "$1"` in
24 *Bourne*)
25 TYPE="bash";;
26 *python*)
27 TYPE="python";;
28 *perl*)
29 TYPE="perl";;
30 *HTML*)
31 TYPE="html4strict";;
32 *)
33 TYPE="text";;
34 esac
35
36 DATA=`uuencode -m $1 $1`
37 #DATA=`cat "$@" | ./urlencode.sh`
38
39 url=`curl -d format=$TYPE -d code2="$DATA" -d poster=$USER -d expiry=expiry_day -d paste=Send -i -s http://babil.pastebin.com | grep Location | sed 's/Location:[[:blank:]]\+//g;'`
40
41 echo -e "${magenta} ${url} ${reset}"
42
43
============
getbin.sh
============
1 #!/bin/bash
2
3 bold='\e[1;1m';
4 white='\e[1;37m'
5 yellow='\e[1;33m'
6 magenta='\e[1;35m'
7 blue='\e[1;34m'
8 red='\e[1;31m'
9 cyan='\e[1;36m'
10 reset='\e[0m'
11
12 if [ -z $1 ];then
13 n=1
14 else
15 n=`echo $1/1 | bc`
16 fi
17
18 keys=`wget -nv -q -O - http://babil.pastebin.com | grep -E 'ago</li>$' | awk -F '"' '{print $2}'| awk -F '/' '{print $NF}'`
19
20 if [ -z "$keys" ]; then
21 echo
22 echo "[*] no saved post found in pastebin.com"
23 exit
24 fi
25
26 for i in $keys
27 do
28 echo -e "[[${cyan} $i ${reset}]]"
29 wget -nv -q http://babil.pastebin.com/pastebin.php?dl=$i -O - | uudecode -o -
30 n=$((n-1))
31 if [ $n -eq 0 ];then
32 exit
33 fi
34 done
35
36
0 comments:
Post a Comment