Tuesday, December 25, 2012

Wi-Fi Boosting: Hardware Trick

Increase your Wi-Fi router's range towards your computer and filter out unwanted Wi-Fi signal from neighbouring devices with some hardware trick. You already have the materials in your house and it takes less than 5 minutes.

A little theory 


Just the bare minimum to understand how and why it works.

Wi-Fi is an unlicensed radio band in the 2.4 GHz range and it behaves just like any other electromagnetic wave. It is known that electromagnetic waves are piercing through metal object very weakly, or in other words they are reflected or stopped. This is the exact same reason why you shouldn't put any metallic object in your microwave oven either.

Electromagnetic waves propagate in the direction without any obstruction freely, but waves that hit metallic surfaces (say a steel plate) get reflected (a portion pierces through and the remainder gets reflected. The ratio of reflected to continuing waves depends on the type and thickness of metallic layer). The reflected component then is heading the same way as the part which was going unobstructed, thereby creating an amplification effect. This amplification can be used in the case if Wi-Fi signal as well, just like described above.

Consider the following example.

Imagine a 2 dimensional system with point signal source (say a router, broadcasting Wi-Fi signal) and a metallic object (radiator) on its right. Considering only the horizontally propagating waves in the 2-dimensional plane, the following happens.

 The signal is emitted and propagates freely to the left as there is no obstruction.

The other part of the signal propagates to the right and hits the surface of the metal plate. At this point (ignoring any signal getting through, so assume 100% reflection) the signal is reflected from the surface and starts heading backwards, the way it started from (dashed lines) .


The reflected waves are now heading in the same direction as the first part (to the left), but now there are twice as much, going in the one direction, hence the stronger or more signal.

How to make use of this 

 

The reflection of signals is usually an unwanted thing in an apartment where Wi-Fi is used as it generally weakens the signal. This occurs when a router is placed close to a radiator or mirror and the computer is on the other side respectively. However when placing the signal source cleverly,  reflection can be taken advantage of and it can actually boost the radio signal. 2 main tricks that can be done are
  1. Amplifying the signal coming from the router to a specific direction
  2. Blocking signal arriving to a device
The first one is the process described above in the theory whereas a signal is forced in a chosen direction. The latter option might not seem useful for the fist time, but it is actually very handy in situations where there are a lot of different signals. In these cases (say 20 different Wi-Fi routers) each of the 13 channels are used, some even by more than 2-3 devices. If this happens, the receiver device has to differentiate between the incoming signals and decide which one is the one required and filter out the rest. Referring to the used example, if an antenna is receiving a signal from the left, then by placing a metallic object on its right, the unwanted signals coming from the right can be blocked out, hence the receiving device will have to "think" less about which signal is useful and which one should be disregarded.

Make your own amplifier

 

Making something that amplifies or rather said direct your Wi-Fi signal into the necessary direction is way easier than it sounds. All you need is:
  • Cardboard
  • Aluminium foil
  • Scissors, duct tape etc.
Ultimately what you need to do is to cut a piece of cardboard and cover it with aluminium foil. This will act as the metallic layer as described in the previous example and reflect your signal the way you need it to.




Then, based on how you want to direct the signal place it behind your signal source. You can either have it
  • Straight - the signal will be stronger on the one side of the wall while weaker on the other side
  • Bent in a slight "U" shape or parabola - the signal will be directed more or less in a cone shape. This is a more focused option and can extend the range further out in a narrower region.

Results


This does sound cheap and it is, but it certainly does the job. I have applied this behind my receiver antenna and it has blocked out about 9 out of 12 Wi-Fi signals from neighbours and therefore made my own signal reception much more stable and reliable. I am just making another one to place behind the router and direct more signal towards my antenna, which is going to even further improve the quality of my local network.

Please note that even though this is a nice trick you can do fast within the next 5 minutes and get significant results immediately after placing it, it will not be as good as buying directional antennas or anything similar.

