Remote shutdown with C++ on Linux

So, carrying on from my Setting up Wake-on-lan on Ubuntu Server 18.04 LTS article, I decided that I would probably like to shut down my server a little bit more easily too.

In case you’re not sure what server I’m referring to – I run a local headless ubuntu server at home to allow me to work on database driven projects across multiple devices without having to keep local copies of the data on each device. It has your standard LAMP stack on there, nothing too fancy.

Until recently, I was logging in via SSH and running sudo poweroff to shut down the system, not terribly convenient. I figured, if I’m running a python script from terminal to fire up my server, I should probably get another system implemented to run another thing from terminal to shut it down, and so I did.

It’s been quite a while since I’ve written anything meaningful in C++. In fact, the last piece of C++ code I wrote with a purpose was in 2012 when my laptop J key was broke – it kept sending keystrokes without being pushed. So I threw together a low level keyboard hook to discard the key and listen for the period key instead, which it would then replace with a J. Not very convenient but it was a good temporary solution at the time.

Anyway, I digress. So, I could probably have done this in Python but I’m not a Python programmer, I’ve barely even studied it. Shocking, right? I can read it, sure, but not write. So, C++ was a nice alternative since I didn’t want to go through the hassle of installing java on my server for the sake of one task, all that extra JVM overhead was burning my soul. That and my linux distro has C/C++ compilers installed already so no extra work needed there.

 

The Client-Server Model

Everyone with even a slight understanding of the internet is familiar with the basics of a client-server model. The server listens, the client hollers and the server responds. Without getting into the details of protocols, packets and such, that’s the crux of it. With that in mind, it gave me a good place to start.

I was going to need a server, on my server, to listen. That sounds crazy, right? ambiguity at its finest!

What I mean is, I needed a program on my server machine to listen on a particular port for a particular piece of data to trigger a shutdown, I decided to call it the shutdown server since that would be its sole purpose and it describes its purpose perfectly.

The Server

So I’m just going to dump the code here and let you have a read before I explain anything about it:

#include <unistd.h>
#include <iostream>
#include <sys/socket.h>
#include <stdlib.h>
#include <netinet/in.h>
#include <string.h>
#include <linux/reboot.h>
#include <sys/reboot.h>

int main(int argc, char const* argv[]) {
	const int port = 8000;

	bool shutdown = false;
	struct sockaddr_in address;
        int new_socket, input;
        int opt = 1;
	int addrlen = sizeof(address);
	char *response = "shutdown command received";

	int sockfd = socket(AF_INET, SOCK_STREAM, 0);

	if(sockfd < 0) {
		std::cout << "Socket Creation Failed" << std::endl;
		exit(-1);
	}

	if(setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR | SO_REUSEPORT, &opt, sizeof(opt)) < 0) {
		std::cout << "setsockopt failed";
		exit(-1);
	}	

	address.sin_family = AF_INET;
	address.sin_addr.s_addr = INADDR_ANY;
	address.sin_port = htons(port);

	if(bind(sockfd, (struct sockaddr *) &address, sizeof(address))<0) {
		std::cout << "Bind failed" << std::endl;
		exit(-1);
	}

	if(listen(sockfd, 3) < 0){
		std::cout << "Listen failed" << std::endl;
		exit(-1);
	}

	while(1) {
		char buffer[1024] = {0};

	       	if ((new_socket = accept(sockfd, (struct sockaddr*) &address, (socklen_t*)&addrlen))<0) {
                std::cout << "accept failed" << std::endl;
                exit(-1);
		    }
	
		input = read( new_socket , buffer, 1024);
		if(input <= 0) { break;}

		if(strcmp(buffer, "shutdown -local") == 0) {
			send(new_socket, response, strlen(response), 0);

			shutdown = true;
			close(new_socket);
			break;
		} else {
			send(new_socket, "hello", strlen("hello"),0);
			close(new_socket);
		}
	
	}	

	if(shutdown) {
		std::cout << "Remote shutdown requested" << std::endl;
		reboot(LINUX_REBOOT_CMD_POWER_OFF);
	}
	return 0;
}

