Every now and then my fellow coworkers and me are faced with clients that mention problems uploading files of a specific size to web content management systems (CMS). While we are trying to solve the problem we need to test the upload ourselves. Now the filesize differs with every inquiry and we have to come up with files that extend this size. What to do in this case? Browsing the web for files of a specific length? Crawling through our media asset management system to fetch a file that fits in? No, there’s a better solution to that: the file generation tools of the operating system!

photo credit: Velo Steve
Microsoft Windows, Linux and Mac OS come with standard tools that allow file generation and manipulation. This article tells you how to use them to generate files of any length.
Generating files of any length on Windows
First open the command line interface by clicking Start > Run… and entering “cmd” (without the quotes) in the dialog form. By pressing Enter the command line interface will pop up and you can insert the following string to create a new file:
C:\>fsutil file createnew <filename> <filesize in bytes>
As you see you have to state the specific filesize in bytes! For a conversion of megabytes or kilobytes to bytes see this or this conversion tool.
For example this string creates a new file named testfile.txt sized 1 Kb located in the root directory of partition C:
C:\>fsutil file createnew C:\testfile.txt 1024
Generating files of any length on Linux
File generation with Linux is as easy as with Windows. The `dd` tool to (amongst others) create new files comes with virtually every distribution. Here is the example command, intended to be run from within a shell.
dd if=/dev/zero of=<filename> bs=<initial blocksize in bytes> count=<iterations of the blocksize>
The easiest way to create a file of specific length using `dd`is by utilizing suffixes like K (for Kilobytes) or M (for Megabytes) like this:
dd if=/dev/zero of=testfile.txt bs=1K count=1
The command above creates a file of 1KB size in the current working directory.
The man page of `dd`lists the suffixes you may utilize:
BLOCKS and BYTES may be followed by the following multiplicative suffixes: xM M, c 1, w 2, b 512, kB 1000, K 1024, MB 1000*1000, M 1024*1024, GB 1000*1000*1000, G 1024*1024*1024, and so on for T, P, E, Z, Y.
As `dd` is available for all Linux/Unix distributions this applies to Unix Systems (e.g. Solaris) as well.
Generating files of any length on Mac OS
OSX provides a shell app that’s more convenient to use than `dd`. It’s called `mkfile`. Start it by firing up a Terminal window located here:
/Applications/Utilities/Terminal.app
Like `dd` the OSX pendant `mkfile` can be used with suffixes as well. Here you can use b for Bytes, k for Kilobytes, m for Megabytes and finally g for Gigabytes. See it in action:
mkfile 1k testfile.txt
As expected this creates a 1KB sized file in the current working directory.
Conclusion
As you can see, it is really easy to create test files of virtually any length on all major plattforms like Microsoft Windows, Linux and Mac OS. Try it out!
Boards.ie Forums have been hacked – don’t panic!
Though i’m not Irish it has come to my attention that one of the largest bulletin boards in Ireland, boards.ie, has been hacked today. The attackers gained access to parts of the database ” [..] which includes our members usernames, email addresses and obfuscated passwords [..] ” as stated on the official landing page that replaced the usual forums today.
The team of boards.ie reset all user passwords and advises all their users to change the password on all other sites where they might have used it as well. In my opinion this is a good step but not absolutely necessary. And i tell you why: boards.ie uses an uptodate version of the bulletin board software vBulletin. That uses the MD5 algorithm to “obfuscate” the users’ password. As written earlier the MD5 algorithm is known to be unsecure and should not be used to encrypt user passwords – except it has been salted. Salting means that there is an additional “secret” (technically: an additional set of bits) used to hash the obfuscated string. This increases the so called entropy of the hashsum. And this, in return, makes it very hard to “crack” the hash using traditional methods like brute-forcing or using rainbow tables. That means it’s very hard for hackers of boards.ie to get access to other systems using the gained user data. So relax and don’t panic!
Anyway the team of boards.ie has done good resetting all the user passwords as an additional security mechanism. If you want to know more about cracking MD5 hashsums I’ll suggest you to have a look on my more in-depth articles regarding this topic:
[UPDATE]
The boards.ie team states on Twitter (@boards_ie) that they will not send out new passwords but require users to set a new password when the site is back up:
I guess that’s fine as well.
[/UPDATE]
[UPDATE2]
@john_ruddy has made a good point. In his opinon it might be possible that the hackers will send E-Mails to the users of boards.ie containing false instructions to set a new password or enter other sensitive data. So please be aware of phishing attacks!
[/UPDATE2]