My plans are to test a parabola antenna by placing a small router in the middle of it and check how far the range has extended. I have seen Wi-Fi working over vast distances and I am hoping for reproducing similar results.

    Thursday, December 20, 2012

    PirateBox: Design 2.0 Update

    First of all a huge thanks to Maxime who has made some really nice improvements to my design that I am discussing here. It is about the "Design 2.0" and see the list of improvements below.

    The improvements and changes do not require any change to your PirateBox, except for the www folder where the html files are stored, the pbIMG_ws.img file on your drive.

    Improvements

    • User gets automatically redirected to mobile version of the website if accessing from mobile device (presuming no preference is set on the device for viewing the browser versions). 
    • Display the number of connected users, just to keep track on how many users are connected to the PirateBox.
      (Fundamental part of a PirateBox is that it is fully anonymous and this does not change here. No information is collected from the users, the device only tells the total number of connections, nothing else.)
    • There is a very nicely written tutorial for replacing the original PirateBox design with my Design, including instructions how to modify the page for your liking.
    • Also the chat was changed slightly. It is no longer operating as an iframe, but as a core part of the index (home) page. As a result of this it will load faster and it will eliminate compatibility issues with some devices. Also since it is now the part of the main page, there is no need for a chat.html page either.

    Changing to my Design

     

    Download: GitHub

    There is a tutorial written by Maxime on GitHub that you can follow, but it is as simple as downloading the "Design 2.0" folder and copying over its contents to the Pendrive's pbIMG_ws.img/piratebox/www folder, overwriting any similar files already there.
    Attention: Make sure you do a BACKUP of your own www folder and it's contents before overwriting files or doing any changes.

    Screenshots


    So that you do not have to go back to previous post to know what design I am talking about.


    As you can see nothing has changed in the overall design, the pictures just show how the design looks to have a quick idea of what you get here. The change in chat is not remarkable to the naked eye, but it is a nice new feature that it doesn't need to be loaded and embedded from a separate page, but being part of the main page.
    I also cannot show the mobile redirect, but that is one of the nice features I really like. So from now on even people from mobile devices can get a basic view of the site, however if they prefer they can sure view the browser version.

    Future Plans


    After talking to Maxime we have started to work together to give a better finish to the UI, add more functionality and improve general appearance and usability.
    Our plans for the future are to add the following:
    • Admin page with the features
      • Allow editing (rename, delete etc.) of uploaded files
      • Contain a short guide of terminal commands with the most important commands
    • Option for owners to add video, music or possible games to the PirateBox that can be streamed to the users. It is likely that only "stronger" PirateBoxes will have this function as this will need larger amount of computing power from the router. (However as browser try opening files instead of downloading them anyway, this sort of works already.)
    • Multiple languages support for the site so users could choose to view & use the PirateBox in their own, preferred language.
    • Design adjustments to achieve a higher standard and make a more attractive UI in general for the public.
    Videos, music and even flash games can be added easily by anyone right now as well. As HTML5 supports a videos and music, this can also be added relatively easily, see the example below for adding a video:

        <article id="video">
        <h1>Copy Is Not Theft!</h1>
        <h2>A short video illustrating the difference between stealing and       copying.</h2>
        <video id="intro_vid" width="600" height="450" controls >
        <source src="multimedia/Copying.Is.Not.Theft.webm" />
        <source src="multimedia/Copying.Is.Not.Theft.mp4" />
        </video>
        </article>

    The above code would add a new article (section) to the man page where video(s) would be at multimedia/video.webNow you can see 2 video formats listed there, this is needed because in HTML 5 different browsers support different video types.

    Similarly, you could add audio files to your site as well, example:

        <audio controls="controls">
        <source src="multimedia/audio.ogg" type="audio/ogg">
        <source src="multimedia/audio.mp3" type="audio/mpeg">
        Your browser does not support the audio element, soz.
        </audio>

    Where again the 2 file types are because of browser supports.
    Although note that the standard pbIMG_ws.img container is only 20MB in size and all the files for the website must be in here. Now you can of course make a larger img file that could contain all the files and added videos, but this will take up space on the pendrive. Also the more multimedia you add, the more your box will have to work.

    On my custom box I am using a 50MB container with just one short video and audio file for experimental purposes, it looks like this:

    As you can see, I also made myself a "Video" and "Games" tab as well, the picture above shows the video page, but there is a flash game uploaded as well. It is running just fine, but not multiplayer.

    Monday, November 26, 2012

    Bitcoin Basics and Ubuntu 12.04

    This article contains some help for those starting to get into using bitcoin and contains help I have found when reading through different forums and experiences made. It also assumes some basic knowledge about Bitcoin in general, bitcoin client the meaning of mining, mining software, blocks, hashing rate and so on. All this information can be found in the Bitcoin Wiki and only requires some reading and no actual deep programming knowledge.


    Contents of this Article

    • About Bitcoin
    • Installing the Bitcoin Client
    • Mining & Mining Software
    • Where to Mine
    • Downloads & Links
    • Earn Your First Coins (for free)
    • Sources

    About Bitcoin

     

    "Bitcoin uses peer-to-peer technology to operate with no central authority or banks; managing transactions and the issuing of bitcoins is carried out collectively by the network. Bitcoin is open-source; its design is public, nobody owns or controls Bitcoin and everyone can take part."[1]

    Originally Bitcoin was developed by an anonymous person calling himself "Satoshi Nakamoto", his real identity is still unknown. [2]

    The network uses the SHA256 algorithm  that is very fast to compute and hence allowed technology companies to develop specialized hardware for bitcoin mining, the coin generation process. The mining process includes a "puzzle" a machine can solve and based on the outcome of this puzzle a block might be generated. Upon finding a new block, 25 BTC is added to the miner. Blocks are generated on a predictable rate (1 block every 10 minutes) and the reward for finding a block halves on a pre-determined basis. These factors limit the total number of available bitcoins in the system, which will be 21 million coins once the system reaches this point in the future.

    The easy calculation of SHA256 hashes made it available to develop specialized hardware such as FPGAs (Field programmable Gate Array) and ASICs (Application Specific Integrated Circuit) that specialize in bitcoin mining. Such hardware have dramatically shifted the bitcoin mining process and increased the global hash rate of the network. Whether this is good or bad, everyone has to decide for him/herself. one thing is for sure, bitcoin is growing faster than before. Currently 1 coin (BTC) is worth over 500$ and it does not seem to slow down. 

    And here is a short video explaining a few things and introducing Bitcoin.

     

    Installing the Bitcoin Client 

     

    First of all what you should know that there are 2 versions of the official bitcoin client, bitcoin and bitcoin-qt. Bitcoin is the command line client that is for more advanced users while bitcoin-qt is the graphical user interface (GUI) version that is easier to use (aim to use the bitcoin-qt, GUI version).

    Known issue with the client under Ubuntu: The icon does not show in the Unity menu bar (top of the screen where email etc is.). It shows up when first installing, but after that it is gone. As said above, I tried building from source to see if the problem is solved that way, but it isn't. Not a big impact, just a minor issue, but I personally would like to be displayed there, hopefully this will be fixed soon. Update: This issue has been fixed in the Latest Client (as far as I saw).

    1. Amending Software Sources (PPA) - Recommended 

     

    Update: This seems to be the predominantly supported and easiest way of installing bitcoin-qt on an Ubuntu system.

    Edit your software sources by,
    sudo gedit /etc/apt/sources.list
    and add the 2 lines at the end of the file,  
    deb http://ppa.launchpad.net/bitcoin/bitcoin/ubuntu YOUR_UBUNTU_VERSION_HERE main
    deb-src http://ppa.launchpad.net/bitcoin/bitcoin/ubuntu YOUR_UBUNTU_VERSION_HERE main

    Where of course you replace "YOUR_UBUNTU_VERSION_HERE" with the name of your Ubuntu version, e.g. 12.04 is "precise". If this is not perfectly clear for you or you are using another version than 12.04 of Ubuntu then check out this link for help: https://launchpad.net/~bitcoin/+archive/bitcoin. After this simply run in the terminal,
    sudo apt-get update sudo apt-get install bitcoin-qt
    It is now installed on your system in /home/[USER]/.bitcoin You can create a desktop launcher or launch it from unity panel or your favourite place. If you need more help: Bitcoin.org
     

    2. Installing the Bitcoin Client - Alternative 1

     

    Installation by downlaoding the latest bitcoin *.tar.gz file. As per the README file tells:
    1. Download the latest *.tar.gz file from bitcoin.org
    2. Unzip the contents into a folder
    3. Run sudo apt-get install libqtgui4 to install Qt4 runtime libraries (if you had a previous version installed this should already exist on your system)
    4. Run either of the 4 executable installers (according to your system)
     bin/32/bitcoin-qt (GUI, 32-bit)  bin/32/bitcoind (headless, 32-bit)  bin/64/bitcoin-qt (GUI, 64-bit)  bin/64/bitcoind (headless, 64-bit)
    This should install the bitcoin client onto your system.

    3. Building from Source - Alternative 2

     

    To get the bitcoin client clone the official github repository first and then decide whether you need the GUI version (bitcoin-qt) or just the terminal one. Clone the github repository,
    git clone https://github.com/bitcoin/bitcoin ROUTE
    where "ROUTE" is the route to the folder you want to copy to. Leave empty to clone it to your home directory. Also you will need some packages installed, get these by running
    sudo apt-get install qt4-qmake libqt4-dev build-essential libboost-dev libboost-system-dev libboost-filesystem-dev libboost-program-options-dev libboost-thread-dev libssl-dev libdb4.8++-dev
    3.a. Terminal Version

    This is fully in the terminal. After the github repository as been downloaded and the necessary packages applied, simply execute (as per doc/readme-qt.rst)
    qmake 
    make
    Now note that as said this is the terminal version of the bitcoin client, it comes with no graphical interface, all arguments must be given in the terminal. It is highly advised that you do not use this option.
    If qmake gives an error, try
    qmake "USE_UPNP=-" 
    make
    3.b. GUI Version

    You have to get a program called "Qt-creator" from the software centre so go ahead and download it.
    Also you will need the packages as mentioned above so install those if you have not done so already.
    If you have it navigate to the cloned github repository, right-click bitcoin-qt.pro and select "Open with Qt Creator"
    This will open up Qt, here click on run on the bottom left of the screen 
    and this will create an executable file in the bitcoin folder that will run bitcoin-qt. Run as you would any other file.

    Mining & Mining Software 

    You can either mine alone - in "solo" - where the possibility of you finding a block (25 BTC ~ 7000 Euros, but doesn't matter as it is changing all the time) is above 40 years, or you can mine for a group - called "pools" - where you get a share of the 25 BTC based on the help you provided. With solo mining you may not receive anything at all, but you might find a block and get the total 25 BTC, whereas in a pool you will have more steady, but smaller payments. As the difficulty and global hash rate are high, it is highly advised to join and mine a pool.

    Installing poclbm-GUI


    Either way you want to go, you need a software to mine and start hashing. I suggest using poclbm-gui miner which is easy to set up and gives the same functions as the terminal version. The things you will need on your system installed are,  
    python 2.6 or above (3 is not supported)
    wxpython, get them from synaptic package manager.

    nVidia Cards:
    numpy and PyOpenCL, that can again be again installed from synaptic package manager.

    Launch synaptic package manager with: sudo synaptic and make a search for the packages and install.  

    ATI video cards: If you have an ATI card and plan to use it for mining (which will be much faster than CPU or nVidia cards) the you also need an ATI Stream SDK downloaded and installed. You can get the latest version of poclbm GUI miner from github,
    git clone https://github.com/Kiv/poclbm
    and then to run,
    cd /home/[USER]/poclbm
    python guiminer.py
    This will run the guiminer (the front end software) and also poclbm miner, however if you want to use other mining software (e.g. cgminer), it has to be downloaded and installed manually (see links at end of the post and at List of Bitcoin Mining Software). I leave this to you, you have to decide what software you want to use or rather what does your hardware support (!). With all the different ASICS out you will need to check for support. Cgminer is generally a good option to go for and installing it is very simple and it is described in the readme file.

    Look for what you need; clone git repo, cd to git repo, ./configure, make, make install or refer to documentation. After say you have downlaoded cgminer, you can use the GUIminer to control it. This virtually poses no overhead on your hash rate. Make sure you set the correct path to your mining software! Refer to software screenshots below. I recommend you create a "miners" directory within the guiminer and put all miners you use in here. Just to keep things in one place.

    Mining in Solo 


    Firstly go to ~/.bitcoin directory (to see hidden folders press "Ctrl+H" in the file manager, in your home directory) and create a new file called bitcoin.conf if you do not have it already. Put 3 lines in the file,
    rpcuser=local_username rpcpassword=password_you_want_to_use_make_it_long_and_strong
    rpcport=8332 
    Keep these secure. Setting up solo mining requires the bitcoin client to be started up in server mode. To do this, close the client if you have it already running and and start bitcoin-qt with the following command from the terminal,
    bitcoin-qt -server -RPCALLOWIP=192.168.0.* -RPCPORT=8332
    Alternatively
    Add the line:
    server=1
    into ~/.bitcoinbitcoin.conf too.
    ###
    If you are using Windows this is quite similar, open the command line and do,
    cd Program Files (x86)\Bitcoin
    bitcoin-qt.exe -server -RPCALLOWIP=192.168.0.* -RPCPORT=8332
    ###
    Where192.168.0.* is you local IP address range, note that this might be different based on your home network settings. This is to tell the client to allow miner connections from the local network. Start mining software as normal and set up a new solo miner, refer to picture below.

    Ext. Path: Absolute path to your miners installed. Make sure it is pointing to the right executable file.   
    Server: Choose solo  
    Host: localhost
    Port: Just use 8332, make sure it is the same as you have launched the client with & set in your bitcoin.conf  
    Username: As per set in ~/.bitcoin/bitcoin.conf  
    Password: As per set in ~/.bitcoin/bitcoin.conf  
    Extra flags: Flags for the miner, like "-v -w 128', this depends on the miner and graphics card you are using. You can look up a list of best settings for different cards Bitcoin Wiki After setting up to mine in solo, you should see a similar window:
    Ubuntu
    Windows
    If you have launched the client right, got the matching username & password you should be mining in solo.

    Mining for a Pool 


    Pooled mining is the "easier" from the 2. From the dropdown menu simply choose which pool you want to mine for - or choose "other" if it is not listed - type in your account credentials and other information necessary, specified on the pool's homepage and start mining. Please refer to the images and information discussed above in "Mining in Solo". Of course, username and password in this case will be the ones specific to your pool's one and not the one set it  ~/.bitcoin/bitcoin.conf ! If you are looking for a pool to mine for, scroll to the bottom of this post!

    Note: Setting all these up is not difficult at all, once you have figured out how to do it. I hope I could save you some time of looking around the internet and browsing through different forums for finding the right information. If you however require any further help or anything was not clear or just got stuck, leave a comment and I will get back to you and do my best to help.

    Downloads & Links

    • poclbm with GUI - Github (Kiv); GPU miner using OpenCL, Nvida & ATI; Recommended as it contains GUI and mining software alike!
    • Ufasoft CPU/GPU minerdarkgamex.ch; has to be built from source (Windows & Linux)
    • Diablo GPU miner - Github (Diablo);Uses Java ant the OpenCL framework for hashing; ATI & Nvidia cards
    • cgminer - ck.kolivas.org; multi-threaded multi-pool GPU, FPGA and CPU miner
    • phoenix miner - Github;
    • Bitcoin client - Github & Bitcoin.org (Windows & Linux)
    • To learn more about miner software read Bitcoin Wiki 
    • Mining Hardware comparison and best Flags Bitcoin Wiki 
    • Bitcoin Mining Calculator (profit, based on hashing speed, current price & difficulty) 

    Earn Your First Coins (For Free) 


    Dailybitcoins.org - Some micro bitcoins every hour, random prizes and advertising opportunity. Nice option for those new to Bitcoin to make their first coins fast and for people who want to advertise alike.
    Bitvisitor.org - Earn bitcoins for watching videos
    CoinURL.com -  Earn bitcoins for publishing ads on your website, by shortening URLs and you can even advertise with bitcoins.

    Where to Mine


    Update: Please note that "hobby mining" may no longer be profitable with the ever-increasing difficulty and even the cheapest electricity prices. Furthermore cloudmining is often leading to losses and not to profit! At this point I can personally only recommend LTCGear that offers profitable mining power that scales with the difficulty and the below linked GAWminers.

    Free 10 GH/s for New Users at GAWminers


    This takes 3-5 minutes to set up, here is how.
    1. Use  this  link to register and claim your reward.
    2. After registration you will be given a short tutorial about the website. Click through the tutorial. (Important!)
    3. At the end of the tutorial you will be given a Genesis Hashlet (10GH/s)
    4. Select a Bitcoin mining pool for it and drag&drop onto your new hashlet.
    You are done and mining Bitcoin with 10GH/s!

    CEX.io


    Join me mining and trading at CEX.io, here you get the following benefits:
    • Mine in the ghash.io pool with 0% fee
    • Rent Hashing Power (GH/s) (With BTC or NMC)
    • You can buy & sell GH/s from the cloud that will work for you OR you can simply make a profit on buying and selling these shares. No fee.
    • Invite others and get 3% bonus of their GH/s in extra to your account (this does not affect the invited person in a negative manner)
    • Merged mining of Bitcoin, Namecoin, Devcoin and IXcoin. These do not require extra work, but increase your profit.
    • Warning! Maintenance fees are so high that it practically only makes sense to TRADE at CEX.io. Buying hashing power and letting it work will make you lose money on the long term!

    Triplemining


    You can also join me mining at Triplemining where:
    • The pool gets all the shares
    • You have a chance to win the weekly jackpot of around ~0.4 BTC
    • You can make your own "minipool" and earn more by inviting others
    • Lowest payout limit that I have seen among pools (0.01 BTC) 

    Sources


    [1] - http://bitcoin.org
    [2] - https://en.bitcoin.it/wiki
    Original Bitcoin Paper

    Thursday, November 15, 2012

    Privacy Data Leak in Ubuntu 12.10

    In the latest release of Ubuntu, 12.10 there was a privacy leak discovered in the new Dash. When you search for an item, you will see Amazon advertisements of similar products as well from the internet (aka you make an internet search from your desktop and then by clicking on the links they will open in the browser). Now the search request is sent through https, which is secure, but the images from Amazon.com are sent back through insecure http. Thereby your IP, location and hence identity can be revealed.

    EFF.org has a more detailed article on this and the latest show of Hak5 is also talking about the issue, hence I am just raising awareness here as well. If you have upgraded to 12.10 then you might want to solve this issue, what you can do quickly by reading on here or visiting either of the above two sites.

    Disable Data Leaks

    Terminal
    sudo apt-get remove unity-lens-shopping

    From System Settings
    Go to Privacy/Search Results and set "When Searching in the Dash" to "Off"

    Saturday, October 13, 2012

    Email Security

    Email encryption and digital signature are ways to protect your emails from spying eyes and to make sure the recipient knows that you are the original sender of the email. Enigmail is an Add-on for the Mozilla Thunderbird mail client that allows you to send securely emails.
    The term e-mail is a little misleading. When you send a mail trough the post you write something on a paper and put it into a sealed envelope, so the people handling your mail can't actually see what is inside. Now most people think that the e-mail is similar to this, however in reality its more like a postcard...When going trough the servers, basically anyone who knows how to, can read them. This is where Enigmail and OpenGPG appear and add a layer of security.

    Digital signature 

    Digital signature is the equivalent of a signature in the computer world. It helps to uniquely identify -in this case- the sender of the email. So if A and B are talking (assuming both of them have the software of course) and A sends an e-mail to B and signs it with his own signature, then B knows for sure that the e-mail came from A and it wasn't altered, the information can be trusted.
    Digital signature doesn't prevent others from reading your message on its way, but it cannot be altered and the recipient can be sure that the e-mail comes from the right source. You can also sign e-mails and send to a person who doesn't have the software and they will still be able to read it.

    Encryption 

    Encryption is encryption. You encrypt the whole message making others unable to read it except for the person you have sent it to. This is considered as secure messaging and the contents of the email remain hidden from spying eyes.
    The basics for the encryption used here is the use of encryption keys. So if A and B are e-mailing both of them have a key pair on their system, a private key and a public key.
    • Private key - Must be kept secret and protected from everyone. It is used to decrypt messages sent TO you.
    • Public key - You can share this key with friends and basically anyone. It is used BY OTHERS to send encrypted messages TO YOU.
    So for starters A and B have to exchange their public keys, this will identify them and allow to send and receive encrypted e-mails. Here is how it goes briefly:
    A takes the public key of B and uses it to encrypt the message and sends it to B. B then receives this message and decrypts it with his own private key. If this private key is secret, only B is able to read the message. Similarly when B replies he encrypts the message with A's public key and A can decrypt it with his own private key.

    Step 1. Installing Enigmail for Thunderbird

    There are two components to install: Enigmail, the Add-on for Thunderbird and GnuPG encryption software.
    Enigmail can be simply downloaded from the Add-on tab of Thunderbird, it is very straightforward, but it uses GnuPG to work so without that it's useless.

    1. Open Mozilla Thunderbird
    2. Go to Tools/Options/Manage Add-Ons
    3. Search for "Enigmail" and download it

    (If you can't seem to find it there, download from Mozdev and install, or you can upgrade to the latest Thunderbird version which should be able to find it)

    That is Enigmail done.


    Step 2. Installing GnuPG

    First of all GnuPG depends on the following packages: libgpg-error, libgcrypt, libksba and libassuan.

    Now these not installed by default with Ubuntu so if you have not installed them before you will have to do it now. The easiest way to do this is with the synaptic package manager (sudo apt-get install synaptic if you do not have it already). Simply search for each of the above packages and mark them for installation and install them all.

    Go to gnupg.org and download GnuPG 2.0 which will come in a .tar.bz2 file. Extract this file and open up a terminal window, cd to the extracted folder and build GnuPG from source as you would do normally:
    sudo ./configure
    sudo make
    sudo make install
    If you are still missing a package and error message will warn you at the end of ./congfigure similar to this:
    Instructions are straightforward, simply install missing packages and everything will go smoothly. After running make and make install (takes some time) you will get a confirmation of GnuPG installed:

    Step 3. Check configuration

    First of all Thunderbird and Enigmail need to be set up to use GnuPG, usually it is done by default, but do a manual check. Open Thunderbird and check the new OpenPGP menu point and select Properties and you will be presented the following window
    All you have to make sure that the router to gpg is correct (usually it is), however if it is not, specify the correct router in the box below.

    DONE.

    You can either import you key files from another machine or if this is the first time using Enigmail and OpenGPG then you will need to create a new key pair. This is beyond the installation tutorial, but a step-by-step (quickstart) guide is available on enigmail.net

    PirateBox Chat Glitch Fixed

    Thanks to conversall2  for spotting a glitch with the chat feature in my new website design.

    Due to slightly different design than before, the chat window was embedded into the main page and did not refresh by itself.
    This has been fixed by using a simple iframe and chat works normally now.
    Please download the fixed design from GitHub

    Thanks for spotting & feedback and sorry for this issue.

    Sunday, October 7, 2012

    Starting lighttpd: (network.c.358) can't bind to port: 80 Address already in use

    Recently I had the error message appearing when trying to launch my PB on my Ubuntu machine:
    Starting lighttpd: (network.c.358) can't bind to port:  80 Address already in use 

    Turns out there are quite a few old forum threads on this topic where the issue comes down to one of 2 things:

    1. Another webserver application is running (like apache)To solve this issue check what is running on port 80 by:
      sudo fuser -v 80/tcp
      And then kill or remove this application.
    2. IPv6 is causing some issues in the lighttpd.conf file
      Open lighttpd.conf file in any text editor and comment the line
      include_shell "/usr/share/lighttpd/use-ipv6.pl"
      with a #, so:
      #include_shell "/usr/share/lighttpd/use-ipv6.pl"
      Although in case of the PirateBox script package, this comes ready and set.

    My personal issue was that somehow I had apache2 webserver installed on my system. I do not remember installing it, but now it has been removed and lighttpd is starting/running just fine. So if anyone is having a similar issue, you may want to check out these 2 possible issues.

    Thursday, October 4, 2012

    How to create, format and mount .img files

    Now since I am doing some designs for the PirateBox in the future it will be easier if I would make custom image files that could replace the original one. This would make life easier as there would be no need to mount, backup and change the original image file. 

    I am experimenting with some html5 videos in my custom PB design just to see how the server and router handles the "pressure". Also after reading some threads on reddit I am keen to try some browser games on my PB, but these will need a larger container than the default img (20MB). So here is a short note on how to handle these img files.
    (Also sorry for the colours, it is just to illustrate parts of the code.)

    Creating & formatting img files in Ubuntu


    1.   Open terminal and type
    dd if=/dev/zero of=file.img bs=1M count=50
    This will create a file called "file.img" in your home directory with a size of 50 MB.

    What is what?
    if=/dev/zero => input file, but since we want an empty container (no input file), we use the "universal" term for "nothing" /dev/zero
    of=file.img => output file, file name & location
    count=50 => Size of the file in MB

    2.   After this image needs to be formatted in some file format (ext4, fat32, ntfs and so on; ext3 for the PirateBox). Now you can either use gparted if you want  some nice GUI or you can use mkfs command:
    mkfs ext3 -F file.img
    (For a quick and easy way to do this, you can use my script imgKreator from GitHub.)

    Mounting the img file


    I have tried mounting the PirateBox img file with different software, but that didn't work. So after some help through chat and forums here is the command to mount the img file:

    sudo mkdir -p /tmp/mount_tmp/ && sudo mount -o loop,rw,sync piratebox/pbIMG_ws.img /tmp/mount_tmp
    What is what?
    /tmp/mount_tmp/ => Create the folder where the img will be mounted
    piratebox/pbIMG_ws.img => Route to PB image file
    /tmp/mount_tmp => Mount location

    I personally had issues trying to edit anything in the folder so I am running a mounting script with the second line being:
    sudo chmod -R ug+rw /tmp/mount_tmp
    Which just gives read+write permission to the folder.(Although this worked for me before, when creating a new file container use sudo chmod 777 otherwise the PB will not recognize the files and although connection to the network can be made, no website will load). After this editing is simple.

    To unmount:
    sudo unmount piratebox/pbIMG_ws.img

    PirateBox: If interested here is a script that will allow you to quickly mount and unmount pbIM_ws.img file that contains the www folder and the UI/html files.

    Saturday, September 29, 2012

    Another PirateBox UI Design

    I took my time and learned a little more about html5 and CSS3 web design and also after reading some comments on reddit for example, I have made yet another UI design for the PirateBox.

    Features


    • A cleaner structure than before using html5 and CSS3 design elements
    • 4 pages only: Home, Download, Forum and Mobile, where chat is included on the main page
    • Compatible with Firefox, Chrome, Internet Exlorer plus I have an old Blackberry phone, even on that the layout remained the same and it was displayed just like in my browser
    • Mobile version is available from the menu, however as I said, even my old BlackBerry phone could display the standard site properly. (I could not get my script to work, I will keep on working on that)
    • Dark colour theme (as most people wanted)
    • I have implemented the upload feature in the main page, so no more pop-up (drawback: if someone refreshes the page manually, the upload is interrupted...)
    • Download/Browse opens up in a new browser tab, this does not interrupt the upload or trigger the main page to re-load
    • Site scales with your screen, so it won't case any issues with smaller screens
    • I will publish a slightly different version soon of the same design, which is almost identical, but the chat window is on a different page (more tabs on the top), upload comes still as a pop-up and loads in the background, uninterrupted and some more functions. I am even experimenting with some short html5 video clips on the main page.

    Preview


    Now initially I wanted to make some screenshots again, but I though it would be nice to put together a short video instead. I have recorded this on my Windows7 machine, because it has a wider screen and it will show and illustrate the features of the site much better than my Ubuntu machine's samaller screen.

    Download from GitHub

    Again feel free to modify anything on the design, basically any text can be re-written in the html documents (or the logo replaced with your favourite image) as the layout is done by the CSS file. If you don't need the mobile or forum menu elements (if you don't have a forum) simply delete those elements from the nav bar.

    Any feedback is more than welcome and I am happy to take some tips of what kind of design YOU want for a PirateBox.

    IMPORTANT (Edit)
    There was a glitch with the chat as it did not refresh itself. I have fixed this, so please re-download the files from GitHub to apply the changes.
    Please check the update of this post: UPDATE

    Sunday, September 23, 2012

    Updating to PirateBox v0.5.1 on the MR3020

    Updating an existing PirateBox to a newer version on the MR3020 is somewhat different than making a clean install. It is very similar, but one must pay attention to some details that can slow down the process.
    The version 0.5.1 comes with the lighttpd web sever that allows an easy design of an user interface that is presented to users. The web pages ("UI" in this case) can be simply created using html and CSS and easily uploaded to the PirateBox whereas with previous versions there was only a limited area for changes.

    What you will need


    Known I guess from the previous installation process, but just for the sake of completeness:
    • MR3020 with previous PB installation (obviously...)
    • 1 x Ethernet cable
    • 1 x USB flash drive for the MR3020 (external HDD etc also fine)
    • Linux based computer
    • Home router with Internet access
    Moreover you should know:
    • The IP address of your home router
    • The root password of your MR3020 (this was set when you installed PB for the first time, find it)
    Also you will need some knowledge about the "vi" editor, if you have not used it too much before here is a quick guide with the functions you will need:
    • i - Enter edit mode
    • ESC - Exit current mode, e.g. exit edit mode
    • :q! - Quit without saving the changes
    • ZZ - Save changes & quit

    Updating


    OpenWRT is already installed so those first steps can be ignored here, only the PirateBox package needs to be removed and updated with a new one. Note that you will need Internet connection and hence direct access to your home router for this, off-line installation does not work! (The package downloaded later on is a script package that downloads other packages and configures them, hence Internet access is necessary)

    Step 1.


    Set a fixed IP address to you PC in the same subnet as your PirateBox, assuming it has the IP 192.168.1.1 set your PC to 192.168.1.xxx
    You can set a fixed IP by going to "Edit Connections/Wired/Edit", refer to the image below (I renamed my wired connection to "Cable", this is only personal preference).

     Step 2.


    Connect your computer with the ethernet cable to your MR3020 and SSH into your PirateBox on the address 192.168.1.1 (providing you didn't change this after the previous install). In Ubuntu you will need root access to ssh, so

         sudo ssh root@192.168.1.1

    After providing your root password and the root password to your router you should now be presented the OpenWRT screen:

     Step 3.


    Now edit the network file and check that your settings are OK there. You have to make sure that your MR3020 is on the same subnet as your home router. Now at this point it is likely that your home router will be the dominant, hence check your home router. (Example: if your home router is 192.168.0.1 then you will have to set the MR3020 to 192.168.0.xxx and reboot it for the changes to take effect. "Option gateway" is the home router)
    Also an important aspect that if the last 2 DNS entries were removed from the bottom of the file (for most users it has caused redirect errors and hence was often removed) then these need to be put back for the duration of the update. These are necessary to connect to the Internet later on.

         vi /etc/config/network

    And make it look similar:
    Where 192.168.1.1 is the IP address of the MR3020, 192.168.1.254 is the address of the home router and 8.8.8.8 is a google public DNS.

    Step 4.


    I assume that if the first time you managed to connect to the Internet and install a previous version of the PB your firewall settings are OK. Again just to make sure it is fine, refer to the image below

         vi /etc/config/firewall


    Step 5.


    If all these settings are OK disconnect you PC and connect your PB to your home router via ethernet cable. Connect to it through wi-fi and SSH into it just like before.
    Firstly PirateBox needs to be stopped and the old image removed, type

         /etc/init.d/piratebox stop
         opkg remove piratebox

    Step 6.


    Now just to make sure you are connected to the Internet, ping google.com

         ping -c 5 google.com

    If you are getting a response it's OK. if not, then you are not reaching the Internet for some reason, in this case go back a few steps and make sure that your settings are OK. (primarily IP subnet and DNS entries in /etc/config/network)

    Step 7.

    The last step now is to install the new PirateBox image:

         cd /tmp
         wget http://piratebox.aod-rpg.de/piratebox_0.5.1_all.ipk
         opkg install piratebox *

    "wget" will download the new PB package and opkg will install it (yes you need the * at the end of the command). Wait until it finishes, reboot when prompted and you are done.

    Tuesday, September 18, 2012

    Mobile website for PirateBox and more - Plans

    Just a quick update on the PirateBox website design and my further plans.
    Concerning the idea of having a mobile website to which all mobile phones would be redirected, I think it would be viable and a good idea to have a clear, easy to navigate and fast-loading small website for mobile users (I am aware that my current web design is, well let's say not ideal for mobile browsing). My aims are to have a minimalist, but cool mobile website with all the functions of the standard PirateBox start page.
    My first idea was to carry on with the default PB website, but recently I had another much cooler idea for the graphical design.

    My plan is the following:

    • Have a main menu with just 4 icons in the middle (or text?) that will lead to further pages with possibly a faded PirateBox logo behind them
    • OR a PirateBox logo on the screen with a drop-down menu from the top
    • Main menu page will only hold these 4 menu points for fast loading and easy of navigation. Also the aim was to avoid the use of complicated elements like iframes just in case if some mobile phones had difficulties with them.
    • 4 mobile websites besides the mobile start page will be: "About", Chat, Browse & Upload
    • As I do not really want to copy any icons from anyone, I will try to "design" some on my own (see how it goes...). Plan B is that I download some from some free websites or databases.
    • Pages will have return buttons to the main menu.
    • I have to put a script to piratebox.lan that will identify mobile browsers and redirect them to the mobile site (This will be a hard nut to crack...) But I am thinking of an index.html which holds the scripts that will differentiate between a mobile device and a web browser at the very first stage.

    My plans relating to the upload function:

    • Have a graphical indicator of the upload progress.
    • Multiple uploads at a time OR upload sequences that start after each other (aka you can add 5 files, but they are not uploaded simultaneously)
    • Remove popup style and have it integrated in the website.

    Tuesday, September 11, 2012

    Change boot order in GRUB

    If you have dual-boot system, aka. you have 2 (or even more) operating systems, you have to select at startup which one to use. Now if you had windows on your machine before and installed Ubuntu afterwards, Ubuntu will be the default OS to start in the GRUB boot manager. This can be changed of course.

    I have both Windows and Ubuntu on my desktop computer, but I am using Windows more often so I wanted to have that started by default and only start Ubuntu when I need it. Here is how to change which Operating System to boot automatically.

    Change GRUB default boot order

     

    First boot into Ubuntu, open a terminal and type:
    sudo gedit /etc/default/grub

    Look for the GRUB DEFAULT parameter. This is set to 0 by default, which represents the first element in the boot menu list, hence the formula is parameter = (list element) - 1 
    Explained as below:
    GRUB DEFAULT set to 0 = 1st entry in the list will start by default
    GRUB DEFAULT set to 1 = 2nd entry in the list will start by default
    GRUB DEFAULT set to 2 = 3rd entry in the list will start by default
    and so on. 
    On my installation Windows was the 6th in the list so I had to set the value to 5.

    That is it done. Sign out and restart your system to see the result for yourself.

    Monday, July 16, 2012

    PirateBox Design Update

    I am getting frustrated by using Kompozer for editing html/css. It has a "feature" of randomly messing up the link between the html and the css file. Now this causes the site to "fall apart". And no matter how I try to import the file again or add the link, it just wont work. I have to manually edit each line of the css by deleting the "#" in front of the line, linking it to the html file and then adding the "#" tags again. Don't know why does this happen, I figured out this "solution" after some sweating, but its still better than having to rewrite everything.

    Anyway, I think I will leave the css within the html file and work with the internal style sheet until I'm finished. I will export it to a style.css file when I'm absolutely done with editing, so it won't cause no more headache.

    News


    So to make this work quickly and ready to use instead of just showing screenshots I had to simplify the upload form a little. Instead of making a new script and using php for uploading and handling the file, I just included a popup-style upload window that opens in a new page and uploading goes in a separate page without interruption to other processes.

    So all the popup does is that it opens a new page to http://piratebox.lan:8080 (droopy) that allows uploading just like before. Sadly this means that there is no upload bar for the moment.

    The second step will be to use another iframe for this to merge into the main page but there are some other issues to consider here with sizing and aligning etc. So first it will be a popup-like function. I think its acceptable.

    Also forums must be added manually later. I might get a basic design for it, but later only. I first would like to have a working version.

    What is included and what isn't


    See Sneak-peek at PirateBox Design (new)
    The site works at the moment, but as mentioned some functions are just initial and not final versions.

    • Chat, upload, download functions and all pages are loading and working as intended. (if not please report)
    • The design, especially that of the menu will be upgraded with some fancy effects using css.
    • Browser detection will be added in a later stage.
    • Upload progress bar and upload form built-in to the main page will be added later, at the moment it is a popup-style thing.
    • Add your own home.html file (or modify mine) that will be displayed when someone joins.
    • Forum is not included, if you already have your forum, you can add it easily.
    • As soon as my time allows I will write a simple script that downloads my design, unpacks it and copies it over to the www folder.
    • Please note I have not tested this design on my MR3020, just under Ubuntu. Not a fancy design or anything, I just don't know how small routers will be able to handle it.
    Also, sorry for the messy file structure, for some reason I got errors when trying to put in a nice file structure. The page didn't load for some reason and the links were broken. I will look into this and try to fix it for next time.

    Screenshots

     



     

    Download


    After downloading the tar.gz file unpack it and copy the contents into your www folder, but before that backup your own files!

    Download (also available in Download tab)

    Edit:
    Also on Github now! (Latest version, use this!)

    Tuesday, July 10, 2012

    Sneak-peek at PirateBox Design (new)

    I went from my original idea towards another design, I think this looks "cooler", little bit more advanced maybe and easier to see through as well. See printscreen below:

    So far:
    • The layout will remain more or less the same as I am planning at the moment. 
    • Site uses iframe, so when upload is running you can still browse and chat, etc without interrupting the process.
    • There is a progress bar for the upload, only visible when you are actually uploading a file, will be quite handy when/if I make the upload work properly.
    • The chat is working fine. Moved it to separate page, so there is no excess drive/CPU usage when not needed.
    • The shown page above is the "About" page, when connected users get redirected to the Home page. My idea was that everyone can build a short Home page (that will be shown in the frame, so no hassle) and show that first to anyone who joins. A little info, etc.
    • Browse for files is also working as far as I could tell.

    Work needs to be done on:
    • Upload script is not working at the moment. I have been trying to make it work fir the past few days in my free time (don't have much apparently) but there seems to be an issue with the php script handling the upload. Also need to allow php in the lighttpd settings, don't remember if its allowed by default or not.
    • Also trying to add a scrip that would detect mobile browsers from phone for example. These would be redirected to a simpler site. Not because of bandwith usage (no intenet plan used) but because of convenience. Maybe original, simple setup or something similar.
    • If I can make the upload script work, I might consider adding a function of uploading multiple files at a time, still in question.
    • I will test the design with as many computers as possible, iPads if I can get them etc. and see if it works OK.
    This is just a quick update to say I am working on stuff, but because of the lack of time I am not progressing super-fast. Also I have to learn a lot in the meanwhile about css, html, scripting etc, so yes...I'll keep you posted.

    If anyone has any ideas or questions (really...any) feel free to share/ask. Also as soon as I have a working "beta version" of my design I will upload it and post a link here.

    Please check the more recent version: UPDATE

    OneSwarm in Ubuntu

    OneSwarm is a lightweight, anonymous P2P file sharing software. It is available for Windows, Linux and Mac as well, both 32 and 64 bit versions. While traditional P2P sharing programmes share data with anyone who ask for it, in OneSwarm you can limit who you want to share your files with. Friends only, chosen friends or public, its entirely up to you.

    Check out www.oneswarm.org to download and learn more.


    It takes some time to learn using the software if you are new to it, but after that it comes with benefits and easy use.

    Some basic setting when you start


    Firstly you will need a server to connect to and some friend to transfer files. A good way to start is to add the following URL in both cases: https://oneswarm-support.appspot.com/
    You find the link to add the server and friends list on the left hand side of the screen, see below:
    Click Add server and copy in the URL provided above. Do the same with Add friends, choose "Subscribe to a friend feed from a community server" and paste the URL. You should have a number of friends and the longer you stay on the network the more will be discovered, the easier file sharing will be.

    One issue so far, solved easily


    A recent issue I had though was an error message when starting the software saying:
    ***Required thread seems to have died: OS Friend Connector

    Now after looking at the forums I have found a post where it was said that a file could be corrupted and fixing this is easy. Go to your:
    ~/.oneswarm/osf2f
    folder and delete your osf2f.friends file.
    (Open your home folder, press Ctrl+H and look for the .oneswarm folder, navigate from there)
    Use one of the backups available to recover this file, simple rename it and remove the .backup tag. The file is generated and updated with each new friend made on the network  anyway.
    Your OneSwarm should be running now.

    Saturday, July 7, 2012

    USB Adapter Causes Freeze

    Now I did mention in an earlier post the issues with upgrading to Ubuntu 12.04, all the hassle and pain with reinstalling the system. I was really hoping that a fresh install would solve all my problems and I can have a fresh, clean start. Turns out it's not that simple.

    Problem description


    Soon after my reinstall I have discovered yet another issue, namely a system freeze occurring when I plug or unplug my external, USB wifi card. This SL1504N (Realtek 8191S chipset) card was perfectly working in the previous version and it is working on Windows as well. The weird thing is, its not working only in 50% of the time. So basically its a lottery whether or not after a restart I get to use my card. If it doesn't work and I try to unplug it my system crashes, kernel warnings appear and there's nothing to be done the system is dead, this is followed by a rough power-off.
    I don't know if this issue is in connection with another error message that I seem to get occasionally with nautilus, but even after reinstalling nautilus in the synaptic package manager both the freeze and error messages remained there.


    Also, this might be linked to the USB card problem explained above, I am having shutdown hungs as well. The dots start to move, but that's about it, nothing happens.


    I am quite disappointed at this point since instead of enjoying and using the new version of Ubuntu for other more productive tasks, I'm still stuck fixing the many errors of the upgrade.

    I have tried reinstalling nautilus from the Synaptic package manager and fixing broken installs with:

    sudo apt-get install -f
    command, but they didn't work and I still get the system freeze or I'm simply stuck without my network card that I want to use.

    Temporary fix

    Now my wifi card is not detected from time to time. Today (after not using my Ubuntu for a while because of the above mentioned issues) I have discovered that if my system doesn't recognise the USB adapter then I shouldn't try to unplug it and plug it back in, because it will freeze as soon as I remove it. Instead what needs to be done is that the wifi should be switched of  on the hardware (On my HP laptop there is a swipe button to do this, I guess most of the laptops have something like this) and then I can unplug, re-plug, activate the hardware with the button and it will work (or it did today at least).

    Unresolved

    Shutdown hungs remain still an issue. Even after downloading 160 Mb of updates today it was still there and had to force shutdown. This issue will need some deeper investigation.