How to hack (not really, how to program but I figure this title will get more hits)

Standard

So programming, basically computers are just big calculators, they cannot do anything except add, compare and store values. Programming is the process of writing many of these basic commands in sequence to instruct the computer to do something. Although at the core all a computer can do it add, compare and store numbers when you are programming you are able to perform many more tasks, this works because code which is the actual programming text works for you, other code can interoperate your code and simplify other difficult tasks for you.

So you want to learn how to actually program, I am going to show you the basics of python. Python is an interpreted, high level language (don’t worry about what that means if you are just learning, say it to people to make you look smart and even better them look stupid).

To get started download Python and save any “scripts” (programs) and text files with the .py extension, you should then be able to open them with the python interpreter and run them.

Alright onto the actual code, programs consist of commands, the first of these commands is variable assignment, so variables are like boxes, the box can hold anything and the contents of the box can change. Like x in math.

myFavouriteNumber = 8

So this will assign 8 to the variable myFavouriteNumber, anytime myFavouriteNumber is written the value 8 will be used.

So we have our special variable, we want to show the user. Python provides a function just for this, the print function displays and variable passed to it on the screen. This opens another new topic, functions. Functions are smaller pieces of code that perform a specific tasks. You can run this code with a command structured like this

functionname()

functionname is whatever the function is called, inside the parentheses you include comma separated values or variables which are given to the function as it runs. The function we are interested in was print remember? So if we want to display the number 10 we write

print(10)

Simple right? So what if we wanted to print our favourite number. Well as I said before, variables hold values which are given any time a variable is used, so the command

print(myFavouriteNumber)

Will display 8 on the users screen, make sense?

So what if we wanted to display the actual words ‘myFavouriteNumber’ on the screen, well that brings us to our next type of data. Strings.

Strings are a series of characters which is a fancy way of saying a string holds words.

When we want to represent a literal number we can just type the number as we did earlier when defining myFavouriteNumber, when representing literal strings we must use quotation marks to specify to the computer that we are trying to give it a string instead of a command.

myFavouriteWord = “slut”

So if we run the command

print(myFavouriteWord)

Then the program will output the word ‘slut’ (without the quotation marks) remember that the quotations marks are only to tell the computer you are writing a string, they are not actually part of the string.

Variables are not required for strings, same as numbers, so we could also write the line

print(“slut”)

And we will get the exact same result.

So this shows that variables here are somewhat useless. Where variables come in handy is where the value is not known at any one point throughout the program.

So I will introduce a new function; input the input function pauses the program and waits for the user to type some text in, which is then read into a string.

so the function looks like this

answer = input(“What is your name? “)

So this shows a new feature of functions. Return values, functions often have a result or value to give back to the program, in the case of the input function the value that the user typed in is returned. Return values become the value of the function when executed. This may sound complicated but think of them like variables, where ever a variable is used it’s value takes it’s place. Same goes for functions, when a function is hit it is run and its return value takes it’s place.

The example input function has an argument passed to it, which is a string (“What is your name? “) this function prints the string at the beginning of the line waiting for the user to type in a response, it is there to pass a question to the user to respond to. The return value of the function is then stored in answer once it has run.

so lets write a little program with the knowledge we have.

question = “What is your favourite colour? ”

theirFavouriteColour = input(question)

print(“Your favourite colour is”)

print(theirFavouriteColour)

So this is pretty basic but have some fun with it, I will post another tutorial at some point over the next week. Enjoy.

All about GPS (Global Positioning system) (That thing that tells you where to turn in a weird voice)

Standard

The Global Positioning System (GPS) is a series of satellites which communicate with GPS receivers, used to find precise locations on the globe.

Originally the GPS was created in the United States of America for military 2 purposes. In 1973 the decision was made to create a satellite navigation system based on the existing systems available at the time. This included TRANSIT, TIMATION and 621B (Of the US Air Force and Navy). Between 1974 and 1979 the system was developed, refined and tested. Tests were performed before any satellites were launched. This was achieved by setting up transmitters on the earth’s surface, these were called Psedolites (Pseudo satellites). Some of the first satellites launched doubled as peacekeepers, containing sensors used to detect atomic explosions all over the world.

Throughout this time GPS signals are publicly available to anyone with a GPS receiver, however, in order to hold military advantage, the US Military throttles and limits usage by civilians, this is called ‘Selective Availability’. During the Gulf War, in 1990, Selective Availability was disabled temporarily due to the limited supply of military GPS receivers, requiring the use of civilian receivers.

In 1995 ‘Full Operational Compatibility was announced. This publicly stated that the GPS systems in place were fully operating to expectations giving accurate information where expected.

