The bash bug

If you’ve following the news, here for example, you’re aware that there is a new bug out there. You can easily find information about it out there and how to fix it.

We’ve patching servers and although we have the most recent one’s managed with Chef some legacy one’s are not. As a good practice I script everything, so this time wasn’t an exception.

The script provided here as a gist, will help you check for the bug and patch it.

Because our servers are mostly Ubuntu servers, it’s only accounting for that. But you can easily change the script to suite your system.

Just a quick rundown of what it does.

  • it ssh’s into your server one by one and runs a test;
  • if the output of the test contains ‘vulnerable’ well, it’s vulnerable;
  • it then updates the repository and updates your bash.

For this script, I’m using Fabric. You can install it on your system, you you can create a virtualenv for the purpose. You can do:

$ virtualenv /path/to/env/folder
$ source /path/to/env/folder/bin/activate
$ pip install fabric

After that, get the code into any folder you desire (remember to name the file fabfile.py) and run:

$ fab check_bug

I hope it helps.

P.S. Of course, don’t forget yo update the hosts, user and key_filename to your own. Also, a check_bug.log is created in the same folder the file is run from. You can use that log to troubleshoot any problem that might arise.

 

HelloGlass

Recently I’ve messing around with a Google Glass and started working on a small prototype to interface Glass with our internal systems. Let’s build a very simple, Hello World style application, using the GDK.

The features of our application will be:

  • Add a command to the main menu;
  • Use voice  to trigger that command;
  • Launch an activity from that  trigger.

Let’s start by setting the string that will be added to the menu and be used as a trigger. That code lives in res/values/string.xml and res/xml/voice_trigger.xml.

On AndroidManifest.xml we will declare our activity and the service that will launch the activity on the voice command, along with linking the voice command we just created.

HelloGlassService.java will hold the code to launch the activity. onStartCommand will take care of launching our main activity.

MainActivity.java will be the activity that will display the default text.

So that this post didn’t get too long and bloated, I didn’t paste the code. But you can find it here. This example was built using Android Studio so you might be familiar with the file structure.

Have fun! Play and extend it.

P.S. Google states “Before you begin to use the GDK, you need intermediate or better knowledge in Android development.” I’m assuming the same here: that you have some knowledge and familiarity with Android development.