Sunday, June 15, 2014

A basic guide for privacy in Internet (I)

At this point, everybody knows Edward Snowden and his deeds. The biggest leak of classified documents in the United States changed international relationships and became one of the most discussed problems in American politics. If you are curious, you can check a comprehensive timeline from Aljazeera here.



But, what does this have to do with you? Well, it's a little complicated. Remember that the NSA is not the only organization that spies on you. When you think about it, you realize that private data is the most valued commodity in internet. The biggest companies online get the big part of their revenue from selling private data for advertising. So, internet is based upon it. But the problem is that the people usually does not know this. They think of Google as "the good guys", companies that give away their products for free, but there is no such thing in the real world. So, I think it would be useful to have a little guide to keep privacy safe, or at least to provide some options when you don't want everybody to know what you are doing in Internet. The following is a list of tools that will help you to surf online anonymously and/or keeping your data safe.

TOR

Nowadays this is no longer a secret. I remember when I used this and I thought it was a big deal...However. The TOR network is a great way to use Internet anonymously. If you want more details on how to install it and how to use it, you can read this article, or check the official TOR website.
Of course, this TOR thing can get very complicated. You can find a detailed tutorial here. It explains how to "torify" your online experience. From the introduction of that tutorial:

"This document explains how to configure a particular application for use with Tor and thus the Tor network. As Tor constantly evolves, the knowledge and understanding about anonymity online also evolves. Implementations and other aspects of online anonymity become more and more complex. In the past, an end user would just go ahead and "torify" applications like Mozilla Firefox - this is no longer recommend. As we learned more on the subject and implementation of online anonymity, we discovered it was increasingly easy for a user to leak sensitive information to those interested in obtaining it."

Duckduckgo.com

This an anonymous search engine. Just like that. Take into account that Google, Bing, and other search engines store data about everything you look for in Internet. So, next time you want to know a little more about something controversial, consider using an anonymous search engine: https://duckduckgo.com/
If you want to know more about it, check this. I honestly think that the idea is great, and I hope I can contribute to the project in some way in the future.

Anonymous chat service

As you already know, you can't trust a regular messenger client for delicate information. So, there is an anonymous chat service that is built on TOR, without any nick names, with encrypted messaged and file transfers. I'm talking about TorChat. The following is a description I copied from here:



"TorChat is a decentralized anonymous instant messenger that uses Tor hidden services as its underlying network. It provides cryptographically secure text messaging and file transfers. There are versions available for Microsoft Windows and Linux. A beta version is in development for Mac OS X, and a cross-platform version called jTorChat is being developed in Java.

In TorChat every user has a unique alphanumeric ID consisting of 16 characters. This ID will be randomly created by Tor when the client is started the first time, it is basically the .onion address of a hidden service. TorChat comes bundled with a copy of the Tor onion router readily configured so that it can be run as a portable application without any installation, configuration, or account creation.

TorChat is free software licensed under the terms of the GNU General Public License (GPL). The first public version of TorChat was released in November 2007 by Bernd Kreuß and has since then been constantly developed further. It is written in Python and uses the cross-platform widget toolkit wxPython which makes it possible to support a wide range of platforms and operating systems."
You can download TorChat here.

Mail services
Mail services are essential, and I'm sure you'll be in the need of anonymity for this service at some point of your life. There are several free and paid anonymous mail services. However, as with all the tools I'm listing here, you should be careful. Don't send any sensible data, since it's difficult to know who is behind the services, and how they are managed. Anyway, Mailtor was the mail service I liked the most. It's free and simple to use. Remember, you need to be connected to TOR just to check Mailtor's webpage: http://mailtoralnhyol5v.onion/src/login.php



Money

The "default" currency in Torland is Bitcoin. This currency is just like cash: If you go somewhere and pay with that, nobody could track you. It's great to be able to do the same online. I wrote something about it before. You can read it here.
This is it for now. There are a lot of tools for keeping your privacy online, so much that it would be impossible to review them all, but I'll continue posting more about this topic.

Wednesday, June 11, 2014

Using Sahi with Java (with examples)

I've been looking for some information and/or documentation about Sahi with Java, but I found very little. I only found samples in the Sahi language, and only a couple of scripts in Java. So, as I promised in this article, I'll show some basic examples in Java using Sahi.


Requirements:


  • Sahi open source installed (download it here)
  • Eclipse installed (download it here). Eclipse must have the TestNG plugin installed.
  • Firefox installed. Get it here.

Steps:

1. Follow these instructions.
2. Once you have everything set, open the file "TestoolsTest.java".
3. Open Sahi. A command line window and a simple dashboard will be opened.
Remember that you need this open every time you run test cases with Sahi. Otherwise, they won't work.
4. Go back to eclipse and paste the following code in TestoolsTest.java:

5. Save the file.
6. Right click any part of the editor>Run As>1 TestNG Test
7. If everything went well, you should see that Firefox opens and the test case performs its steps.


Notes:


To get the elements from the browser (e.g. link.(20) in the assertion), do this:

1. Open the Sahi dashboard.
2. Click on the browser you want to use.
3. Go to the site you want to test.
4. Press and hold Alt and double click any part of the page. The Sahi controller should be open:
5. With that open, press and hold Control and hover the pointer over the element you want to inspect. You'll see that the accessor appears in Sahi Controller:
6. You can choose from a set of alternatives in the "Alternatives" dropdown. Then just copy and paste the accessor to your code.

And that's it. Sahi is a great tool with some awesome features. Give it a try!

Monday, June 9, 2014

How to configure Sahi to be used with Java