In 2000 Selective Availability was disabled, improving accuracy for civilian users from about 100m to 20m. Current technology, including new systems such as differential GPS users are able to achieve an accuracy of 3-5m.

GPS uses high frequency, low power radio signals, which are transverse waves. These waves do not require particles to move and travel at the speed of light. They are produced via finely tunes electromagnetic pulses with predefined amplitudes which will not bombard the Earth with electromagnetic energy but will be enough to penetrate the atmosphere and retain readable data. The frequency of these waves is changed to transmit data (frequency modulation). Power to the satellites is generally provided via solar panels. These waves have two main purposes; the first is to transmit data. GPS satellites transmit down a sequence, which is seemingly random data; a seeded data generator creates a random, but predictable, pattern of data. This is reset at a certain point in time, for example midnight. This data is useless by itself, however, being predictable data, it is possible to calculate the precise distance from a transmitting satellite if it is known exactly what should be transmitted at any one point in time. It is possible to calculate the offset of the wave pattern and therefore to know how far the signal is lagging behind. With the knowledge that radio/electromagnetic waves travel at the speed of light (that is about 300,000 km per second) and using the time that the data has taken to travel from the satellite to the receiver the distance can be calculated. 300,000/time = distance in km.

One issue with this system is the prediction of the pattern. To accurately know what the current pattern is the clock at the receiver must be exactly the same as the clock controlling the computer on the satellite, down to tiny fractions of a second, Impossible without atomic clocks worth between $50,000 and $100,000 each.

It isn’t feasible to charge $50,000 for every phone and GPS unit. The solution is quite a clever one. Satellites themselves all contain an atomic clock which keep perfect time. Receivers have clocks that only keep approximate time while being constantly adjusted by the GPS receiver computer. The exact time is calculated by considering the several different radio waves coming in from GPS satellites and calculating what the precise time must be for the data pattern to line up with the other patterns being received. By receiving multiple signals the receiver can calculate the offset for the time taken to travel the distance.

Now that the distance between satellites can be calculated it is possible to determine location on the globe, this process is called triangulation. Looking at 2D triangulation this is easier to see, if the distance to two known points is given then there are two possible locations that the receiver can be in as shown below.

GPS_2d_2points

The receiver can be on either of the two points where the lines cross. If a third known distance to location is introduced then only one possible location remains.

GPS_2d_3points

3D Triangulation, the technique used for GPS location is quite similar to this. However, since locations are being made in 3D space there are spheres of known distance instead of circles, this is harder to visualise but means that when two distance spheres are known there is a ring of possible locations where these spheres overlap. Introduce a third and reduces to exactly two possible points.

GPS_3d_3points

Having two points is not an issue as only one of these will ever be located within the Earth’s atmosphere. The receiver automatically discards the location in space. This shows that with the knowledge of the distance of 3 satellites it is possible to find a single point of location in 3D space on the Earth.

One thing this requires, which has not been covered yet, is the exact positions of the satellites. Since satellites are continuously moving in orbit around the Earth it is not enough to simply have a known table of locations programmed into the receiver. Helpfully it is possible for physicists to predict quite accurately the position of a satellite at any one point in time throughout its orbit. This data is programmed into each GPS receiver and is called an almanac. Slight adjustments sometimes have to be made due to external factors such as the pull of the moon; these changes are monitored by the U.S. Department of Defense and beamed out to GPS receivers via the signals being sent from the satellites themselves.

Although only 3 satellites are technically required to determine location many GPS receivers will only consider a location valid if it has 4 signals that all line up with the information calculated, this ensures signals that are being corrupted or delayed by the atmosphere do not give faulty results.

GPS is a major part of today’s society; it is used for a huge range of different purposes; from perfectly aiming missiles to helping find a new mate’s house. GPS was originally designed for military uses it has, since being open to the public, become a heavily relied upon means of tracking and locating. While still being used for military purposes these large scale systems are also being used for the benefit of the world. Systems such as physical post and global trade use GPS for locating packages and shipments, Ships, cars and even aeroplanes use GPS. Aeroplanes use GPS as a second, backup altimeter because the GPS system can he used to determine altitude as well as location.

This system isn’t always so adored by the public though, systems such as phone tracking, reliability, constant radio waves and security of transmissions are constantly being questioned. Today, many smartphones have built in GPS receivers alongside a constant Internet connection thanks to HSPA+, 3G and LTE. This allows devices to be found if they are lost by simply logging into a website which will then show the phone’s location on a map. This is often considered a bad thing and many people disable this feature in fear of these websites being ‘hacked’ allowing them to be tracked as they carry their phone around throughout the day. The same goes for signal interceptions, although in reality intercepting signals in order to locate someone is next to impossible it is still feared by many people, sometimes enough to disable GPS on their devices entirely. Finally, as is always complained about at some point, many people considered the constant exposure of radio waves being transmitted all over the Earth is bad for people’s health and damaging to their brains. Again, due to the low energy of these waves there really is no harm.

