Wednesday, March 11, 2015

Quick tip: How to handle modal dialogs in Selenium

This is one of those cases that could make you waste time. From time to time, you'll find a page that opens a System modal dialog when you click something or activate certain action. Since this dialog is not part of the browser, you won't be able to access it with the Webdriver.



When I first had this problem, I tried some different solutions (all wrong):

1. Use Sikuli to handle the modal dialog. When I did this, selenium crashed with the same error I had before:

org.openqa.selenium.UnhandledAlertException: Modal dialog present

2. Catch the error with a Try/Catch clause. For some reason, I couldn't catch the error, neither using the specific 'UnhandledAlertException' nor using a generic Exception.

So, the correct way to access these modal dialogs is the following:

Alert alert = driver.switchto().alert();
alert.accept()

This simple piece of code will help you with the annoying modal dialog for some pages.

Thursday, March 5, 2015

Installing OpenSSL in Ubuntu

OpenSSL is a open source SSL/TSL implementation. It allows us to manipulate those well known security protocols. It can be very useful for testing security related issues and some other things. For example, you can use it along with WireShark to test different ways do desencrypt secured traffic. But I'll write about it in another post. Now, I'm in a Linux mood, so I'll use Ubuntu for this article.

You basically need to install OpenSSL and the shared libraries. To install OpenSSL with apt-get, abre una Terminal e ingresa este comando:

sudo apt-get install openssl

Now enter this to verify if you installed OpenSSL properly:

openssl

You should see something like this:
OpenSSL
To install the OpenSSL shared libraries, follow these steps:

1. Run this command:

sudo apt-cache search libssl | grep SSL

You'll get a short list of libraries. What we are looking for is the SSL shared libraries:
SSL shared libraries
2. Now that you have the name of the libraries, install them with apt-get

sudo apt-get install libssl0.9.8

If you get a different version, install that.

Ok, we have OpenSSL installed in our machine. I'll publish more about OpenSSL soon, but for anything that you might want to do, you need to have this installed first. I hope this is useful!

Monday, March 2, 2015

Graphical package management for Linux

Everybody who uses Linux (or at least some Linux distributions) knows the classic apt-get. In fact, I think it's one the tools that makes Linux simple and fun (although there's something similar for Windows). However, I always thought that the greatest problem for Linux to become more popular among regular users is the lack of graphical interfaces. It doesn't matter how simple using commands is, looking at a graphical interface will make the user feel safer, at home.

So, here's a graphical package management for apt: Synaptic. It's not the fanciest tool available for Linux, but I'm always enthusiastic about graphical interfaces for this OS, just because I'd like more people to try it. But let's take a closer look (just in case, I'll be using Ubuntu for this review).

To install Synaptic just use the following command in a Terminal:

sudo apt-get install synaptic

After the installation finishes, click the Ubuntu symbol at the left side of the screen:

Ubuntu symbol
Then, type 'synaptic'. Just click the first application to open it.
Synaptic app
The first time you open the application, a prompt will tell you to refresh the packages frequently. Close it and you'll see Synaptic dashboard. It's pretty simple and easy to understand.
Synaptic dashboard
But let's install something. In the left menu, select Databases, then in the right list select postgresql.
Installing postgresql
Click the check-box for postgresql and click 'Mark for installation'.
A dialog will be displayed telling you that other packages will be affected. Click 'Mark'.
Other packages affected
Click 'Apply'.
Apply
In the 'Summary' dialog, click 'Apply'. Now you'll see the download progress.
Once the files are downloaded, you'll see a final dialog. Just click 'Close'. And that's it! A super easy way to install software in Linux, with a graphical interface. The steps for uninstalling software are almost the same. I really like this kind of tools. It will help a lot of people to try Linux.

Wednesday, February 25, 2015

How to get rid of spyware toolbars and other crapware in Google Chrome