Sahi is a great tool for automation. It has good, creative features and it's very easy to use. However, the Sahi language is not good enough for all the situations, but you can use Sahi directly with Java. Here I'll show you all the configurations needed to use Java, but I won't post code yet, because the article would be very long with all the explanations (for example, there are many things to say about the Sahi recorder). The next article will be focused on the code. Let's begin.

Requirements:
  • Eclipse installed (download it here). Eclipse must have the TestNG plugin installed.
  • Sahi Open Source installed (download it here)
  • These examples were made in Windows 7
Set up Sahi

1. First, you need to configure the recorder tool to use Java inhstead of the Sahi language. To do that, go to <Sahi_installation_path>\config. There, open the sahi.properties file and modify this line:

controller.mode=sahi

to:

controller.mode=java



2. There is a problem known issue in Sahi that causes some sites to make AJAX requests forever. To solve that, go to <Sahi_installation_path>\userdata\config. Open the userdata.properties file and add the following line:

xhr.wait_ready_states=2,3

3. Create a folder to hold your project. Let's say it's at: C:\Projects\Testools. There, create a folder named "userdata". Inside it, create another folder named "config". Then copy the userdata.properties file that you modified in the last step. It should look like this:

Set up project

1. Open Eclipse.
2. Go to File>New>Java Project
3. Uncheck "Use default location"
4. Select a location for you project (e.g. C:\Projects\Testools). The name of the project will be changed automatically to "Testools" (just an example).
5. Click Finish. Now that we have a new project added to Eclipse, we are going to test
6. Right click on src>New>Package
7. In Name enter "tests" and click Finish.
8. Right click on tests>New>File
9. In File Name enter "TestoolsTest.java" (don't forget the extension .java) and click Finish.
10. It's time to import the required libraries. Go to C:\Projects\Testools and create a folder named "lib". Now go to <Sahi_installation_path>\lib and copy the sahi.jar file to C:\Projects\Testools\lib.
11. Go to Eclipse. Select the "Testools" project and press F5. This will refresh the folder of the project. You'll see that the "lib" folder was added.
12. Expand lib. Right click sahi.jar>Build Path>Add to Build Path
13. Import the TestNG library. Right click Testools (the project)>Build Path>Add Libraries. Select TestNG and press Next and Finish.
That's it. now you can automate test cases with Sahi using Java instead of the Sahi language. In the next post I'll show you some examples of code. Have fun!

Monday, June 2, 2014

How to install Tortoise HQ in Lubuntu (Solution for dependencies problems)


I'm using Linux more and more as the time passes by, and it's great, but you have to admit that some things are a lot easier with Windows. For example, installing some applications. I already had a solved problem with VMware Workstation in elementary OS. Now I'll show you how to install Tortoise HG in Lubuntu.

I chose Lubuntu because it's the lightest Linux distribution, ideal for testing. Also, Lubuntu comes without many things, so this is the place to show an installation from scratch for Tortoise HG.

In my opinion, Mercurial is a great tool, and I like it more than Git. So, here's how to use the graphical interface of Tortoise and Mercurial in your Lubuntu.

First of all, if you went to the official Tortoise HG webpage and tried to install the application in a "regular" way, you may have noticed that there are problems with some dependencies. This is the way to reproduce that problem:

sudo add-apt-repository ppa:tortoisehg-ppa/releases
sudo apt-get update
sudo apt-get install tortoisehg

After doing that, you'll see this error message:

The following packages have unmet dependencies:
 tortoisehg : Depends: mercurial (< 2.9~) but 3.0-1ppa1~precise1 is to be installed
              Recommends: libjs-jquery but it is not going to be installed
              Recommends: libjs-underscore but it is not going to be installed
              Recommends: python-iniparse but it is not going to be installed
              Recommends: python-pygments but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Don't try to install the dependencies manually, you'll get errors anyway.

To avoid this problem, use the following commands:

sudo apt-get install aptitude
sudo add-apt-repository ppa:tortoisehg-ppa/releases
sudo apt-get update
sudo aptitude install tortoisehg

Now, enter "n". With this, you reject the first solution:

A second solution will be offered. Now enter "Y" to accept that solution:
Accept all the following options. After the process is concluded, go to Start>Programming>TortoiseHG Workbench.
If you see that, congratulations! You have installed TortoiseHG successfully. I hope this is useful!

Thursday, May 29, 2014

Do you want to learn Python? Check this

I could say this is a classic. I know that a lot of people already know this, but I think that beginners will find it very, very useful.

When learning any programming language it's vital to have good code as example for our own creations. Also, Python is a great way to learn programming, I think better than Java, without messing your brain up with anti-patterns in your code.

Having that in mind, one of the best challenges for beginners is to create a program that solves a Sudoku game. For those who don't know the game, you can read about it here.  It's basically a mathematical game that consists on sorting numbers. I'm sure you've seen some Sudokus in the news papers. Now, for programming, the different solutions for this problem lead to some interesting mental exercises, and it looks like Peter Norvig thought the same.
Norvig is a computer scientist now working for Google. he has a lot of articles, presentations, speeches, etc., available online. You should check his webpage, it has some interesting material.

However, what really got my attention was this article. It's a comprehensive manual on how to beat any Sudoku puzzle with a simple application in Python. What is interesting about this article is that he explains how he did it with full details. It begins with the algorithm, and goes on to finish with the complete code. 

My advise:

a) Read the whole article very carefully.
b) Download the code and modify it. For example, you could add a graphical interface with Jython.

Of course, you should have some basic programming skills, but I'm sure that you'll learn a lot from this great article.
Related Posts Plugin for WordPress, Blogger...