Using Robocopy to Copy Files and Folders While Maintaining ACLs

Robocopy is a Windows Server Resource Kit command line tool that allow you to copy files and folders while maintaining ACLs. In addition it allows you to copy files across networks with fault tolerance capabilities – if the network connection is disrupted, the copy operation will continue where it left off when the connection is restored. Robocopy will also allow you to synchronize local or remote directories and if changes are detected, only the changed bits in a file are copied as opposed to the entire file being copied.

How to use Robocopy to copy the contents of one directory to another while maintaining ACLs:

  • NOTE: Do not put a trailing backslash at the end of the directory paths. The destination directory does not have to currently exist.
robocopy c:\pathToSourceDirectory c:\pathToDestinationDirectory /E /SEC

Here is a link to a Microsoft article that talks about the GUI version of Robocopy: Link

Robo

C# – How to Create an MD5 Hash

MD5 hashes are useful for when you need a string of characters that will always be generated given the same input. MD5 hashes are used to uniquely identify files based on their contents and they have also been used to store passwords in an “encrypted” format.

A word of caution on using MD5 hashing to store passwords in a database is that there exists searchable online databases of strings to MD5 hash mapping which allow someone to do a reverse lookup of what a password is by looking up the MD5 hash to plain text password mapping. So if you are relying solely on a straight MD5 hashing to store you password in a database you may want to consider doing something else such as applying a salt to the resultant hash string before you store it in the database.

Here is sample C# code to generate an MD5 hash from a string:

string password = "foo";
System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
byte[] bs = System.Text.Encoding.UTF8.GetBytes(password);
bs = x.ComputeHash(bs);
System.Text.StringBuilder s = new System.Text.StringBuilder();
foreach (byte b in bs)
{
   s.Append(b.ToString("x2").ToLower());
}
password = s.ToString();

MD5 Algorithm

How To Open A Combination Lock With A Soda Can

The popular combination Master Locks are susceptible to being opened with a simple tool fashioned from an aluminum can. With this crude tool a thief can pop open a lock in a few seconds. Here is a video that shows how to construct and use this tool which is referred to as a “shim”:

Open A Combination Lock With A Drinks Can!Click here for this week’s top video clips

Windows Prefetch Cache

The Windows XP prefetch cache is a cache meant to speed up the launch of programs by keeping the first few bytes of a program on disk in order to have them preloaded before the user launched the program. Only commonly used programs are cached in the prefetch. You can use the prefetch cache to see what programs were launched at the time a computer was compromised in order to see what programs were run on the computer.

Detective