Archive for the ‘Tutorials’ Category

Emulating *nix Shell with Windows Command Prompt

Thursday, December 3rd, 2009

Ever tried to ls or rm under Windows?

With just a few minor adjustments the Windows Command Prompt (cmd.exe) can emulate the behaviour of your favourite *nix shell. Please note, this isn't a full emulation method - the existing Windows commands are being manipulated to appear as their *nix shell counterparts.
(more...)

Installing PHP 5.3.0rc2 for XAMPP (Windows)

Saturday, May 23rd, 2009

Having been unable to find a definitive guide to upgrading the XAMPP PHP version to PHP 5.3.0rc2, I decided to improvise on a guide for installing the PHP 5.3 alpha.

My guide will describe how to upgrade the current XAMPP PHP version to the second release candidate of version 5.3. It is expected that this method will also work for the third release candidate when it is released later this month.
(more...)

Repairing broken USB partition tables

Thursday, December 4th, 2008

While trying to use my 16GB USB flash drive as a raw-disk for VMware, I managed to corrupt the partition table. This rendered the drive useless for data storage. As none of the information contained on the drive was useful, it seemed that the best solution was a straightforward partition table wipe and rebuild. This can be difficult on Windows as Control Panel->Administrative Tools->Disk Management does not allow the deletion of the primary partition.

Many Googl'd solutions involved rebooting with one repair/installation disk or another, however I've found a quicker way...
(more...)

Ubuntu broke my MBR!

Monday, October 27th, 2008

When installing Ubuntu on to a USB stick it will overwrite your system disk MBR. This is a significant problem for those with multi-boot or a Windows installation (as the system disk can no longer boot without putting in the USB stick each time!). The following is the account of my little adventure in to repairing my laptop disk MBR...
(more...)

Partial RAR extraction using WinRAR

Saturday, October 4th, 2008

WinRAR allows users to split file archives into smaller pieces (a feature present in most major archiving software these days). It is sometimes the case that one or more of these pieces are missing, and as such the archive cannot be completely reassembled. This tutorial shows how to partially recover files from a RAR that does not have all pieces present.
(more...)

EXIF and PHP exploitation – The Truth

Wednesday, May 21st, 2008

Introduction

After reading through a couple of tutorials describing the ease with which PHP can be included directly from the EXIF data within a JPEG image, I became suspicious. Surely my eyes deceive me? Is this a late April Fools'? My first point of call was Google - which provided me with a wealth of information on EXIF functions from within PHP, but very little regarding this particular vulnerability.

There was nothing for it... time to jump in and see what the fuss was about!
(more...)

‘Hiding’ information using ADS

Tuesday, April 8th, 2008

Introduction

This tutorial will explore the potential for using 'Alternate Data Streams' (ADS) to store information on an NTFS partition. All of the steps detailed below can be accomplished directly from within Windows.

Theory

Files act as pointers to physical data on a storage medium; they are a convenience, a way of managing information on a computer as discrete units. It should be this fantastically simple - one pointer for one file - but it seems Microsoft had other ideas...
Macintosh computers use a different file system to Windows computers. It was decided that NTFS should be able to emulate some aspects of the Mac file system to improve file compatibility. As a result, it is possible to 'attach' data to a file in a way that is not visible to users (oh dear!).

Getting your hands dirty

  1. Load up a command-prompt Window (Start->Run->'cmd').
  2. Create a file to run this demonstration on. In the console type: echo Hello, World! > test.txt.
    (The file 'test.txt' now contains 16 bytes of information. This is the default data stream)
  3. In the console, enter type test.txt to show the information in 'test.txt'.
  4. Let's hide some data! In the console type echo I am hidden! > test.txt:hidden.txt. Notice the colon (:) - this is very important!
  5. If you repeat step 3, you should only see 'Hello, World!' printed to the console. Check the properties of the file using Windows Explorer and you'll arrive at the same conclusion, the file still contains only 16 bytes. You could even enter in type test.txt:hidden.txt to try and see the text in 'hidden.txt', but it will return an error. Where is the hell has the information you just entered gone?
  6. To reveal the contents of 'hidden.txt', type more < test.txt:hidden.txt in the console, et voila - the magically disappearing information has made a miraculous reappearance!
  7. The file 'hidden.txt' is now linked with 'test.txt'. You could say that 'test.txt' is acting as a pointer to two data streams. Furthermore, if you copy 'test.txt' to another folder - 'hidden.txt' is copied with it!

Conclusion

The above is a basic demonstration of how ADS can be used to store hidden information. The article at governmentsecurity.org goes on to explore how an executable could be hidden within a file too. I've written a small batch file that attaches a user-defined message to itself (using ADS) and presents it using notepad. To remove the hidden file, you can either try the method suggested at gov.sec. or just delete the batch file itself!

Download files