First of all, we need to create a socket file descriptor to use:

int sockfd = socket(AF_INET, SOCK_STREAM, 0);

if sockfd contains a negative integer, something went wrong. So we check that with an if statement before going any further.

Sidenote: This is a very crude program so it’ll simply quit if an error is encountered

The next section of code relating to setsockopt() doesn’t strictly have to be used, it attempts to force the program to use the defined port. Since my machine is absolutely not running anything on port 8000, I’m happy to make use of the function.

Following, we populate the sockaddr_in struct with some required values (tell it to use IPv4, accept connections from any address and provide the port to listen on).

Sidenote: I’m not worried about accepting connections from any address because my server is configured to listen on LAN only and it sits behind two firewalled routers and runs its own firewall too

The next step is to attempt to bind the socket file descriptor to the given port with the pre-configured struct data, using bind()

bind(sockfd, (struct sockaddr *) &address, sizeof(address)

and exit if it fails. If it’s successful, however, we will attempt to listen(sockfd, 3) for new connections and enter an infinite loop.

The infinite loop is required to continually accept incoming connections and respond accordingly. There are only two responses here. The first will shut down the system if the data “shutdown -local” is received, the other will simply reply with “hello” and then close the connection and await a new one.

If the accept() function is called before the loop, it will only ever accept one connection and never wait for a subsequent connections.

The program is running on linux, so glibc is used to access reboot(LINUX_REBOOT_CMD_POWER_OFF); which will tell the system to power off. This actually requires sufficient permissions to work but I added the compiled program to systemd to run as a service, since I’ll want the shutdown server to be listening automatically as soon as the server is powered on. I’ll explain this a bit more shortly. The service runs with sufficient permissions; otherwise, if you’re testing the code, you’ll probably need to run it as root.

g++ was used to compile.

The Client

The client program will primarily be running from my MacBook so it was compiled on there with g++. It is considerably shorter:

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <iostream>

   
int main(int argc, char const *argv[]) 
{ 
    const int port = 8000;
    struct sockaddr_in address; 
    int sock = 0, response;
    struct sockaddr_in serv_addr; 
    char *data = "shutdown -local";
    char buffer[1024] = {0}; 
    if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
    { 
        std::cout << "socket creation error" << std::endl;
        return -1; 
    } 
   
    memset(&serv_addr, '0', sizeof(serv_addr)); 
   
    serv_addr.sin_family = AF_INET; 
    serv_addr.sin_port = htons(port); 
       
    if(inet_pton(AF_INET, "local.ip.here", &serv_addr.sin_addr)<=0)
    { 
        std::cout << "invalid address" << std::endl;
        return -1; 
    } 
   
    if (connect(sock, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0)
    { 
        std::cout << "connection failed" << std::endl;
        return -1; 
    } 
    send(sock, data, strlen(data), 0);
    response = read( sock , buffer, 1024);
    printf("%s\n",buffer ); 
    return 0; 
} 

A quick client summary

Similarly to the server, we define our variables and create a socket. If that’s successful, we validate the given IP address and attempt to connect. Providing there are no errors, we send the data to the server. In this case the data is simply a string containing the phrase “shutdown -local” which is a specific string that the shutdown server is listening out for. The client then waits for a response and then displays it before exiting gracefully by returning zero.

This client source code was compiled on my MacBook and placed in a directory that is added to PATH dedicated to custom scripts and programs that I might like to run from terminal, so I don’t have to navigate anywhere or type full path names when I open terminal.

Compiled with: g++ client.cpp -o sds

and placed in the above mentioned directory, I can simply open terminal on my MacBook and type “sds” to shutdown my server. This coupled with the “wol.py script to wake the server means that I can turn it on and off with absolute ease, remotely.

Creating a Service to automatically run the shutdown server on star-up

In the same way as detailed in Setting up Wake-on-lan on Ubuntu Server 18.04 LTS, I created a service to run my shutdown server automatically too.

The service is incredibly basic. I created a file called sdserv.service in /etc/systemd/system which contains the following:

[Unit]
Description=Listen for local shutdown command

[Service]
ExecStart=/home/tim/cpp/sdserver

[Install]
WantedBy=multi-user.target


The file located at /home/tim/cpp/sdserver is the binary of the compiled server source code above. ExecStart requires an absolute file path.

I then told systemd to refresh its cache of services with systemctl daemon-reload

systemctl enable sdserv.service tells systemd to run the service on start-up and systemctl start sdserv.service starts the service.

and thats it! After putting all that together, I can now run wol.py to turn on my server and sds to turn it off!

MySql Access Denied for User root without sudo

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) is not something you want to see when you try and login to mysql using the default root account with no password, especially when there is no password, on a fresh install!

So this was the problem I faced when I installed MySql on Ubuntu Server 18.04 TLS.

I SSH into my server since its a headless machine, just sat there with no peripherals connected at all. Just an ethernet cable and power cable. I was beginning to set up the machine as a local network server for a database heavy project I’m working on, so I installed MySql with sudo apt install mysql-server and immediately tried logging in to create a non-root user for my tasks:

mysql -u root

I typed. It threw me that error above. So I tried it with sudo and sure enough it worked. I’m not entirely sure why, but it did. Perhaps because my machine is referred to as the-lab and MySql just didn’t know who that was, because it isn’t localhost. Who knows.

Anyway, to remedy this particular issue I had to run a series of commands that removed the root user and added it again, after logging in with sudo. The steps were as follows, in case you find yourself in a similarly annoying situation:

  1. sudo mysql -u root
  2. drop user 'root'@'localhost'; This one is a bit scary because, well, you’re deleting the root user. But rest assured you can still continue to run commands after this, I promise.
  3. create user 'root'@'localhost' identified by '';
  4. grant all privileges on *.* to 'root'@'localhost' with grant option;
  5. flush privileges;

Now exitMySql with exit; or CTRL+D and try to log in again without sudo, job done!

Setting up Wake-on-lan on Ubuntu Server 18.04 LTS

Alright, where to begin?!

When I work from home, which is almost always, I often find myself working on various devices (MacBook, Dell laptop, desktop) and lately I’ve been working on a heavily database oriented project. Local dev with databases involved isn’t very friendly across multiple machines. You can add your code to VCS but including a database full of test data isn’t my idea of a fun time.

So, long story short, I re-purposed my linux desktop pc from its semi-neglected state to something more useful. A LAN MySql server. Of course, there’s the whole LAMP stack on there just for shigs, though. That, and ease of data management with PMA.

So what is the problem?

Well, I’m lazy. I’m a developer. I’m not going to go to where my server is located and turn it on every time I need to access it, no sir! Nor am I going to leave it on permanently, leeching my hard earned electricity from under my nose. That coupled with the fact that it’s next to my bed and when night sets in, it sounds like an engine next to my face. So, I need to be able to turn it on from my laptops. Easy stuff, wake-on-lan at your service.

The BIOS supports it, awesome, why not. So, I set the bios to listen for those magic packets and locate a tutorial to enable Ubuntu to cooperate. If you’re unaware, generally speaking, when an Operating System shuts down it also powers down the network adapter. This is bad for Wake-on-lan. If it’s not on, it’s not listening! The problem is, all the tutorials I’m finding are for Ubuntu pre-18, at which point Ubuntu dropped Upstart support.



The solution

The steps for preparing Ubuntu for WoL are as follows:

  1. Install ethtool with:
    sudo apt-get install ethtool
    – Ubuntu Server 18.04 LTS already has this installed
  2. Run:ifconfig
    to get the name of your network interface. Its worth noting here that all the guides I found say that “your network interface is most likely eth0”. The thing is, that’s no longer the case. Ubuntu has been transitioning to systemd since version 15.04 and part of that transition is the implementation of Predictable Network Interface Naming and so you might just find that your network interface name is something along the lines of:enp0s15
    Regardless, run: ifconfig
    to get your network interface name: 
  3. Run the command sudo ethtool -s interface wol g
    and this tells ethtool to tell the network card to listen out for magic packets. The g denotes that it should listen for magic packets. The problem is, this solution isn’t persistent between shutdowns so once the machine is powered down and then booted up again, the setting is lost. The general consensus is that you should create a system service that runs this command at start-up.
  4. On Ubuntu 18.04, you need to create a systemd service as opposed to enabling, creating and/or modifying rc.local as you would’ve done on previous versions. So, navigate to
    /etc/systemd/system
    and create a new file here called `wol.service` – you could be more descriptive but I prefer short filenames, I know what wol means here. I use vim for all my terminal based editing so I run this command: sudo vim wol.service
    to create and begin editing my service file.
  5. Now you need to populate your wol.service file with all it needs to run as a service. The most comprehensive documentation I found on this was provided by RedHat linux here. My file looks like this:
    [Unit]
    Description=Configure Wake-up on LAN
    
    [Service]
    Type=oneshot
    ExecStart=/sbin/ethtool -s enp35s0 wol g
    
    [Install]
    WantedBy=basic.target
    

    ExecStart provides the command to run. It’s important to note that this must be the absolute path to ethtool because services don’d do relative paths. Check the documentation if you want to understand the file structure more thoroughly.

  6. Once you’ve created your file, you need to add it to the systemd services so you should run systemctl daemon-reload to tell the system to update and/or locate new service files, like the one we just created.
  7. Run systemctl enable wol.service to enable the service to run on start up and,
  8. finally, systemctl start wol.service to fire up the service. This may be a redundant command but I’m not sure if step 7 does this automatically or not so there’s no harm in running it anyway.

And there we have it, if you’ve gone through all of that and enabled Wake-on-lan in BIOS, you should be able to power off your machine and then wake it up with a magic packet.


The Magic Packet

I opted to use a python script to send my magic packet, provided by San Bergmans, thank you! I had to modify it ever so slightly, maybe because I’m using it on a Mac, it expected a mac address as a parameter and it always took its own filename as the first parameter, which is obviously not a mac address, regardless of whether or not I actually provided it a parameter. I actually wen’t further than that and just dumped my mac address in file, skipped the parameter requirement and now it just sends a magic packet with my pre-defined mac address whenever I run the script. I literally type:
wol.py
in my mac terminal and the magic packet is sent, the server fires up and I’m good to go! (I have the script in a directory added to path, some advise against such a practice but convenience is what I thirst for!)

Xcode, ffmpeg and mac

So for the last 2 hours I’ve been getting errors trying to compile some C++ code on my mac that makes use of ffmpeg. For clarity, I’m using a modern MBP, Xcode and C++ to try and compile some simple ffmpeg code to spit out a list of stuff I can’t even remember the reason for right now.

...Undefined symbols for architecture x86_64:
"avcodec_register_all()...

This error was telling me that the linker can’t find a particular library required for compiling. So I tried rebuilding ffmpeg a few times with different options, I tried linking the include and lib directories to Xcode a couple of different ways, I tried changing the code several times too, I even tried compiling via terminal with g++, all with no luck.

So, tired as hell, I give it one more try. I realise that, thanks to some crazy Chinese forum with snippets of English on it, ffmpeg uses C, not C++. So I had to change my header includes to reflect that.


#ifdef __cplusplus
extern "C" {
#include "libavformat/avformat.h"
}
#endif

instead of:

#include <libavformat/avformat.h>

An unbelievably simple fix to a nightmare-ish problem, such is the life of a programmer.

So, I don’t write a lot of stuff here anymore but decided to put this up just in case someone else finds themselves in the same situation in the distant future.

Timing Code Execution in Java

Here’s a method for calculating the nth Fibonacci number, written in Java.

	static int fibN(int n) {
		if(n <= 1) {
			return n;
		}
		else {
			return fibN(n-1) + fibN(n-2);
		}
	}

This method is great for demonstrating recursion but it's terribly inefficient for the task at hand. A more efficient method of computing the nth Fibonacci sequence would be to literally count from the first to the nth sequence number. To demonstrate this, I'll be timing the code execution of both the method above, fibN(), and the method below, fibN2().

	static int fibN2(int n) {
		int current 	= 1;
		int previous 	= 0;
		int next 	= 1;
		int temp 	= 0;

		for(int i = 1; i < n; i++ ) {

			temp = current;
			next = previous+current;
			current = next;
			previous = temp;
		}

		return next;
	}

I'll be using Java's System.nanoTime() to time this code. Each method will be called from within a loop 45 times, the nanoTime() being noted before the loop starts and when the loop ends in order to calculate execution time. Remember, end time minus start time equals duration. So, here's the full class for this process:

class Fib {
	
	static long startTime 	= 0;
	static long endTime 	= 0;
	static long duration	= 0;
	static long duration2	= 0;

	public static void main(String[] args) {
		System.out.println("Recursive: ");

		startTime = System.nanoTime();
		for(int i=1; i <= 45; i++)
			System.out.println(fibN(i));

		endTime = System.nanoTime();
		duration = (endTime - startTime);

		System.out.println("execution took " + duration + " nanoseconds");

		System.out.println("Non-Recursive: ");

		startTime = System.nanoTime();
		for(int i=1; i <= 45; i++)
			System.out.println(fibN2(i));

		endTime = System.nanoTime();
		duration2 = (endTime - startTime);

		System.out.println("execution took " + duration2 + " nanoseconds");

		System.out.println(duration + " vs \n" + duration2);
	}

	static int fibN(int n) {
		if(n <= 1) {
			return n;
		}
		else {
			return fibN(n-1) + fibN(n-2);
		}
	}

	static int fibN2(int n) {
		int current 	= 1;
		int previous 	= 0;
		int next 	= 1;
		int temp 	= 0;

		for(int i = 1; i < n; i++ ) {

			temp = current;
			next = previous+current;
			current = next;
			previous = temp;
		}

		return next;
	}
}

timing

This image shows the result of this code. As you can see, fibN2() is considerably faster than fibN(), thus proving that it's much more efficient to count up to the nth Fib number than it is to use recursion to find the nth number.

A final note, nanoseconds are pretty rubbish to work with to be honest. At least, in this example. So change
System.nanoTime()
to
System.currentTimeMillis()

instead to time the processes in milliseconds. This will give a more friendly result.

Merging Shift and Vernam Cipher

This is the outcome of my attempt of merging the Shift and Vernam ciphers as part of the Computer Security module of my B.Sc. Computer Science degree, third year. The task itself is designed to stimulate an interest in a wide range of security topics. One of the following tasks were to be chosen:

1. Design and implement a secure password system

2. Analyse an existing password program

3. Improve the security level of an existing password system

The task was primarily aimed a group collaboration, teams consisting of 3 people only. Alice, Bob and Charlie (A,B and C).

Person A would be responsible for the planning, schedule and preliminary research for the password system.

Person B would be responsible for the implementation of the password system.

Person C would be responsible for the security quality of the password system.

The quotes above are taken directly from the coursework specification and it appears that the responsibilities of each person don’t make much sense in regards to tasks 2 and 3.

 

I opted to do this task solo because, well, it was permitted for starters and although group work is good for building teamwork skills, its not really fair for an official grade to be given to one person based on somebody else’s, positive or negative.

So the idea behind the system I attempted to create was to merge the functionality of the Shift and vernam ciphers. By merging them, I mean performing one and then the other consecutively. The data to be encrypted was a password as plaintext which would be part of a user account administration software for a local area network, totally fictional of course. The report discusses what I was attempting to achieve, when I noticed that things weren’t going according to plan and why and how I completed the overall system with some last minute changes due to the problem discovered.

Anyway, the report is attached – I just wanted to share it with the world lol 😀

 

Merging Shift and Vernam Cipher

Whaaat?!

So it’s been a long time since my last blog post. Partly because in between that last post and this post were a bunch of university-related posts that I have since unpublished (they were simply created as part of the course requirements O.o) and partly because life took over! i.e. I had third year to finish!

That’s all done and dusted now though, thankfully. University life is the good life but the education was painful. Everything I’ve taught myself over the years was basically repeated for the first 2 years and some of the 3rd year. Like, what? I’m paying £9,000 a year to get taught stuff I already know and then bitched at when I don’t attend my paid course because I don’t want to experience a mind numbingly torturous lecture explaining how to connect to a database with PHP and MySQL with no mention of MySQLi, PDO or prepared statements. That’s not to discredit the teaching or benefits it has for others, though, just my take on the whole situation.

Of course, I’m not saying I knew everything. I had the opportunity to master sockets and multi-threading in Java, take an in-depth look at computer security, Advanced Graphics and Animation,  Artificial Intelligence (never again) and physical computing (playing with an arduino, basically) and pretty much just abuse the sh*t out of Java at every opportunity. I literally dream Java now, I have it coming out my ears. And no, I don’t drink coffee.

The education aspects aside, university was a great experience. I found it boring at times, of course. I pretty much became an alcoholic in my first term and attended one lecture, priorities bro! and met some pretty awesome people.

I never had any intention of going to university. Back in 2010 I was at my wits end with what to do with my life, relaxing was no longer a feasible option. So, I took my ass back to college and studied Law, Maths and Computing and met a pretty amazing girl. Of course, it pains me to say, we seldom speak now, but that’s the way the cookie crumbles. If it wasn’t for this magnificent, young woman, I probably wouldn’t have even bothered going to university. I mean wtf is “ucas”, that’s what I thought when I first heard it lol. But that loving peer pressure pushed me to where I am today and I’ll always be eternally grateful. Let’s call it the love of Mordor.

Anyway, the real reason I decided to write this wee blog post is 1) because I have a blog that I don’t use which is kind of stupid and 2) it’s been a while.