Overall GPS is a highly beneficial system, making even the street directory obsolete and allowing individuals to track back to their lost phone in the middle of the city. While there are fears and stigmas associated with related technology the world has accepted GPS quickly and it has become a central part of Western civilization. This has impacted sociality in a positive way, pushing globalization and simplifying otherwise impossible tasks.

Andriessen, M, Lofts, G & Morante, R 2004, Preliminary Cource Physics, John Wiley & Songs Australia Ltd, Milton Qld 4064.

Bellis, M n.d., History of the Global Positioning System, Inventers.About, accessed 20 February 2014, <http://inventors.about.com/od/gstartinventions/a/gps.htm>.

Brain, M 2006, How GPS Receivers Work, HowStuffWorks, accessed 20 February 2014, <http://electronics.howstuffworks.com/gadgets/travel/gps1.htm]] >.

GPS Accuracy, 2014, Spaced based position navigation & timing, accessed 21 February 2014, <http://www.gps.gov/systems/gps/performance/accuracy/>.

History of NAVSTAR GPS, 2009, Kowoma, accessed 19 February 2014, <http://www.kowoma.de/en/gps/history.htm>.

Slow bar

Standard

America managed to pull of the idea of a slow bar and make it work yet Australia hasn’t. For those who don’t know, a slow bar is manual filter coffee brewing process, such as Aeropress and pour over.

Subsequently, I’m curious as to how this can be a viable path within Australia. The concept behind waiting five minutes and paying five dollars is out of reason of most consumers. This means we either need to start making consumers aware of the experience we can offer. To do this would require really narrowing down the market and choosing areas easiest to sell the “experience” to.

The people most likely to adapt are inner city drinkers who have espresso or long blacks regularly.The whole point of having a slow bar is to show the versatility in coffee and what it can offer to the customer ..

.. i will follow up later with either serious coffee industry stuff or just rants

QR codes

Standard

Preface: I have left QR codes with a link to this article in random public places as a test to see if people do infact scan random codes, if you are here as a result of scanning a code, I am sorry if I offend you in any point of the article (Also this kinda proves a point you have no idea what you’re visiting when you scan a code)

qrcode.20746297

So this morning I saw a poster, with basically a title and a QR code. This is possibly the worst marketing since Buried in Verona’s Facebook page (Honestly, I know about your ‘new’ single I am Hate, It’s been out for 18 months now stop spamming me) But this poster, really, do you expect me to stop, astounded by your generic title, pull out my phone, download a QR code reader (does anyone actually keep those apps?) and scan your code just to get a link to your website, which is probably not mobile ready, and would have taken half the time to just type in the damn URL, in the end I don’t want your extra absorbent tampons, I am a teenage boy I just had no idea what I was scanning because your freaking poster had no freaking information in it about your freaking product.

Ok, calmer now.. sorry about that. All that goes through my head every time I see your poster with a large QR code on it, stop doing it, They have their uses, giving me a 10 character url is not one of them.

Let me list some real and incredibly stupid uses for QR codes I have seen

  • All posters and advertisements
  • The side of coffee cups (to show give a link to their website, why do they even need your website idiots)
  • Art assignments (literally paintings with QR codes next to them, just print the bloody information)
  • Product boxes (really? What information do you need to give me which you could write on the box)
  • The side of a freaking racecar, it is going 300km/h how is anyone meant to scan that?

There are actually good uses for QR codes, they aren’t always crappy (however they are most of the time) I have seen some excellent uses for these things. I think one of the best was a digital coffee stamp app, you know those systems where you buy 10 coffees and get a free one? Like with the cards and little stamps? Well a digital version of them, it was a brilliant idea. Basicly you downloaded this app, which worked for multiple coffee shops (I love it when the world does things right).

When you bought a coffee you simply opened this app, which opened directly to a scanner, scanned the code on the cup (individual for each cup) and your free coffee was counted, when you had earn’t your free coffee redeeming it was as simple as showing the person serving you the code given back from the app, which they mark off and you get a free drink. This was brilliant, a use of a QR code which actually simplified a general task.

Another technology with such potential, being used for all the wrong reasons and making life harder rather then simpler. PS if you came here via a link you scanned with your phone I take back everything I said, maybe people do actually take the time to do these. However I don’t recommend littering the world with QR codes to your website a valid method of advertising.

