Tunnel web traffic with OpenSSH

by jz on 2012-12-18

You can create an encrypted tunnel with OpenSSH that will route all traffic through the remote server.
This is handy if you are using a machine that sits behind a firewall that filters certain sites.

1. Install OpenSSH on the remote server. In Debian/Ubuntu/Mint you can do this with the following command:

sudo apt-get install openssh-server

2. At the client end (your computer) run the following command:

ssh -C -f -N -D 127.0.0.1:88 [user]@[openssh-server]

Where [user] is your username and the [openssh-server] is the IP address or domain of the remote server.
E.g., jz@jz.bz

3. Set your web browser to use the tunnel you have set up by doing the following:
In the Firefox “Preferences” menu choose “Advanced” followed by “Network” and then click on “Settings”. Click on “Manual proxy configuration” and fill in the “SOCKS Host” field with 127.0.0.1 and set the port to 88.
Firefox proxy config

4. Finally in Firefox you will need to type about:config into the address bar and change the value of “network.proxy.socks_remote_dns” to “true”. This is not necessary in Chromium because it will automatically resolve DNS requests through the remote server.

5. Browse the web and all the traffic will appear to be transmitted to the client encrypted, any site you visit will think the SSH server is the client allowing you to potentially bypass geographic restrictions if your server is in the right country.

No Comments

Steam Linux Beta

by jz on 2012-11-29

Just recieved an invitation to Valve’s beta for Steam on Linux. Installed the deb package and it downloaded about 100 MB of files on first run.

Steam Linux

The game library shows several games that have Linux ports but after trying to install and run Braid it seems to not be supported yet as it throws off the following error:

Failed to start game (missing executable).
See the Steam support site for more information

Will try Team Fortress 2 instead which at 12 GB will take quite a bit of time to download. Will update this post with more first imporessions shortly.

Update 1: Steam “Big Picture” looks interesting. It’s basically an interface that will likely drive the “Steam Box” hardware (or reference design) that Valve is rumored to be working on. It looks like it’s meant to be a interface for big screens like a TV as the name seems to imply.

Steam Linux Big Picture

No Comments

Paranoid about Google? (They already know…)

by jz on 2012-11-11

If the all knowing Google didn’t make you paranoid enough then knowing that they know you’re paranoid should really set you off.

Google Paranoid
“You can make a lovely hat out of previously used aluminum foil.”

For the uninitiated; via Wikipedia

A tin foil hat is a piece of headgear made from one or more sheets of aluminium foil or similar material. Alternatively it may be a conventional hat lined with foil. One may wear the hat in the belief that it shields the brain from electromagnetic fields; to prevent mind control and/or mind reading; or to limit the transmission of voices directly into the brain.

The concept of wearing a tin foil hat for protection from such threats has become a popular stereotype and term of derision; the phrase serves as a byword for paranoia and persecutory delusions, and is associated with conspiracy theorists.

No Comments

Unlock Samsung Galaxy Ace GT-S5830D

by jz on 2012-10-31

Step by step guide to installing a custom recovery, flashing a custom ROM and unlocking the Samsung Galaxy Ace GT-S5830D sold by Telus in Canada.

First we will install a custom recovery. Most recoveries that are in the wild fail to work with the GT-S5830D. To rectify this I made a superficial modification to the CWM recovery made by Phiexz to support this device. Available  here: Samsung Galaxy Ace GT-S5830D CWM recovery [mirror] SHA1 MD5.

To install the recovery place the zip file on your SD card and boot into recovery holding down the home button while powering on the device.

Choose “apply update from sdcard” followed by  “choose zip from sdcard” and select the file called recovery-clockwork-5.0.2.6-galaxyace-gt-s5830d.zip

The easiest way to proceed from here is to install a custom ROM based on the stock image to complete the unlock procedure. This is necessary because a ROM that is not based on stock will probably not prompt you for the unlock code and remain locked to the original provider. We will use Adrenaline ROM to accomplish this as it provides us with root  while being based on stock.

Install Adrenaline ROM [mirror] SHA1 MD5 using the same method by which you installed the recovery image.

Once you have Adrenaline successfully installed and booted go to the Application settings menu and enable “Unknown sources” then use the file manager to install the Android Terminal Emulator.

Start the terminal application and run the following commands.

su
cat /dev/block/bml5 > /sdcard/bml5.img