Finally, I think I’m gonna try to be a bit more active with the blog posting. I’m sure nobody reads this crap but it’s good to write your thoughts from time to time, for sure.

Also, totally graduating with a first 😀

Safe mode in Windows 8.1

So I decided to upgrade my graphics drivers and something went terribly wrong. Everything disappeared and the screen showed nothing but the cursor only if you moved the mouse.

At first I thought “it’s cool, this shit happens when you update the ol’ gfx drivers…” Because it does. The only thing was after an hour there was no change so I held down the power button on my laptop until it turned off and then I fired she up again. To my dismay, Windows returned to that same lifeless screen I’d just described.

Unlike it’s predecessors, Windows 8.1 doesn’t have a safe mode so to speak. It’s an “advanced options menu” or something like that. But you can’t simply get to it by bashing the F8 key on start up. Apparently you can but you have to hold shift and bash the life out of your F8 key just for that tiny possibility of Windows detecting your distress and booting up the recovery options. Otherwise you have to be on Windows to be able to get to this menu. Either that or foresee your problem and plan ahead by creating a recovery disk. What an absolute plethora of hep-C-synonymous pain I’ve experienced. A headache, simply put.

Some machines have a recovery mode you can get to by hitting F11 but this requires your bios to be configured properly and that the said recovery mode actually exists. Your bios boot mode has to be set to UEFI and naturally, mine was. But another headache emerged when hitting F11 proved fruitless. Frantic yet tranquil searching for a solution finally yielded results when I switched secure boot ON (another bios option I have disabled for Linux to boot happily).

