Most users are probably happy with the default PowerShell prompt. But there are a handful of people that are not satisfied with any product unless they have had a chance to customize it to their needs. Luckily PowerShell supports defining your own prompt quite easily. Then there are another few that for some reason likes to have multiple prompts that they alternate between. Perhaps they have one for home, one for work and another one when they are presenting at usergroups and conferences. (more…)
The character set allowed in the Domain Names System is based on ASCII, but ICANN have later approved the Internationalized domain name (IDNA) system. It was proposed in 1996 and first implemented in 1998, and lets you use characters outside the ASCII-only scheme (Unicode). (more…)
Created by the german IBM scientist Hans Peter Luhn, the Luhn Algorithm is a checksum formula being used to validate a variety of identification numbers, such as credit card numbers, IMEI numbers etc.
In this blog post, I will show you some functions I created that uses this algorithm. It can be used to calculate a checksum digit from a number, as well as validate numbers using the Luhn Algorithm checksum validation.
This little function lets you remove characters from a string. The twist is that it takes a character array, and will remove all characters in it from the input string. (more…)
This one should appeal to both the statistically inclined of you, as well as those interested in cryptography. Measure-Frequency will take any array (or string) and give you the frequency distribution of it’s contents. (more…)
In my previous post I showed you a couple of wrapper functions I made to handle binary to string conversion (and vice versa). Building on one of these I thought it would be fun to try to make a simple file hex viewer, similar to how popular hex editors work (without the editing part of course). (more…)
I recently came across the Matasano Crypto Challenges, which is a set of challenges you can go through to learn more about cryptography.
While looking around for tips online for the first challenge, I stumbled upon an excellent blog article by Vadims Podāns, where he shows how, by using the Win32 native functions CryptStringToBinary and CryptBinaryToString, you can easily convert between binary and string in PowerShell. (more…)
Being able to read C# is a huge plus when doing advanced scripting, if for no other reason than most examples in the .NET documentation are given as C# (or Visual Basic). Luckily for us, understanding C# isn’t that hard when you have worked with PowerShell a while. But one of the areas where they can differ a bit are the operators. I have created this Cheat Sheet as a tool to be able to quickly translate between C# operators and the PowerShell equivalent. (more…)
When using the Format parameter of the Get-Date cmdlet, if you ever need a list of all supported format patterns, use this one-liner:
Recently, when reading string data from a binary file, I stumbled across the “problem” of trimming the terminating character from a null-terminated string. I started getting all creative about it, but it soon became quite a mess (code-wise), so I that down and had a re-think. This is how I ultimately ended up doing it. (more…)