Usual disclaimers: I'm not a doctor, legal professional or financial advisor. This article is for information/education only and reflects my own opinions. It should not be taken as financial, legal or medical advice. Do your own research and never invest anything you cannot afford to lose (including your time).

28 July 2014

Another bit of a M$ rant

I've been using Windows 8 for a while now. I upgraded it to 8.1 as soon as I could and I've been using Classic Start Menu (4.0.4) for a while because well it (or an M$ equivalent) should have been built-in to begin with.

There is something missing in the M$ camp these days and I'm not convinced just shedding jobs will fix their problems. They seem to have forgotten the customer. Let me explain what I mean by that. Around 10 years ago, my boss (back then) tried to introduce me to Linux, specifically a distribution called Slackware. I was slightly amused at the notion that you sometimes had to spend an hour trying to get the mouse & keyboard working. I'd been spoiled with Windows XP where if you set it up correctly, you could remove the drive, put it in another PC and at start-up it would try to match any drivers it knew about with the installed hardware and you usually ended up with a working system. Not necessarily a clean and efficient system and you might eventually run into issues with conflicting drivers, but it would get you out of a fix if your hardware died suddenly.

Eventually everything with drivers started to go the certified-for-Windows way. There would be logos on boxes and this stuff was supposed to be guaranteed to work on Windows (whichever version it sported the logo for). There is a lot of this old kit still out there which still works, but is no longer supported and the peripheral manufacturers are not that bothered about re-writing drivers (since they have made new products and certified them with newer versions of Windows and are now concentrating on that new market). This is why I think M$ have forgotten the customer.

This morning I tried to get an old usb wi-fi adapter working on Win 8.1. Now when I upgraded to Windows 8 (from XP) I did not consider how much additional hardware I had which might need replacing so again I think I can say that M$ have forgotten the customer. I may have skipped a few versions (which were downgrades from XP in my opinion) but I have things like USB drives, wi-fi adapters, hubs, digital cameras etc. which should still work; but some will undoubtedly not work with Windows 8. Still after 15 years in the tech industry I know there's usually people in the same situation who go on to fix these things and then post details for the benefit of others caught out in the same way. I even found an article on PC-Pro about how to turn off driver-signing enforcement to allow installation of custom drivers (always make sure these come from reliable sources).