I had made it through a cluster fuck of stress and found my way to the coveted menu!

I am pleased to say that system restore has just finished and I now have access to my desktop again. It IS visible!

Moral of the story, ensure Windows 8 is set to launch its advanced options menu before you ever need it. Oh, also, make sure uefi secure boot is on if you’re trying to get to your system recovery menu via F11.

The reliability of Wikipedia (En)

The English Wikipedia was started in 2001 with the purpose of serving as a free content, web based encyclopedia that is accessible to all who have access to the internet. It primarily serves as a reference to almost anything one can think of. For example, if you happened to be unfamiliar with the Chernobyl Disaster then you would be able to find plentiful information via Wikipedia (among other sources). Wikipedia allows anonymous editing and submission of articles which means that anybody can contribute to the content of this encyclopaedia; information may also be removed.

There are several advantages and disadvantages to such an open system.

As already mentioned, anyone can add and/or edit articles which means that a collective wealth of knowledge can be consolidated and viewed from a central location. This provides the potential to have all knowledge pertaining to a particular subject, topic or otherwise unfamiliar subject to be available to anyone who seeks it. This also provides the ability for global collaboration – people in Australia can just as easily contribute to the work of someone that originated in the United Kingdom. Such editing is instantaneous and thus there is no need to wait for these edits to be approved or published by an administrator or publisher. Finally, using Wikipedia is a simple task and can be learned quickly therefore providing wide access to publishing for non-technical web users.

