Monthly Archives: October 2016
Bash based hastebin client for Pineapple Nano

I have been a fan of the haste-server by @seejohnrun for a while, basically its a pastie server, maybe a bit more prettier. I use it to move code around.

Recently I was fortunate enough to receive a Wifi Pineapple Nano from the @hak5 crew.

So I wanted to be able to use my haste-server via the Pineapple  too. Now for regular environments there are multiple cli clients for the haste-server. But most of them require either python or ruby etc etc. Now thats fine if you have a large filesystem but the filesystem on the Pineapple is somewhat limited. So I wrote a pure-bash version of the client to use on the Pineapple.

#config server detailsx
server_ip=<SERVER ADDRESS>
# end of server config
#-------read output per line---
while read OUT
#the above weird formating is to force a new line in the variable holding the data posted to the server.
#--post it to the haste server--
getkey=$(wget -qO- --post-data "$finalOUT" http://$server_ip:$port/documents)
#--parse the returned json to get the key
uri=`echo $getkey | grep -m 1 "key" | sed -E 's/^ *//;s/.*: *"//;s/",?//;s/}//'`
#--echo out the full url
echo "http://$server_ip:$port/$uri"


So , replace the <SERVER ADDRESS> and <SERVER PORT> with whatever server you use and you can now post any command output to the haste-server. Save the file and call it whatever.  And add it to your /etc/profile.

alias pinehaste=’/sd/customs/’

( I saved it to the sd card so I won’t loose it everytime I flashed the Pineapple.)

Using Pinehaste:

So to take a command output just pipe it to the pinehaste (or whatever alias you set it to )

[email protected]:~# cat pwettykitten.txt | pinehaste
which will return:

all you have to to is now to send the url or copy it or do whatever with it.

I’m sure there are better ways to do it but it works, so no need to fix it.




Posted on 2016年10月1日, 10:18 PM By
Categories: stuff