Saturday, September 27, 2014

SSH Port Forwarding Magic: Dynamic Port Forwarding Managment Script

For those whom are "in the know", you can skip reading this section. If not, then I am about to reveal an awesome secret to you. SSH stands for "Secure Shell" and is something that Linux users use everyday. It's pretty freaking badass and it's got lots of tricks up it's sleeve that many are not aware of. Okay, let's backup:

SSH (a secure shell) is a protocol to remotely, and securely access and control a *nix system. For instance, when I am maintaining my web server located in Switzerland, I don't travel to Switzerland to do so, I just access the server via SSH. But, what if I actually am in Switzerland and want to listen to some music on Pandora?

I'm going to get a "restricted" message, and no music, because Pandora (for whatever reason) only allows users with a United States IP address use their services. So, what to do about it? Well, one of my favourite things about SSH is that you can turn it into a quick, secure, and effective proxy server!

ssh -C -D 8080 user@host 

If you have a computer back home in the United States, then you can simply set your browser proxy settings to localhost:8080 and you can now listen to your music!

Okay, this next section is not for newbs. This is a script I wrote this morning to manage ssh port forwarding. It gives you the option of either:

1) Simply connecting to a shell,
2) Get a shell, but with port forwarding enabled,
3) No shell, just port forwarding, and runs as a daemon (in the background). This option also disables command execution for security reasons, because if you only need a proxy and not a shell to begin with, why risk it?

Enough explaining, here is the script:
###########################################
##  SSH Port-Forwarding Manager          ##
##  Author Chevis Young                  ##
###########################################
## Toggle SSH Port Fowarding:on, off, or ##
## as a silent daemon in the background. ##
###########################################

#/bin/bash
##Define Constants (ssh variables)  ##
SUSER=user     ##unix username
SHOST=host.example.com    ##remote host
SPORT=2222     ##ssh port
LPORT=8080     ##local port to forward
IDENTF=~/.ssh/id_rsa_whatever   ##identity file if needed

OPTIONS="Shell Proxy Daemon Quit"
select opt in $OPTIONS; do

if [ "$opt" = "Proxy" ]; then


echo "Shell with port forwarding requested, Set browser proxy settings to localhost:$LPORT socks 5"
ssh -i $IDENTF -p $SPORT -C -D $LPORT $SUSER@$SHOST

elif [ "$opt" = "Shell" ]; then

echo "No Port Forwarding Requested, executing shell..."
ssh -i $IDENTF -p $SPORT  $SUSER@$SHOST

elif [ "$opt" = "Daemon" ]; then
echo "Daemon mode requested, Set browser proxy settings to localhost:$LPORT socks 5"
ssh -i $IDENTF -p $SPORT -f -N -C -D $LPORT  $SUSER@$SHOST

elif [ "$opt" = "Quit" ]; then
echo Goodbye
exit


else
echo

echo -e "
  #################################################
  ## OPTIONS:                                    ##
  ## 1 Shell: Just give me a shell!              ##
  ## 2 Proxy: Shell+Port Forwarding on $LPORT.   ##
  ## 3 Daemon: No shell, just a proxy on $LPORT. ##
  ## 4 Quit!                                     ##
  #################################################"
fi
done

Tuesday, September 9, 2014

Yes Pandora, I'm still f*cking listening!

Do you want to know a secret? Pandora radio is awesome, and it's used by a many people. But, over time Pandora has added annoying disfeatures such as asking if you're still listening, and playing advertisements. Nothing breaks the mood of music like a radio commercial... it just messes up the vibes. Of course, you can pay a fee and avoid all that, or you can do this:

I stumbled across this line of  javascript a while ago, here is the source and authors page. I can't remember the author but I love it. Copy and paste this as a bookmarklet, and save it. Visit pandora.com, wait for it to load and start playing, and click the bookmark.

javascript:var%20imListening%20=%20function(){$('.still_listening.button.btn_bg').click();setTimeout(imListening,1000);return%20true;};%20if%20(imListening())%20alert('Thanks%20for%20listening!');

It will automatically click "Yes, I'm still listening." It's great, you get endless streaming music. However, you need Firefox, because the other half of the equation is Adblock Plus, a Firefox extension.  Addblock Plus blocks all of the advertisements on Pandora. So, you get the benefits of paid Pandora for the price of nothing, which is the way it ought to be. No commercials, endless music. Enjoy.

Tuesday, September 2, 2014

Dogecoin revisited... Such Currency... Wow.

Ah, dogecoin... where to begin? Many transaction, much worthless, such awesome. Doge is currently worth $0.14 per 1,000 coins. At its peak last December, it was worth around $400.00 per 1 coin. It was one of biggest pump and dump schemes ever. Wallstreet was claiming Bitcoin would reach $98,000 per coin within a year, ironically around the same time that they were getting in on it, and the price went up to $1200 per coin. Litecoin reached $45 per coin, and the future looked bright for scrypt miners... And then the FBI's two years worth of hard work paid off (at a cost of millions of dollars, I'm sure) , and Silk Road was shut down for about 3 weeks before SR2 popped up (with new features, improved security, and cheaper drugs), thus rendering the feds efforts useless. Not to mention the plethora of darknet markets to spawn since... should have left DPR where he belonged.

Right, so with SR1's fall, BTC suffered as well. Litecoin is now worth maybe $5 a coin, and the mining difficulty is stupid high, so ordinary people cannot partake. But what about Dogecoin? The difficulty is still low, but then again; the price is lower. I tried CPU mining doge for a few days and in the end earned nothing. I suppose if I purchased one of those scrypt miner ASIC's I could return a profit, but I'm not even sure if the Dogecoin developers take their own thing seriously.

Lately I've figured out that mining coins today is for suckers (or billionaires), but trading various crypto-currencies can be very profitable. I've made ~ $30 in the last three days by purchasing random whatever coins (Maxcoin, Primecoin, Darkcoin, ect) and watching different exchanges for high buy offers. If you explore the smaller coin exchanges, you'll often see buy orders for 2 or 3 times what the coin is currently worth. So, I just keep a small amount of bitcoin in a couple different exchange accounts, buy whatever-coin when it's low, and then sell it when some ignorant fool is looking to spend more for the coins he's trying to buy. Think of it like being the exchange middle-man. I spend 10 minutes looking for a high bid on (for example) the unfortunately named PPC (peercoin), and buy some at whichever exchange it's cheapest at, and then send those coins over to the other exchange, make the sale, and finally convert the prophits back into... Bitcoin!

I'm not going to give away my real money maker sites, but I will tell you that you can buy cheap alt-coins at cryptsy.com and bter.com. I can confirm that these two exchanges are legit and won't steal your money. I leave it up to you to find other exchanges to sell the coins for profits. Happy trading.