That said, certain advantages may prove disadvantageous from an alternative perspective. In particular, the potential for disinformation, spam and vandalism is present due to the simplicity of being able to edit documents. Vandalism can include inaccurate information, spam posts or simply the removal of information but due to the fact that Wikipedia records every change made, the ability to revert to an article’s pre-vandalised state is usually a viable solution.

Wikipedia is generally reviewed as a reliable source of information but because of the open nature of creating content, inaccuracies and misleading (malicious or otherwise) content can sometimes be presented. Being maintained by the public, these erroneous scenarios are usually corrected quite quickly and the majority of users will never come across such a situation. There are some controversial issues surrounding the use of Wikipedia in the past which can be viewed here. This link details concerns such as the quality of writing within articles, vandalism and the accuracy of information within articles.

Overall, the concept of Wikipedia is brilliant and, for the best part, works very well but as with any open technologies there will always be issues. It is reasonable to assume that generally, Wikipedia will provide you with accurate and relevant information and corroborating such information with other online sources is a task not too difficult for anybody with the computer literacy to make it to Wikipedia. Despite what Wikipedia has to offer, it is always wise to cross reference information with several sources.

Piracy and freedom on the internet

Over the last several years, combating piracy has been at the forefront of government objectives, at least in the USA and the UK. Speaking as a citizen of the UK, the effects can’t really be felt unless you intend to break the law (steal some movies over the internet or something). The concern, however, is how far will it go? Will these new obsessive objectives extend beyond their intentions and impede on ones free speech and does anybody really have the right to try and tame the internet?