ads_demo.rar - extract and run.

Write console text to a file (Windows cmd.exe)

Wednesday, March 26th, 2008

Writing directly from the Windows command line to a file might not be something you need to do very often. The famous black and white console is better suited to serving system commands and file operations than being a stand-in for notepad. However, it is sometimes useful to have the option of writing multiple lines of text to a file directly from the trusty prompt.

Method One

This is suitable for creating/overwriting a file with multiple lines of text.

copy con SOME_FILE.txt
Type your text here
You can even have multiple lines!

When finished, press CTRL+Z to confirm your action (or CTRL+C to cancel) and ENTER.

If you want to append some text instead of overwriting it completely, follow as above but using:

copy SOME_FILE.txt + con

Method Two

Open up the command prompt and type:

echo SOME TEXT > SOME_FILE.txt

This method creates/overwrites SOME_FILE.txt with the text you entered before the >. It is only suitable for entering a single line of text into a file.

As with method one, it possible to append text using >> instead of > in the command.

Spoof your network adapter MAC address under Windows

Sunday, March 9th, 2008

Overriding (or spoofing) your NIC / network adapter MAC address can be immensely useful for a number of reasons when using your PC on a large network. In essence you're creating a new identity for your box and any limitations associated with your previous MAC will no longer affect you! This tutorial will introduce some of the currently existing programs that can automate MAC address spoofing for you, as well as the necessary registry modifications to perform the task manually.

I came across MadMACs some time ago and it has become an invaluable part of my portable network security. Recently I've been looking to see what else is out there and found Mac MakeUp which provides a number of advanced features (integration with Wireshark, IP networking options, etc.) and has a straightforward graphical interface.

Both programs have been tested thoroughly and work a treat, but if you feel the only way to do a job properly is to do it yourself, then here is the step by step to DIY MAC spoofage:

  1. Click Start->Run and enter 'regedt32' (no ' marks) to start up the registry editor.
  2. Find the key:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\
    Class\{4D36E972-E325-11CE-BFC1-08002bE10318}

    and you should have a list of 4 digit subkeys (0000, 0001, 0002 etc.)
  3. Leaving the registry editor window open, go to Start->Run and enter 'cmd /k net config rdr' (no ' marks).
  4. The console should list your PC and network details. Right click the start of the text next to NetBT_tcpip (the bit that looks like: {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}) and right click->select 'Mark'. Drag over the whole text (as shown in the brackets previously) and then press CTRL+C to copy to the clipboard.
  5. Go back to the registry editor and click on the first subkey (i.e. 0000).
  6. Click menu Edit->Find (or press CTRL+F). Paste in the text from the console and click 'Find next'.
  7. It should return a result very quickly (if not - you've done something wrong!).
  8. Right click anywhere on the right hand side pane apart from on one of the listed items and choose 'New->String'. Give the value the name 'NetworkAddress' (case sensitive, no ' marks) then simply double click it and enter a new MAC address!
  9. Reboot your machine and enjoy!

For more information, check this Wikipedia article on MAC addresses.

Download videos from ALL flash streaming video sites

Thursday, March 6th, 2008

You read the title correctly, this tutorial will show you how to download videos from any site that hosts FLV streaming videos (e.g. veoh, youtube etc.) what's more, you don't need to use any annoying 3rd party software!

  1. If you're not using Firefox, download and install it.
  2. Find the video you want to download using Firefox. For example, from veoh.com. BUT DON'T WATCH IT YET!

    download_flv_1.jpg

  3. Open a new tab and type 'about:cache' (excluding ' marks) into your Firefox address bar.

    download_flv_2.jpg

  4. Copy the path (text) from next to 'Cache Directory' and paste it into your address bar. You should get a page like the one below.

    download_flv_3.jpg

  5. This is where it can get a little bit tricky, not too hard though :-) To make things easier it might be a good idea to clear your Firefox cache (click 'Tools->Clear Private Data' and make sure that 'Cache' is ticked). Go back to the tab showing your cache information and click refresh (or press F5).
  6. Now click on the video in the first tab and it should start to load. While it is doing this, switch back to your cache view and click refresh - the list of links/files should be growing! Keep clicking refresh (or tapping F5) until the list stops growing.
  7. If you look at the second column in the cache view, it will show the size of each file in the cache. Once the list has stopped growing, you should see most of the file sizes stay constant - except for one! This will be your video file.

    download_flv_4.jpg

  8. Switch back to the site containing the video (e.g. veoh) and wait for the video to load completely.
  9. Click on the cache view tab again and (without refreshing) right click and choose 'Save link as...' on the cache file that was growing in size.
  10. Rename the file to something useful and include .flv at the end of the file (like 'panda_sneezes.flv'). You can now watch this video from your desktop with an FLV player.

There you have it, 10 steps to download flash videos streaming videos from any site.