adminze

Feb 022016
 

MSSQL makes things a bit complicated when you simply want to read a backup file (.bak) file. As a pentester I was using Kali linux and was used to just vi/cat into the file, but MSSQL backups are compressed, so this does not work. You will need a Windows VM and the exact version of MSSQL Server who created the .bak file (MSSQL Express Editions should be fine). Note: MSSQL Express will only install on Windows 7 and later. Once you have them running (remember to enable TCP/IP and set a port number manually) you can import the .bak files using two commands:

List the files:

restore filelistonly from disk='c:\temp\db.bak';

Import the files:
RESTORE DATABASE mydbName FROM disk='c:\temp\db.bak'
WITH 
   MOVE 'mydbName' TO 'c:\temp\mydbName_data.mdf', 
   MOVE 'mydbName_log' TO 'c:\temp\mydbName_data.ldf';

I used HeidiSQL to connect to the MSSQL database (because I did not want to install the full MS management suite).

Link that helped me: http://stackoverflow.com/questions/156279/how-to-import-a-sql-server-bak-file-into-mysql