This will create a file called bml5.img on your SD card. Your unlock code can be found within this file with the help of a hex editor.

In your hex editor search for the following string:

FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 30 30 30 30 30 30 30 30

Hex

 

This will take you to the part of the file with the unlock code for your device an 8 digit number, in this case 60830639.

Now place the SIM card you want to use in the phone and power it on. Once it boots it should prompt you with the “Enter Network Lock Control Key” message and you can enter the unlock code you found in the bml5.img file.

From here you can upgrade to any other ROM of your choice and your unlock should be preserved. I recommend CyanogenMod 7 or the Jellaxy project if your would like to try Jellybean (Android 4.1). CM7 is likely to be more stable and responsive though.
 
 
 
All the steps above were done on a phone with the following specs:
Android version 2.3.4
Baseband version: S5830DTLKI4
Kernel version: 2.6.35.7-perf-CL568978 se.infra@SEP-74 #1
Build number: GINGERBREAD.DTLKI4
 

12 Comments

Raspberry Pi info

by jz on 2012-10-25
uname -a
Linux jz 3.2.27+ #244 PREEMPT Sat Oct 20 15:28:38 BST 2012 armv6l GNU/Linux

cat /proc/cpuinfo
Processor	: ARMv6-compatible processor rev 7 (v6l)
BogoMIPS	: 697.95
Features	: swp half thumb fastmult vfp edsp java tls 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xb76
CPU revision	: 7

Hardware	: BCM2708
Revision	: 0002
Serial		: XXXXXXXXXXXXXXX

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
700 MHz

free -m
             total       used       free     shared    buffers     cached
Mem:           232        219         12          0         11        112
-/+ buffers/cache:         96        136
Swap:           99          5         94

cat /sys/class/thermal/thermal_zone0/temp
42.113 °C

uptime
03:38:18 up 1 days,  1:15,  0 users,  load average: 1.08, 1.05, 1.05
No Comments

Make a video clip with avconv

by jz on 2012-10-01

If you would like to extract a clip from a larger video file it is extremely easy to accomplish with avconv. No heavy duty video editing software with a fancy and confusing GUI required.

In the example below a 3 minute clip is created from a video starting at 01:15:00 and ending at 01:18:00.

avconv -ss 01:15:00 -i "long-video.mp4" -t 00:03:00 -codec copy "clip.mp4"
No Comments

Change a video’s container with avconv

by jz on 2012-08-07

The following command will take an flv video and change the container to mp4 while maintaining the audio and video streams in their original state, so no transcoding and no quality loss. The avconv program supports pretty much all common audio and video formats.

avconv -i "filename.flv" -vcodec copy -acodec copy "filename.mp4"
No Comments

Display client IP in PHP

by jz on 2012-05-18

Here’s a code snippet that will let you display your client’s IP address as seen here.

<?php
header("Content-Type: text/plain");
echo $_SERVER["REMOTE_ADDR"];
?>

 
 
Update: If you are using Cloudflare for your site you can still get a client IP by using the code below.

<?php
header("Content-Type: text/plain");
echo $_SERVER["HTTP_CF_CONNECTING_IP"];
?>
No Comments

Batch convert ebooks to epub format

by jz on 2012-03-14

If you have many ebooks you wish to convert into epub format and you want to automate the process using the command line try the following.

for i in *.pdf; do ebook-convert "$i" "$i.epub"; done

You will need to have Calibre installed (available in Debian/Ubuntu/Mint repository).

Formats that are supported for conversion:

Input Formats: CBZ, CBR, CBC, CHM, DJVU, EPUB, FB2, HTML, HTMLZ, LIT, LRF, MOBI, ODT, PDF, PRC, PDB, PML, RB, RTF, SNB, TCR, TXT, TXTZ
Output Formats: AZW3, EPUB, FB2, OEB, LIT, LRF, MOBI, HTMLZ, PDB, PML, RB, PDF, RTF, SNB, TCR, TXT, TXTZ

No Comments

Convert an AT3 file to FLAC

by jz on 2012-03-08

What the heck is an AT3 file? If you ever have the misfortune of coming across one and want to convert it to a more common format you can do the following.

mplayer -ao pcm:file=file.wav file.at3

From there you can use any encoder you like to convert the resulting WAV file to a format like FLAC or MP3.

For FLAC do:

flac file.wav
No Comments