It's very easy to infect our browser with all kinds of malware. I'm sure that, at some point, everyone has experienced the problems with the useless toolbars in the browsers. Remember Delta toolbar, or Conduit toolbar? They're often included within a free application, and you can even voluntarily download and install them!!! (don't try it).

Fortunately, Google has released a Beta version of their 'Software removal tool'. What this tool do is basically 'reset' your Google Chrome browser, and it leaves it clean of malware. Of course, this is just a Beta version of the tool, but I think it's a great idea that could be implemented for Firefox too. However, now I'll show how to use this tool to remove some malware from my own Chrome browser. I infected it with the Conduit toolbar:

Conduit infected Chrome


Now, I'll use the Google Software removal tool. You can download it here. Just download it and place it somewhere you know.

Software removal tool desktop
Now, just run it. It will scan the computer looking for malware. Once it finishes, it will show the results. In my case:
Software removal tool results

Click 'Remove suspicious program'. After a few seconds, you'll see this:
Click Restart and the computer will reboot and that's it. Simple, right? Of course, you cannot rely on this tool to fully protect your computer, but it's a simple and easy-to-use tool to get rid of problems in a simple way. The interesting thing is that the tool also helped with other browsers, like Internet Explorer 11. Give it a try, it won't disappoint you!

Monday, February 23, 2015

Freenet: another option to browse anonymously (how to for Linux)

Privacy is one of the most controversial issues regarding Internet today. Thus, the popularity of tools like TOR and i2p is increasing all the time. Another tool available now is Freenet, and it could be a good option if, for whatever reason, you need to protect your privacy. It's important to mention that this tool has been widely used in China and the Middle East, and it acquired more importance and academical relevance with the paper "Freenet: A Distributed Anonymous Information Storage and Retrieval System".

With that in mind, I'll show you now how to use Freenet in Linux (Ubuntu).

Requirements:

  • Java installed.
  • I first tried with the Java Web Installer, but I had some errors. So, the steps for installing Freenet will be done with commands.

Steps:

1. Open a Terminal
2. Enter the following commands:

wget 'https://freenetproject.org/jnlp/freenet_installer.jar' -O new_installer_offline.jar
 java -jar new_installer_offline.jar

3. A java prompt will be displayed. Just click 'Run'
4. Select your language and click 'OK'
Language Selection
5. A welcome screen will be displayed. Just press 'Next'
Welcome screen
6. Select the folder where you'll install Freenet and click Next twice.
Freenet installation
7. Once you reach the following screen, click Next three times:
Freenet installation finished
8. Finally, click Done. A browser will be automatically opened with the Freenet configuration wizard.
Freenet set up
Note: The configuration I'll choose will allow you to connect to any Freenet user. If you are concerned about security, you should choose another configuration.

9. Click 'Choose low security'
10. Click Next
11. In the 'Datastore size' screen, select the Datastore size. It is recommended to set as much space as possible, but I'll just leave the default value. Then click Next
Datastore size
12. In 'Bandwidth Limits' click Yes if you connection has a monthly data limit. Otherwise, click No.
13. Select speed of your connection and click Next.
Connection speed
If there are any other configurations, set them and click Next until the wizard finishes. OK, we have Freenet installed, but how do we 'browse' on Freenet? Simple, you need to obtain Freenet 'keys'. These are like URLs. You load one and you can see its content. For example, we have the following key, corresponding to the 'Bluish Coder' blog:

USK@1ORdIvjL2H1bZblJcP8hu2LjjKtVB-rVzp8mLty~5N4,8hL85otZBbq0geDsSKkBK4sKESL2SrNVecFZz9NxGVQ,AQACAAE/bluishcoder/-10/

In the main screen of Freenet, go to the 'Key' field and paste the key there. After that, click 'Fetch'
Freenet keys
Then you'll the download progress. Yes, Freenet downloads the page first:
Page downloading
After the download is complete, you'll finally see the page:
Loaded page

Related Posts Plugin for WordPress, Blogger...