Several high profile actions have occurred in the UK recently, most notably the requirement of ISPs to blacklist particular websites on order of the Courts. These orders are primarily issued to prevent the theft of intellectual property but as noted on Wired.co.uk’s take on the situation, these orders are influenced solely by private corporations and associations such as the BPI. This is, of course, a major blow to the piracy societies on the internet but it is in no means an end to the piracy problem – just a slight setback. It is also incredibly undemocratic. We have no explicit law being broken other than a breach of copyright and yet unelected persons and bodies are directly influencing the outcome – taking their case to court and seemingly having the courts issue orders left, right and centre that demand that ISPs block the stated websites with no input from society.

I don’t like it but I do understand. The censorship of pornographic and otherwise adult material is also kind of understandable. I just find it hard to wrap my head around any form of censorship, it shouldn’t be happening.

Take a look at this news article which describes David Cameron’s plans to require all ISPs to censor pornographic material to ‘protect’ children. Fair enough. But it’s a major invasion of privacy, for one, as internet customers would be required to request the removal of the filter from their ISP account if they so wish to view such material thus exposing their private habits and/or interests and two – it could get a lot more out of hand. It’s the start of censorship. These internet filters are brazenly implemented with full public knowledge but do the public really understand the gravity of what is happening? Such filters can just as easily be used to target anything the government deem unfit for society to view, irrregardless of whether or not the content is immoral. More over, individuals should be allowed to access content as they see fit. Once upon a time the internet was a free place and, thankfully, it still is for the most part but the potential for this to just wash away in the blink of an eye is upon us. It’s like Pandora’s box has been opened and we just have to wait and see what’s next.