Replace The Default Firefox Google Search In Linux Mint

The recent release of Ubuntu’s Natty Narwhal forced me to reassess my usage of Ubuntu on my work and home machines. As I found the Unity interface drives me crazy and the release on a whole to be very buggy. So I decided to give Linux Mint a go, it has grown in popularity (#2 according to Distrowatch)  over the last few years so I figured they must be doing something right and Linux Mint 11 still uses no frills Gnome 2.32.

The migration went smooth, but by default the Linux Mint Firefox Google search functionality is useless, but luckily it wasn’t too much effort to fix.
Read the rest of this entry »

2 comments

August 11th, 2011 at 9:56 pm

Posted in Linux

Tagged with , ,

Anonymizing CURL Scripts With TOR & Polipo

Last week I received a typical run of the mill phishing email littered with the usual bad Engrish making the instructions far from believable but being bored I decided to take a look at the link they were pushing.

They had created a believable enough looking Paypal form asking clueless punters to enter their credit card details in order to avoid having their account being suspended. After playing around with the form for awhile in Firebug I decided to create a quick script to poison their data by submitting a new fake 16 digit VISA number along with random card holder name, CVV number and expiry date every couple of seconds.

After running this script for half an hour I decided that the script while it did the job would be a lot better if the posted data was coming from an anonymous IP address. Here I will run you through the process of setting up TOR & Polipo on a machine to add an element of anonymity to the data being sent and received by your CURL based script using.
Read the rest of this entry »

leave a comment

August 10th, 2011 at 8:45 pm

Posted in Linux,PHP

Tagged with , , ,

Removing Stolen Content From Google

From time to time its not uncommon to find sites stealing your content in its entirety with no link back to its original source whilst plastering ads around their page to make money off your hard work. Getting these plagiarised sites removed from Google used to be a hassle, requiring the copyright owner to file a DMCA complaint and then mail or fax (you remember those technologies, right?) it to Google.

Good news though, I found  some stolen content today and it seems the times have finally changed with Google finally allowing web submitted content take down requests. This move has been a long time overdue in my opinion as a majority of these stolen content sites are making their money through Google’s adsense program. With the old fax and email system it was normally easier just to firewall off the network the offending site was hosted on to stop them scraping your content and move on with life.

Here are some tips on what to do if you suspect someone is stealing your content for their own gains without any attribution:

Read the rest of this entry »

leave a comment

August 4th, 2011 at 10:28 am

Posted in Web

Tagged with , ,

Installing Internet Explorer On Ubuntu Natty

For years Internet Explorer 6 was the bane of every web developers life but as with all great tales it seems the characters change but the story always remains the same. While IE6 is generally not expected to be catered for by developers these days its equally twisted offspring IE7 still is. Normally when I run need to test or fix Internet Explorer issues I  just boot up a XP virtual machine and try and replicate what ever dramas the end user is experiencing. But the other day I was away from my normal desktop with no copy of Windows handy so running a VM wasn’t an option.

For years I used rely on the ies4linux project to get IE running under Linux project to get Internet Explorer working for me, but unfortunately the project no longer seems that active so a new way had to be found. Luckily I found it can be done through wine tricks which is actually easier than the original method.

So here I will run you through the process of installing Internet Explorer 7 on your Ubuntu box with Wine this way you can still manage some basic testing without having to worry about getting a complete copy of Windows.First up make sure your system has Wine & Winetracks installed:

sudo apt-get update
sudo apt-get install wine1.2 winetricks

If you look under your applications menu you should now have a Wine subfolder with an entry called “Winetricks” click on this this to get started.

Select the option labelled “Install a Windows DLL or component”.

Then select your chosen version of Internet Explorer to install, be warned though don’t get greedy and try an install them all under the same Wine prefix as they wont play together nicely.

Form here it should be pretty smooth sailing just accept the EULA which you are breaking by installing on Linux and you should be good to go!

At the end it will say you need a reboot just hit the “Restart now” option, it won’t actually reboot your system Wine will simply simulate a reboot for it. After the process completes simply run:

wine ‘C:\Program Files\Internet Explorer\iexplore’

For a somewhat buggy but “good enough” version of Internet Explorer on your Ubuntu box.

leave a comment

August 2nd, 2011 at 12:57 pm

Near Realtime File Replication With Lsyncd

Ever wanted real time backups of  directories on your server? To replicate static media files for a website to a separate box to reduce load? An easy solution lays with lsyncd it allows you to watch a directory structure on your file system, and replicate any changes on a remote system.

How It Works:
inotify is a Linux subsystem available from the 2.6.13 release of the Linux kernel that monitors changes made to a file system and reports these changes to interested applications. lsyncd is an application written in lua that uses the inotify service to inform it of changes made to monitored directories and then when notified of a change uses rsync to replicate the changes on a remote service.

Getting lsyncd
The lsyncd sourcecode can be downloaded from Google Code and compiled but depending on the distribution your server is running, the install process be even easier as lsyncd is included in the repositories of many popular Linux distros.

Installing On Debian / Ubuntu
While lsyncd is included in both the repositories of Debian and Ubuntu but unfortunately its an outdated version so check what version you are going to get beforehand with the command:

apt-cache show lsyncd

If apt-cache tells you that only one of the 1.x versions are available, I would recommend grabbing one of the 2.x versions from the Debian testing repository instead, the amd64 package can be found here  and one for the i386 architecture here. Then install using the dpkg command i.e

cd /root
wget wget http://ftp.au.debian.org/debian/pool/main/l/lsyncd/lsyncd_2.0.4-1_amd64.deb
apt-get install lua5.1 rsync
dpkg -i lsyncd_2.0.4-1_amd64.deb

Read the rest of this entry »

2 comments

July 21st, 2011 at 6:28 pm

Posted in Linux

Tagged with , , , , , ,

Blocking VocusPR Spam With Iptables

VocusPR has a dubious reputation their main line of work is aggregating the contact details of journalists and bloggers and then selling access to that database so companies can contact them. Press releases from Vocus customers come with the required “unsubscribe” link down the bottom but the catch is clicking it will only stops the client from contacting you, but not the other multitude of clients spamming your from their database. Today I have had enough contacting them seems to get nowhere so its time for more effective measures. A WHOIS lookup for the IP address of one of their spam servers reports:

#
# Query terms are ambiguous.  The query is assumed to be:
#     “n 66.77.65.154″
#
# Use “?” to get help.
#
#
# The following results may also be obtained via:
# http://whois.arin.net/rest/nets;q=66.77.65.154?showDetails=true&showARIN=true
#
Vocus, Inc. QWEST-IAD-VOCUS1 (NET-66-77-65-128-1) 66.77.65.128 – 66.77.65.191
Qwest Communications Company, LLC QWEST-INET-12 (NET-66-77-0-0-1) 66.77.0.0 – 66.77.255.255
American Registry for Internet Numbers NET66 (NET-66-0-0-0-0) 66.0.0.0 – 66.255.255.255

 

Now for the blocking part, simply logged in to mail server add added the following to my firewall rules to block their IP range:

/sbin/iptables -I INPUT -s 66.77.65.128/26 -j DROP

 

Goodbye VocusPR have a nice life spamtards!

Update: VocusPR also own the IP ranges 209.3.118.0/24 and 63.232.227.0/26

leave a comment

July 20th, 2011 at 11:02 am

Posted in Uncategorized

Tagged with , ,

Logging PHP Errors For Production Environments

Good security practices dictate PHP should be configured to never display error messages and notices to screen in a production environment due to its potential to reveal information about your server and application setup. One solution is to enable error logging on the server by setting the log_errors attribute to 1 in your php.ini and reloading Apache. When active by default all errors will be sent to the Apache error log and will appear similar to the line below, unless a different path has been set in the php.ini configuration file using the error_log directive.

Read the rest of this entry »

leave a comment

July 18th, 2011 at 11:16 am

Posted in PHP

Tagged with , ,

Changing an elements visibility with jQuery

Adjusting the visibility of element within a web page comes in handy from time to time for features like tool tips, extending content after a short excerpt etc. This technique adds greatly to the user experience of your site and has been around for a long time but the jQuery library makes this task a lot easier with the hide method.

To get started if you haven’t already load the jQuery library into the head of your page i.e

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript">

Read the rest of this entry »

leave a comment

July 13th, 2011 at 8:34 pm

HTML5 Placeholders With jQuery

HTML 5 brings many new features to the browser including a lot of enhancements to the way forms are created and handled. One of my favourite features is the introduction of the placeholder attribute, this allows the display of  some text in a text input field or text area until the element is brought into focus. This allows the addition of small tips or related prompts to give the user a better understanding of what is required as input.
Read the rest of this entry »

leave a comment

July 10th, 2011 at 10:31 am

Posted in HTML5

Tagged with , ,

Removing The WordPress Toolbar

One thing that has caused me some grief since the release of WordPress 3.1 is the admin bar that appears up the top of the blog when you are logged in.

Call me a stick in the mud but I have never really used it since its introduction and on a few sites it has even gone as far as breaking the appearance of the template.

Read the rest of this entry »

leave a comment

July 9th, 2011 at 11:58 am

Posted in Wordpress

Tagged with ,