If you would like detail on how QR codes actually work, or if I haven’t convinced you how stupid they are most of the time check this post out http://gizmodo.com/5969312/how-qr-codes-work-and-why-they-suck-so-hard

Edit: I have forgotten a major use for these things, sending URL’s and app download links to mobile phones. This is a brilliant use, I have nothing against that, however I generally still just iMessage myself the link (someone really should create some sort of really easy method of sending links to phones)

Internet filtering

Standard

Most schools and many workplaces filter and restrict their internet, this can be as basic as denying access to a few specified websites, often social media sites such as Facebook or Twitter and look that isn’t a bad thing, if you’re at school or work there is rarely a need for social media websites.

I don’t need access to blocked websites at school, however I’m hardly using my time well already, last week I made a 250 megapixel image of the Canadian flag. I might as well be wasting my time talking to other people on the internet. Basically I think internet filtering is necessary because people cannot just do what they are supposed to do, but hey, they aren’t gonna stop us anyway.

I first got around my schools internet filtering when I was in year 6 by creating a simple PHP script which was something similar to this.

echo file_get_contents($_GET[‘url’]);

I hosted this on my computer at home and opened port 80 on my router. Look I am aware how incredibly insecure that is, but really, if someone hacked me in year 6 what are they gonna find? Flash games and homework about basic addition.

I worked on this script over the next 18 months and eventually had a fully fledged PHP web based proxy, replacing urls, proxing REST requests etc, I have since learnt that there are scripts that do this perfectly which you can just download and run (http://www.glype.com/)

Our internet filtering now is much stricter, packet sniffing and inspecting all http traffic, you even have to install an SSL certificate so it can inspect your secure traffic (if a packet is encrypted without the certificate it is rejected) So after tethering to my phone for internet for a few weeks I found a flaw which I could exploit, and I’m using that flaw right now, port 21 (Unencrypted FTP) packets are all let through (they are filtered by protocol, http proxies never work) SSH works through this port, once I found this the solution was simple: a socks proxy through port 21. In system preferences on a mac you can make all traffic via a certion internet connection forward through a proxy, I have my computer set up forward all traffic on the school wifi through a socks proxy on localhost. I use sshd to create a local socks proxy, forwarding traffic through the ssh tunnel.

The command is a single line on the client machine is simple

ssh -D10800 -p21 [USERNAME]@[SERVERADDRESS]

Anyway, just thought I would share my solution to internet filtering here.

For anyone tl’rd’ing firstly don’t be an asshole I wrote this whole thing so you could do the wrong thing, otherwise heres the basic solution

  • Open ssh server over unfiltered port (port 21 for me)
  • Use sshd to create a socks proxy and tunnel the traffic through the ssh server
  • Forward machines traffic through this proxy server

Epson Printers (please don’t sue me)

Standard

Ok Epson. We really did have a good thing going.
Your 3200 series printer has served me well in the previous months, I like your typeface, and more importantly, that Honda NSX you guys sponsored in the 2008 Japanese Super GT Championship looked amazing.

But last night, that all changed.
This is the situation;
It’s 3am. A major chemistry assignment is due in approximately 6 hours time. I’m sleep deprived, mixing coffee with Red Bull, and desperately trying to avoid procrastination.

I finish the assignment. It’s done. All that’s left is to print.
This is where the problem starts.
The printer spits out a single page, before reporting a “Paper Jam”, immediately halting the print process. Fair enough.
However, on closer inspection, it become clear that there is no paper jam. The paper is loaded in the tray as per usual.

Forty Five minutes.
It took me forty five minutes of screaming at the printer, opening and closing the printer options panel, and staring at the distinct lack of a paper jam. I’ll admit, this was hard to deal with, but eventually, it roared back to life. The assignment was back on track.
But no.
As the final page spewed into the document tray, one thing became clear.
There was no ink.
Shit.

After searching desperately through drawers of crap, and perhaps sobbing a little, more cartridges were found, Hallelujah. The torture was over.

No it wasn’t. My technical understanding of printers is limited, so bear with me. As I tried to replace the cartridge, certain that victory was near, came a whirring noise. You know the thing that holds the cartridge? Yeah. It came to life, and suddenly decided to move to the left at like 800 miles an hour. This sudden movement caused a sharp edge of the holder to run against the palm of my hand, creating a cut, which proceeded to bleed absolutely everywhere, including in my tea. My freaking tea.

As the clock ticked past 4am, muffled sobs could be heard, and a figure could be seen curled into the fetal position, seeking refuge under a desk.

In summary, Epson printers singled handedly ruined my life, in the space of about two hours. I vow not to use any of their products ever again until at least this time tomorrow.

Moral of the story:
The assignment was meant to be submitted electronically, and I am the purest form of stupidity.