So after finding the hard-to-find new app (it did not show up in search), I got thrown into Metrohell (where the app launches itself full-screen, hides the browser you had open and the easiest way to get back to the desktop is CTRL+ALT+DEL ->task manager -> minimise. I managed to re-read the instructions and then back to the app, through 2 or 3 other screens to find the reboot option I needed and rebooted. Then there were more options after the reboot but I eventually managed to turn off driver-signing protection. I hacked my driver .inf file, replacing the NTamd64.6.0 mentions with NTamd64.6.2. I got a warning about installing the unsigned driver which had a red-box around it (which reminded me of the old CBM-Amiga guru-meditation messages when something went wrong). After all that, the driver appeared to install ok but at the end, it came up with another error (the device cannot start - code 10)

At this point I plugged it into my Linux Mint box (v16) which instantly installed it and gave me a list of SSID's for my wi-fi network(s).

This functionality is what made XP great. Back then Linux was a chore if it didn't work properly but these days I'm finding more and more that it's Windows which is becoming a chore. From important control panel applets changing name with every new version to changes in how the sound mixer system works. I am being forced to re-learn Windows with every upgrade and then I discover there could be additional costs of replacing peripherals which are no longer supported. It's now Linux Mint which reminds me most of XP with it's robust desktop and compatability. I really hope M$ will at some point see what they are doing and bring the Windows franchise back to it's former glory (XP2 maybe?). Lets not forget they gave us XP, Kinect, the Xbox360, FSX etc. so it is sad to see M$ in a state of decline; but not unexpected.

4 July 2014

Raspberry Pi for Secret Agents

I've had one of those rare luxuries this week; a couple of spare hours to go through something I've been meaning to try out for a while. Yes I've got hold of a copy of the Raspberry Pi for Secret Agents book and the task of creating a custom SD card for our Pi lab to accompany the book.

The Pi lab is really starting to take shape and we have more equipment coming later on this year. I'm currently working on a Minecraft install with python API, finishing off the old recycled recycling truck time-lapse-dolley using a Pibrella and a few additional bits & pieces, but today belongs to the secret agent book.

To start with, I was getting on well with the book and setting bits up while waiting for some components to arrive. To do the audio exercises in chapter two, you really need a USB microphone, so I installed the packages, ordered one and put this project on the back burner again while I waited for snail-mail to arrive. Luckily it arrived yesterday which coincided nicely with a very rare quiet spell so I went back to chapter two

I noticed there were some flaws in the chapter. Some alias commands did not seem to work, they would not survive a reboot and I got errors when I tried to play back a recorded mp3 file using SoX (even though the file appeared to be created ok). There were also some things missing, like how to stop a recording (CTRL+C seems to work. If you're getting lock-ups from trying to fix the aliases, you can also try CTRL+X or CTRL+Z).

Lets start with fixing the main problem then. If you manage to get SoX to record and pipe it to Lame, you end up with a file that you can't play back and you get the error message "no handler for file extension mp3". I eventually found a fix for this which is: sudo apt-get install libsox-fmt-mp3 It seems the author must already have this (or something similar) installed. That should get those mp3 files playing.

The next issue for me was the Alias commands refusing to survive a reboot. The author suggests adding them into ~/.bash_aliases. I tried this and the commands were there in the file after reboot but didn't seem to work after I logged out and logged back in again. I came across this forum article about a custom message of the day (motd) which I thought would be good for us to use to provide some help to anyone using the card. It not only provided the inspiration for our own custom message, but also got me thinking 'well if that gets displayed to anyone logging in then any commands I put in there will get run as well'. It uses a file called ~/.bash_profile and if you put aliases at the end of that file they will indeed be there and usable by the person logging in. I then decided to customise this a bit further. I can see no point having weather information on a terminal which is right next to a window but I figured the one thing which is missing from that script is the infinitely-more-useful SD-card free-space remaining. I have added this bit in quite a crude way (using grep with character offsets discovered by trial and error)

Anyway here is my current .bash_profile in all it's glory. No doubt I will come back to this at some point. I also used Sudo mkdir ~/agent to create a working directory but you can skip that bit if you remove the last line of this script (cd /home/agent).

let upSeconds="$(/usr/bin/cut -d. -f1 /proc/uptime)"
let secs=$((${upSeconds}%60))
let mins=$((${upSeconds}/60%60))
let hours=$((${upSeconds}/3600%24))
let days=$((${upSeconds}/86400))
UPTIME=`printf "%d days, %02dh%02dm%02ds" 
"$days" "$hours" "$mins" "$secs"`

# clear the screen
clear

echo "$(tput setaf 2)
   .~~.   .~~.    `date +"%A, %e %B %Y, %r"`
  '. \ ' ' / .'   `uname -srmo`$(tput setaf 1)
  .~ .~~~..~.   
  : .~.'~'.~. :   Uptime.............: ${UPTIME}
 ~ (   ) (   ) ~  Memory.............: `cat /proc/meminfo | 
grep Memfree | awk {'print $2'}`kB (Free) / `cat /proc/meminfo | 
grep MemTotal | awk {'print $2'}`kB (Total)
( : '~'.~.'~' : ) IP Address.........: `/sbin/ifconfig eth0 | 
/bin/grep "inet addr" | /usr/bin/cut -d ":" -f 2 | 
/usr/bin/cut -d " " -f 1`
 ~ .~ (   ) ~. ~  SD Space left......: `df -h | 
/bin/grep "rootfs" | /usr/bin/cut -c 28-34`
  (  : '~' :  )   
   '~ .~~~. ~'    

Agent Pi: Our SD card to accompany the 'Raspberry Pi for Secret Agents' 
book.
Read the section on tmux (p34) before you start.

Extra packages installed: tmux, sox, espeak, lame, vorbis-tools

This message is:/home/pi/.bash_profile 
Use Alias to list shortcuts   
"

#back to white
echo "$(tput setaf 7)"
#(0)Black (1)red (2)green (3)yellow (4)blue (5)Magenta (6)cyan (7)white

#Alias commands here as .bash_aliases does not seem to work for some reason
alias recordmp3="sox -t alsa plughw:1 -t wav - | lame - "
alias record="sox -t alsa plughw:1 -t wav - | lame - "
alias recordwav="sox -t alsa plughw:1 -t wav - "
alias recordogg="sox -t alsa plughw:1 -t ogg - "
alias recordflac="sox -t alsa plughw:1 -t flac - "
alias play="echo 'use sox filename.ext -d for playback'"
alias encmp3="lame - "
alias encogg="oggenc - "
alias micvol90="amixer -c1 sset Mic 90"
alias micmute="amixer -c1 sset Mic 0"   
alias headphones="amixer cset numid=3 1:"
alias hdmi="amixer cset numid=3 2:"
#go to working directory
cd /home/agent


If you're wondering how I managed to get this hidden profile off my pi, just copy it as a text file first (cp ~/.bash_profile bash_profile.txt). Then you can use WinSCP to grab it from a Windows machine. If you're trying to go the non-M$ route, you can start up Midori on the Pi and upload it to Google docs (or more likely pastebin :) ).

Hello again Google, all is forgiven... well you are the slightly lesser of two evils... this week anyway.

Yes my move away from Google over removing security options from the Android system on my phone has come to an end. Not because I am pleased with any new implementation of the system they previously removed (in fact I've had some updates recently but not really had a chance to check out the changes yet).

No, this weeks most evil award goes to Microsoft for managing to stuff up the connection to my home network by virtue of their attack on No-IP.com. If you missed it, some judge in Nevada sided with M$ and gave them control of a large chunk of No-IP's business all done in the name of stopping malware from infecting Windows installations (as long as it is possible to make Windows invulnerable without actually patching the faults I presume).

Essentially No-IP works like a telephone directory which fulfills a need for many of their customers. They provide dynamic domain-name-resolution service (Dynamic DNS or DDNS). It works something like this. Your ISP might charge you a kidney or two for a connection to the internet which always has the same IP number (a static IP address). After all IPv4 addresses are getting scarce and since not all of the ISP customers are online at the same time they can share fewer numbers by allocating what they have between many users. So when you connect, the ISP may give you an internet address which was recently used by someone else because it's cheaper than having a dedicated address for everyone.

That was all very well when we only used PC's to connect to the internet but these days people want to rig up cameras, fridges and just about anything else they can think of. But how can you get to it when away from home if your internet address keeps changing and you don't know what it has changed to? That's where DDNS comes in. You typically have a client (a script or app) which updates your DDNS entry from home so you can always put http://mymegafridge.no-ip.org (for example) into your browser and a server at the other end looks up the current IP address for your fridge and forwards your browser to the server running on your home device. These update scripts can even be built into the software running on your home broadband modem or wi-fi router

So why did M$ get control of No-IP.com's web addresses? I can only put it down to ignorance on the part of the judge in Nevada. Imagine if Apple were allowed to shut-down Verizon because some of their subscribers were using the network to place prank calls to Apple employees. There is an obvious conflict of interests here and this decision needs investigating. Microsoft may not provide an alternative DDNS service but it claims to have known about No-IP domains being used to hack Windows machines for at least 12 months. So what have they done to fix these weaknesses in Windows to prevent the malware from spreading? Well M$ release regular updates for Windows on a monthly basis (known in the biz as patch Tuesday). Kind of hard to beleive then that they are still being affected by something they've already had 12 months to fix? That sort of thing can happen in industry though because IT depts will check each patch to see if it screws up their systems before rolling-out the fixes to all the employees (or not if the patch has a more detrimental affect than the malware risk). Even so, there are other DDNS services out there which were still running, still being used for exploits. The only real way to stop them is to build a big off switch which links the whole internet and just turn it all off - I suggest a custom 404 page to go with it with a big game-over logo.

Taking down my ability to link to my home network does only that. If there was a device spreading malware at my home, it would still have been connected, still trying to spread itself - I just wouldn't be able to connect to it while away from home to check or fix it. And the thing that really wound me up the most was the video being posted on twitter about some sweaty Ron character giving away free cupcakes with hair in them. The punchline goes "not everything that's free is good". Yes but Windows certainly isn't free and if it's being affected by 12 month old malware then it certainly isn't good either. The real irony is that Microsoft probably could have had a greater impact on reducing their malware crisis by shutting down their own hotmail service which is a frequent source of phishing and exploit invitations. Anyway, rant over and I'll be Binging no more and back to Google it is. Lovely, imperfect Google with their phone O/S on which I've turned off 90% of the functionality to get a 7-day battery life and who haven't scuppered my home network connection in some botched attempt to stop the spread of malware. And if you're going to attack things which are free then kindly remember that also includes free speech - so your actions could be considered unconstitutional.

What I will take forward from this experience is that reliance on a third-party service can create issues should anything happen to that third-party. I'm sure I could script something (maybe on a pi) to watch my IP address and contact me when it changes. Luckily my home network is purely for a couple of home security devices so the outage didn't have financial consequences for me. M$ should definitely be forced to compensate anyone who did lose money as a result of this action.