Thursday, 24 March 2016

The final semmester of year 1

Sad face :( 

Who would have thought 21 weeks could go so fast.

Happy face :)

Despite our ever so slightly cramped time frame and manic rush to get a powerpoint together, it seems the group and myself did it. Our presentation had lots of useful goodies, such as hacking techniques, digital forensics and HMAC... no doubt some of this will appear on my blog a little later.

It's been a little cray cray, but I've learnt a lot. I ended going from somebody being scared of linux, to somebody who uses it as a daily driver. Sure, if you're stuck on combersome windows, it's a change but a well worth it one.

I've learnt not to push to the main thread of github repo without checking the code works first... oh and on that note, I also learnt the hard way writing notes helped. I got so into some code (without commenting) it was easier for me to rewrite the whole program that actually work out what the heck I'd written.

Backup. Backup and Backup. So when your BRAND NEW £1300 laptop HDD dies, your things are quickly accessible. FYI - think twice before getting an MSI laptop too.

Never rely on a Mac in an important presentation, it probably won't work. Just... don't rely on a mac (if it works, it probably is only useful for drawing pretty pictures)

Question your lecturers. Unless they give you nasty looks.

Oh. And have fun in the first year.

Monday, 21 March 2016

Installing native linux

Installing linux on an Acer Chromebook C730

Any Linux user can usually recommended it for it's super efficient CPU usage and RAM usage ... and even if you can't, because it's linux, you can usually do some fine tuning.

Those of you who have installed linux natively, good job, but lots of us are stuck with using crouton. There's nothing wrong with that, but this usually involves a laggy chromeOS experience and your crouton Linux install can eat into your RAM. When you've got a chroot running with a GUI, you're only left with about 1GB of RAM to play with on either side.

This is where running native linux comes into play. Don't for a minute think you're making a sacrifice in doing this, you've still got access to chrome so all those chromeapps and themes you used are still available. Plus all the other goodies that come with linux!

I'm sure if you haven't got a C730, your steps aren't doing to vary that much, but I'm not responsible for anything.... even if you're trying it on a C730.

Prerequisites:

  • Access to a Windows PC 
  • Developer Mode enabled
  • A USB thumb drive (4GB or more is recommended) 
  • Your write protection screw removed (google for a guide)
  • Common Sense
  • A little bit of luck
Getting started:
If you're running a C730 and you've tried to running linux, you've probably guessed the reason for crouton is because the BIOS that ships with these laptops doesn't support booting off a USB. We need to remove the write protection screw and flash a new BIOS to do this. 

PREPARE TO LOSE YOUR CHROMEBOOK DATA

Flashing the new BIOS: 

We are basically going to follow this guide here

  1. Hit Cntrl+Alt+T to get to a developer shell
  2. Type 'shell' to get to a shell
  3. AGAIN, I AM NOT RESPONSIBLE IF THIS DOESN'T WORK
  4. Use this code:
cd; rm -f flash_chromebook_rom.sh; curl -O https://johnlewis.ie/flash_chromebook_rom.sh; sudo -E bash flash_chromebook_rom.sh

(I found it easier to seperate each command, depending on your configuration, some may not be necessary)


Using the code above will give varying outputs, depending on your model. For my C730, I hit option 2. You basically want the option that mentions about modifying. This script tends to be fairly self descriptive on how to use when you first run it. 

You should see the message mentioning if this has worked, you should successfully be able to restart. It's a lie, so now is the time to get everything you need off your chromebook. Make sure you can access this guide on your secondary computer accessing windows as your chromebook is going to be out of action for a bit. 

DO NOT PANIC! 

You will probably certainly find your chromebook no longer boots into ChromeOS. However, when you turn it on, you should now get into SeaBIOS. You were warned you'd lose everything. 

Creating a bootable linux USB:

Switch to your Windows PC :) 

Next we need to create a linux usb. Now, I highly recommend Rufus or anything that will use a DD imaging process, which copies sector by sector. If not, you may get an error saying a live file system can't be found. I went for Rufus; it's free and easy. You can grab it here

It should take no installing and should just run. It may ask to check for updates, select as you wish. When you get into the program, you should see the little image of a disk (right hand side, half way down the window). Hit it. 

You may want to do some Googling about what distro you like best. I know arch works, but right now I'm using GalliumOS for several reasons:
  • Nice graphical install 
  • Based on Xubuntu
  • Uses XFCE. 
  • Based for ChromeOS hardware and included patches that other distrubutions might not. 
  • Grab a link here
UPDATE: Gallium is the only OS I've tried that has full support for key mapping and touchpad for the c730. Gallium also comes with a pre-configured powertop to get the most juice from your chromebook. 

Select your downloaded ISO in explorer window and hit okay. Rufus will do the rest of the options for you. When you click start, Rufus will mention something about grub, just click okay. When it asks you about the mode you want to write in, select DD. You'll find this is the one below the recommended option.


Installing linux:

This bit is a little tricky. I found my chromebook to be very temperamental. I suffered keyboard freezes or no response, not seeing my USB drive or skipping to boot to the first HDD. 

If you experience this problems, it a bit hit and miss, but it's an art. Here are some things that worked for me:
  • Booting with the USB in and then doing a cold shutdown
  • Doing a cold shutdown
  • Putting my USB stick in quickly after boot
  • Going full crazy and hitting every key on the keyboard
  • Crying (it helps) 
Depending on the distro you selected, your install process will be different. Gallium is very nice and smooth. When you come to the time where you select what disk to install on, it should be easy enough to work out which disk it is by size. Select 'Use the whole disk option' which will overwrite the existing chrome installation. 

Problems:
If you have problems, Google is probably your first port of call. I'm not expert and these are the steps that worked for me through experimenting. It's easy to ruin your chromebook or brick it, so bear that in mind and don't rush the process or you're playing with fire. If you can't find anything or need any of the steps clarified, feel free to comment below. 

Wednesday, 16 December 2015

I got bored

I had a little spare time and I got bored (and if you look at my code, I was feeling lazy too) so I created a quick christmassy python app.

It draws a christmas tree! Happy days.

Requires:

  • sys
  • time
  • os
Download it here! 

Written in python 3.5

Saturday, 12 December 2015

Setting up an OpenVPN server

VPN (Virtual Private Networks) are lifesavers for people like me. Or they just make you super lazy... either way, that tends to be the same thing.

A virtual private network, lets me connect into a network from anywhere around the world, but appear as if I'm physically there on the network. This means that subnetting and IP addressing rules of you computer will adhere to the remote network you're trying to connect to. This is useful as I can then connect or remotely manage any of the computers on that network without actually needing to be there.

To set up my own private network, I used this instructions as a base guide. Thanks internet, for helping me out of my mess yet again!

http://www.thegeekstuff.com/2013/09/openvpn-setup/

Thursday, 10 December 2015

Setting up RSA keys for SSH

SSH is a wonderful thing. It allows us to emulate a terminal window, while being at a computer the other side of the world. I guess that's why so many people around the world use it everyday.

general syntax for connecting via ssh is ssh [parameters] username@domain.com

While this is very easy to remember, if you use this a lot it can get a bit tiresome. So to make it even easier we can set up a key pair that means we no longer have to put the password in. To do this, I followed the instructions on this website:

https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys--2

The good thing is, now I can also automate ssh connections using bash scripts, without having to type the password in every time. It also means peaking eyes don't get a chance to see me type the password either!

Applying this:

If we look at this script, we can now see an example of just how useful it is. 

As the credentials are securely stored we can connect to 'username@domain' without putting any credentials in. The automation means that this is done ever 2 minutes (120 seconds). I can now logon to 'username@domain' and will be able to establish a connection from anywhere. 

This is really useful as if I needed physical access to a network, it would be possible for me to put a little linux machine that reverses off my own server so I could connect remotely. 

Monday, 7 December 2015

turning off ASLR(aaaahhhhh!)

For one of my uni projects, part of my contribution was to set up a debian virtual machine. The setup of this machine was very similar to my kali installation earlier on this blog. However, this machine should be vulnerable, so I disabled a very important feature: ASLR.

Address space randomized layout basically means memory addresses and locations get randomized. This stops an everyday hacker from knowing the locations of executable code that get loaded from the OS in memory; in turn, this means it makes it harder for a hacker to "get shell". This makes something called 'zero-day-attacks' harder; a vulnerability in a OS could be discovered, but the user would not know how to access where that vulnerability was loaded into memory.

I have specifically turned this feature off in a debian machine, but nearly every operating system today will use this feature to prevent hackers from very simple exploits such as dropping a shell, buffer overflows and buffer underflows.

To turn this feature off on a linux installtion, you can follow these steps I found off the internet:


  1. Open a terminal
  2. "su" to switch to the super user
  3. "nano /etc/sysctl.conf"
  4. at the very end of that text file add "kernel.randomize_va_space=0"
  5. hit 'ctrl+x' and hit y to save and then hit enter to save
  6. back in your terminal window type "sysctl -p"
It's now turned off permanently. As well as being useful for hacking, this can also be useful for debugging your programs as variables in your programs should be given the same location and you can directly see their values in memory! 

Sunday, 6 December 2015

Things I've learnt this semmester


  • Linux is not a scary place: in fact, when you get over a fear of using the command line, it's fantastically brilliant at getting it do what you want it to do
  • Computers are very complicated: it's amazing how you'll use a computer everyday and not realize everything that goes on in the depths. Since starting my course, I've learn about machine code, assembly, registers... and trust me, it's computerception
  • People (including myself) are stupid: we put so much content online and don't realize just how easily accessible that information it is. People should always be so conscious of where they put their details in... nearly everything is networked these days. 
  • It's not all about specs: I used to think specs were everything, i7s... tons of RAM, but at the end of the day, it's really what you do with it. There's a way in which my beaglebone can provide me with more fun than my super-powerful gaming laptop ever could. Walking round with a tiny computer in my pocket is also pretty nifty too, huh! 
  • So far, I know this is something I really want to go into. Something about securities and vulnerabilities excite me. I want to find news way to explore exploits and be able to create new ways of protecting people from that. It's a subject I wasn't so sure about, but at least I've reached the end of the semester and I want to continue with!