<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Bohack</title>
	<atom:link href="http://www.bohack.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bohack.com</link>
	<description>Check In and Tune Out!</description>
	<lastBuildDate>Wed, 24 Feb 2010 18:55:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Renaming VMWare Files In Virtual Center</title>
		<link>http://www.bohack.com/2010/02/renaming-vmware-files-in-virtual-center/</link>
		<comments>http://www.bohack.com/2010/02/renaming-vmware-files-in-virtual-center/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 18:55:50 +0000</pubDate>
		<dc:creator>Bohack</dc:creator>
				<category><![CDATA[VMware]]></category>

		<guid isPermaLink="false">http://www.bohack.com/?p=387</guid>
		<description><![CDATA[When you rename a Virtual Machine in VMWare’s Virtual Center the display name changes, but the files in the datastore do not. The .vmx, .vmdk, .nvram, etc… files retain the original name you gave them when the Virtual Machine was created.]]></description>
			<content:encoded><![CDATA[<p>When you rename a Virtual Machine in VMWare’s Virtual Center the display name changes, but the files in the datastore do not. The .vmx, .vmdk, .nvram, etc… files retain the original name you gave them when the Virtual Machine was created. This presents a problem if you ever need to back track and figure out what the files are for.</p>
<p><span id="more-387"></span>Renaming all filenames/references manually is a daunting &amp; error prone task; which starts with opening the .vmx file and renaming everything. An easier way to achieve the same outcome is to shutdown the VM and migrate it to a different datastore. All of the files and folders will be renamed to the name you specify in the wizard.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bohack.com/2010/02/renaming-vmware-files-in-virtual-center/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Simple PHP mail() Function For Testing SMTP Delivery</title>
		<link>http://www.bohack.com/2010/01/a-simple-php-mail-function-for-testing-smtp-delivery/</link>
		<comments>http://www.bohack.com/2010/01/a-simple-php-mail-function-for-testing-smtp-delivery/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 18:05:00 +0000</pubDate>
		<dc:creator>Bohack</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.bohack.com/?p=385</guid>
		<description><![CDATA[Making sure mail is sent properly from a PHP website is a bit difficult when it’s not your server, like shared hosting. So I created a simple php script called testmail.php that sends mail via the mail() function.]]></description>
			<content:encoded><![CDATA[<p>Making sure mail is sent properly from a PHP website is a bit difficult when it’s not your server, like shared hosting. You never have access to the mail logs, so you can’t see mail moving. I host several websites on shared hosting and recently found my CMS was not sending emails to me. So I opened a ticket and I concluded it to be a SNAFU.</p>
<p><span id="more-385"></span>I’m never satisfied when I conclude something doesn’t work because it’s complex. The best thing to do is to snap into diagnostic mode. The first rule of diagnosis of the problem is start simple and work from there. The saying of getting to the root of the problem is accurate.</p>
<p>I looked at the CMS code and concluded that the function being called to send mail is the PHP function of mail(). So I needed to check the PHP mail function by itself, without the complexity of the CMS. If the mail() function sends mail, then the problem is the CMS or my email. If the mail() function does not send mail, then my provider has something that they can work with and I can present the problem to them. Simple I created a simple PHP script called testmail.php with this short little string of code:</p>
<pre>&lt;?php
$to = 'youraccount@youremail.com';
$subject = 'Sent on '.date("F j, Y, g:i a");
$message = 'Test message';

mail($to, $subject, $message);
?&gt;
</pre>
<p>This routine will send mail to the $to variable and also tag the date in the subject. This is all done via the sendmail variable in php, you can do a phpinfo() to find which program sends mail. This can be handy if you need to see when it left the other system and came into yours. Just look the original header and you will be able to see all details.</p>
<p>In the end my problem resulted in my SPAM filter catching the email thus never showing up in the Inbox. Stupid problem, but until you verify the flow of mail with your hosting provider and scale your complexity back… You won’t solve the problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bohack.com/2010/01/a-simple-php-mail-function-for-testing-smtp-delivery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dell OpenManage Problem &#8211; Hangs at Precopy Preparation</title>
		<link>http://www.bohack.com/2010/01/dell-openmanage-problem-hangs-at-precopy-preparation/</link>
		<comments>http://www.bohack.com/2010/01/dell-openmanage-problem-hangs-at-precopy-preparation/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 21:39:11 +0000</pubDate>
		<dc:creator>Bohack</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[Dell]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://www.bohack.com/?p=375</guid>
		<description><![CDATA[The Dell OpenManage DVD will hang at Precopy Preparation if burnt improperly to a DVD.]]></description>
			<content:encoded><![CDATA[<p>When you purchase a Dell server you can purchase the Open Manage software, so they ship you media. OpenManage is the software that installs the maintenance partition and the automated install of the operating system as well as firmware updates. However if you did not get media with your server or want the latest version of software; you might run into a problem if you download the software with Internet Explorer and never read the instructions.</p>
<p><span id="more-375"></span>If you are looking for the latest OpenManage software for you servers, the first step is to go to http://support.dell.com and click on “Drivers and Downloads”. Next you will be prompted for the service tag or model of you unit you need to download Open Manage for. You will want to select “Systems Management” and search for “DVD ISO &#8211; Dell Systems Management Tools and Documentation”. You will want to select &#8220;More Download Options” from the right hand side. This selection might prompt you for the service tag since the OpenManage is model specific; so have the service tag handy.</p>
<p>Here you will find DVD ISO Image files; OM_6.2.0_SMTD_A00.iso.001 and OM_6.2.0_SMTD_A00.iso.002. These files are not ISO files they are actually half of the ISO file. So if you burn the first file you will boot up and be functional until you get to the “Precopy Preparation” where you will hang around 15% or 17%.</p>
<a href="http://www.bohack.com/wp-content/uploads/2010/01/dell-precopy-hang.jpg"  rel="lightbox[375]"  class="lightbox"><img src="http://www.bohack.com/wp-content/uploads/2010/01/dell-precopy-hang.jpg" alt="Dell Precopy Preparation Hang" title="dell-precopy-hang" width="400" height="293" class="aligncenter size-full wp-image-379" /></a>
<p>In order to fix the problem of OpenManage hanging at the “Precopy Preparation” stage: download both the files 001 and 002. Place them in a folder where you will concatenate them into one file. This process you will find under the instructions, however it is not documented anywhere else on the download page. So you think there are two separate ISO files and burn them only to find the first boots and hangs.</p>
<p>Dell does this to address a browser limitation around downloading large files (see Microsoft KB article 298618: You cannot download files that are 2 GB or larger &#8211; <a href="http://support.microsoft.com/kb/298618" target="_blank">http://support.microsoft.com/kb/298618</a>). Dell Systems Management Tools and Documentation DVD is no longer available as a single ISO for web download.</p>
<p><strong>Process:</strong></p>
<p>1. Download the two ISO file segments to an empty folder.<br />
2. Run the command to concatenate them into one file.</p>
<pre>copy /b OM_6.2.0_SMTD_A00.iso.001+OM_6.2.0_SMTD_A00.iso.002 OM_620_SMTD_A00.iso</pre>
<p>3. Burn the OM_620_SMTD_A00.iso file to DVD.</p>
<p>If you are running Linux the command is:</p>
<pre>Linux: cat OM* &gt; OM_620_SMTD_A00.iso</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.bohack.com/2010/01/dell-openmanage-problem-hangs-at-precopy-preparation/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How To Save A Webpage In HTML To A File In VBScript</title>
		<link>http://www.bohack.com/2009/12/how-to-save-a-webpage-in-html-to-a-file-in-vbscript/</link>
		<comments>http://www.bohack.com/2009/12/how-to-save-a-webpage-in-html-to-a-file-in-vbscript/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 18:45:31 +0000</pubDate>
		<dc:creator>Bohack</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://www.bohack.com/?p=361</guid>
		<description><![CDATA[The VBScript code will get a webpage from Google and save the HTML to a file using the msxml2.xmlhttp.6.0 object.]]></description>
			<content:encoded><![CDATA[<p>I had just finished working on a project where I needed to programmatically get a web page and save the HTML to a file. I started toying around with some code I used for parsing XML and totally rewrote the code. I found that I kept getting an error of “Microsoft VBScript runtime error: Invalid procedure call or argument”. I couldn’t understand what was going on. I was passing the parameters correctly to the File System Object, but I kept getting the error. All FSO was doing was creating a file and writing the string out. So I checked the length and then started writing the left(string,number) and found it was a character that was in Unicode. So I wrote a Unicode to Ascii function that is not all that efficient, but it is very effective. The sample code below will get a webpage from Google and save it to a file.</p>
<p><span id="more-361"></span>You can modify the code to accept arguments and make a VBScript replacement for wget the UNIX command. However wget is much more versatile and allows for a lot more features like agent string and referrer string modification. I use the “msxml2.xmlhttp.6.0” object, but you can replace it with “msxml2.xmlhttp.3.0” if you run into a problem. I had tested it on XP and Vista, so I think the “msxml2.xmlhttp.6.0” is tied to the IE version of IE version 6. Maybe someone can clarify that. The code does work and enjoy.</p>
<pre>
Dim FSO, dFile, sHTML

sHTML = Get_HTML ("http://www.google.com")

Set FSO = CreateObject("Scripting.FileSystemObject")
Set dFile = FSO.CreateTextFile("SaveFile.html", True)

dFile.Write UniToAsc(sHTML)
dFile.Close

Set dFile = Nothing
Set FSO = Nothing

Private Function Get_HTML (up_http)
 Dim xmlhttp
 Set xmlhttp = createobject("msxml2.xmlhttp.6.0")

 xmlhttp.open "get", up_http, False
 xmlhttp.send
 Get_HTML = xmlhttp.responsetext

 set xmlhttp = Nothing
End Function

Private Function UniToAsc(sString)
 Dim nLen, nPTR, sAsc
 nLen = Len(sString)

 For nPTR = 1 To nLen
  sAsc = sAsc &amp; Chr(Asc(Mid(sString, nPTR, 1)))
 Next

 UniToAsc = sAsc
End Function
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.bohack.com/2009/12/how-to-save-a-webpage-in-html-to-a-file-in-vbscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mastering Permissions with icacls.exe Command thru the GUI</title>
		<link>http://www.bohack.com/2009/12/mastering-permissions-with-icacls-exe-command-thru-the-gui/</link>
		<comments>http://www.bohack.com/2009/12/mastering-permissions-with-icacls-exe-command-thru-the-gui/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 15:41:37 +0000</pubDate>
		<dc:creator>Bohack</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[CMD]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://www.bohack.com/?p=350</guid>
		<description><![CDATA[The key to mastering permissions at the command line in Vista and Windows Server 2008 Server is learning the icacls.exe command. With the introduction of Windows Vista, you can no longer select multiple items like folders and files and apply permissions to a group of objects.]]></description>
			<content:encoded><![CDATA[<p>The key to mastering permissions at the command line in Vista and Windows Server 2008 Server is learning the icacls.exe command. With the introduction of Windows Vista, you can no longer select multiple items like folders and files and apply permissions to a group of objects. The recommended way is to use the command line and the icacls.exe command.</p>
<p><span id="more-350"></span><br />
The icacls.exe command was introduced in Windows 2003 Service Pack 2. It now comes installed by default in Windows Vista, Windows Server 2008 (R2) and Windows 7. So administrators will need to learn this command sooner or later. Recently I found the tool to be very flexible and I extensively documented the options. I mapped the different command line options to the GUI, for the network admins that need the GUI to understand how to use the command line.</p>
<p>The first point that should be made about icacls.exe is that it defaults to edit mode. The original cacls command defaults to replace mode. Next are the commands:</p>
<pre>/grant will grant user permissions or the add option in the GUI.
/remove will remove the user from the DACL and is equivalent to
 the remove option in the GUI.

Note: /remove:g will remove only grants for the user
      and /remove:d will remove only denys for the user.

/deny is equivalent to the deny column in the GUI
 and should always be used cautiously.
/setowner is a handy little command which allows you to change
 the ownership of a file or folder to another user;
 this is similar to the linux chown command.
/findsid which finds entries in a DACL for a specified SID or user.
/setintegritylevel is a bit out of the scope of this article
 and may be in a future article.</pre>
<p>The icacls command also has an /inheritance command which performs the same function as un-checking the “Include inheritable permission from this object’s parent” in the GUI. This of course presents you with the question of how to proceed; copy the permissions or remove all existing permissions. So the command line you can specify:</p>
<pre>/inheritance:e to enable same as a check box in the GUI.
/inheritance:d to disable and copy the permissions
 from the parent same as the GUI.
/inheritance:r to disable and remove the
 current permissions again same as the GUI.</pre>
<a href="http://www.bohack.com/wp-content/uploads/2009/12/icacls-gui.jpg"  rel="lightbox[350]"  class="lightbox"><img src="http://www.bohack.com/wp-content/uploads/photojar/cache/icacls-gui-150x150-1-img355.jpg" alt="Windows GUI mapped to icacls commands" title="icacls-gui" width="150" height="150" class="aligncenter size-thumbnail wp-image-355" /></a>
<p>The next thing to learn is how inheritance is propagated for permissions. When using either the /grant or /deny statement you will build the permissions as <em>/grant {user}:{inheritance}{permissions}</em> everything is encapsulated by parenthesis. The default in Windows when applying permissions in the GUI is “This folder, subfolders and files”, but to achieve the default at the command line you need to use <em>/grant {user}: (OI)(CI){permissions}</em> and the permissions should be encapsulated in parenthesis. The table below is to help you formulate your inheritance for permissions:</p>
<pre>This folder only
This folder, subfolders and files (OI)(CI)
This folder and subfolders (CI)
This folder and files (OI)
Subfolders and files only (OI)(CI)(NP)(IO)
Subfolders only (CI)(IO)
Files only (OI)(IO)</pre>
<p>The last thing to learn is the permissions. You can use macro permissions, which are also called simple permissions or you can use advanced permissions. The simple permissions are the permissions found in the first properties tab under security. The advanced permissions are when you select advanced and you get the full permissions list. So building on the permissions line from above; if we wanted to grant testuser on the folder test and apply modify permissions so all subfolders and files inherited the permissions. The line would be ‘<em>icacls test /grant testuser:(OI)(CI)(M)</em>’</p>
<pre>Simple Permissions

Full Control (F)
Modify (M)
Read &amp; Execute (RX)
List Folder Contents (X,RD,RA,REA,RC)
Read (R)
Write (W)

Advanced Permissions

Full Control (F)
Traverse folder / execute file (X)
List folder / read data (RD)
Read attributes (RA)
Read extended attributes (REA)
Create file / write data (WD)
Create folders / append data (AD)
Write attributes (WA)
Write extended attributes (WEA)
Delete subfolders and files (DC)
Delete (D)
Read permissions (RC)
Change permissions (WDAC)
Take ownership (WO)</pre>
<p>When you master this command you will be able to do anything with permissions from the command line. Including understanding the SDDL or Security Descriptor Definition Language; which Microsoft uses to create group policy permissions.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bohack.com/2009/12/mastering-permissions-with-icacls-exe-command-thru-the-gui/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac OS X Permissions Problems with Window Server 2003 R2</title>
		<link>http://www.bohack.com/2009/12/mac-os-x-permissions-problems-with-window-server-2003-r2/</link>
		<comments>http://www.bohack.com/2009/12/mac-os-x-permissions-problems-with-window-server-2003-r2/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 03:11:34 +0000</pubDate>
		<dc:creator>Bohack</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[OSX]]></category>

		<guid isPermaLink="false">http://www.bohack.com/?p=336</guid>
		<description><![CDATA[A user on a Mac OS X client with not be able to drag files into the folder or perform a copy procedure and will result in the error: "You may need to enter the name and password for an administrator on this computer to change the item name "item-name".".]]></description>
			<content:encoded><![CDATA[<p>Recently I found a problem when using Mac OS X and Windows Server 2003 R2 as a file server. The problem exists in the permissions that are applied to user folders. When applying permissions to shares you normally start out with a very restrictive permission structure at the top. As you create the folders you add permissions for users and groups to permit and restrict access for others. This structure of permissions is very common in dealing with corporate shares. We also share the folder with ‘domain users’ only having change or modify access to the entire share. This eliminates people applying their own permissions and locking everyone out including themselves. This is a common task for a network admin in setting up permissions.<br />
<span id="more-336"></span><br />
We have a Windows Server 2003 R2 file server with a directory called ‘Drives’ this directory is shared with ‘Domain Admins’ and ‘System’ Full Control and ‘Domain Users’ Change Control. Under this directory the permissions are structures as follows at the NTFS level. Domain Users have Read permissions only to the folder and does not inherit down to other folders. This allows a Domain User to read the directory names, but not access the contents in each of the folders. Each folder at this level is names according to the user that owns the content. On these folders we add the domain user’s username with Change control and we allow the permissions to inherit to all child folders and file below.</p>
<p>The problem exists when you use a script to create the folders and apply the permissions using the cacls.exe command on a Windows 2003 R2 server. A user on a Mac OS X client with not be able to drag files into the folder on a Windows 2003 R2 server share or perform a copy procedure and will result in the error: <strong>&#8220;You may need to enter the name and password for an administrator on this computer to change the item name &#8220;item-name&#8221;</strong>.&#8221;. You may also see the exclamation error if the file has a preview fork attached of <strong>&#8220;Couldn&#8217;t open the file. It may be corrupt or a file format that Preview doesn&#8217;t recognize.&#8221;</strong>. After much reading on this problem I was almost convinced that it was an OS X bug, but I realize now it is actually a flaw in the cacls command. We use a script similar to the snippet of code below to create the directories.</p>
<pre>mkdir \\server\share\userdir
cacls \\server\share\userdir /e /t /g userdir:c

explanation:

cacls {file or folder} /e {edits} /t {changes on all sub directories} /g {grants} userdir:c {user:permission of change}</pre>
<p>The problem was solved using the command that was introduced in Vista and Server 2003 R2 called icacls.exe. The icacls tool is now included in Windows Server Service Pack 2 and is standard in Vista. This command allows you to set inheritance, which is the root cause of the problem. The inheritance properties were first introduced in NTFS 5.0 with Windows 2000, however something has changed recently in the OS X 10.5 software or Windows Server 2003 R2. The problem also exists in Windows Server 2008 and Windows Server 2008 R2 so the problem is not going away and I am guessing it is OSX at fault.</p>
<p>When setting a directory with the code above, if you use the icacls command to export the permissions structure out to a file you can see the problem. This will export the security into Microsoft’s SDDL language which is documented here http://msdn.microsoft.com/en-us/library/aa379567(VS.85).aspx.</p>
<pre>icacls.exe \\server\share\userdir /save aclfile.txt

notepad.exe aclfile.txt

D:(A;OICI;0x1301bf;;;S-1-5-21-123456789-123456789-123456789-12345) (A;OICIID;FA;;;DA)(A;OICIID;FA;;;SY)
(user:chage) (domain admin:full) (system:full)</pre>
<p>The problem is not is not evident until we set the permission properly with the icacls.exe command.</p>
<pre>icacls \\server\share\userdir /t /c /grant userdir:(OI)(CI)M

explanation:

icacls {file or folder} /t {changes on all sub directories} /grant {grants} userdir:(OI)(CI) {see below}M { change/modify }

CI CONTAINER INHERIT
OI OBJECT INHERIT
NP NO PROPAGATE INHERIT
IO INHERIT ONLY
ID INHERITED
SA SUCCESSFUL ACCESS FLAG
FA FAILED ACCESS FLAG

Complete list http://msdn.microsoft.com/en-us/library/aa374928(VS.85).aspx

D:AI(A;OICI;0x1301bf;;;S-1-5-21-123456789-123456789-123456789-12345) (A;OICIID;FA;;;DA)(A;OICIID;FA;;;SY)

Explanation:

D: - Defines the DACL
AI - is the MISSING Auto Inheritance Flag
(A;OICI;0x1301bf;;;S-1-5-21-123456789-123456789-123456789-12345) - is the user’s SID and permissions
(A;OICIID;FA;;;DA) - is the “Domain Admin” permissions identified by the trailing DA
(A;OICIID;FA;;;SY) - is the “System” permissions identified by the trailing SY</pre>
<p>The AI in the DACL or Discretionary Access Control List is missing when using the cacls command. My guess is that the client when using Windows is responsible for the completion and writing of the DACL. When a Mac OS X client copies a file they utilize SAMBA which does not carry the DACL and consequentially fails. This would explain the empty file that gets created when an OS X client drags and drops the file. The file entry gets created, but is inherited with only the original permissions that have inheritance from above. This same problem could also exist on Linux or UNIX using SAMBA since it is SAMBA that drops the ball.</p>
<p>The Fix:</p>
<p>Use ‘icacls \\server\share\userdir /t /c /grant username:(OI)(CI)M’ to grant access to NTFS folders and replace all entries in scripts using the cacls command.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bohack.com/2009/12/mac-os-x-permissions-problems-with-window-server-2003-r2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cisco Console Cable Wiring</title>
		<link>http://www.bohack.com/2009/11/cisco-console-cable-wiring/</link>
		<comments>http://www.bohack.com/2009/11/cisco-console-cable-wiring/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 15:13:59 +0000</pubDate>
		<dc:creator>Bohack</dc:creator>
				<category><![CDATA[Homebrew]]></category>
		<category><![CDATA[Telco]]></category>
		<category><![CDATA[Cisco]]></category>

		<guid isPermaLink="false">http://www.bohack.com/?p=328</guid>
		<description><![CDATA[Recently I needed to connect to a Cisco router and didn’t have a serial cable on hand. The Cisco routers just like their switches come supplied with a console port built in. This console port is usually a female RJ-45 in the back of the unit and is labeled console. A lot of other manufacturers [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I needed to connect to a Cisco router and didn’t have a serial cable on hand. The Cisco routers just like their switches come supplied with a console port built in. This console port is usually a female RJ-45 in the back of the unit and is labeled console. A lot of other manufacturers also use this method to connect to their equipment; everything from Sun servers to appliance servers.</p>
<p><span id="more-328"></span></p>
<p>Usually I have a plenty of the cables on hand, but I could not find one of these in my box of tricks. I did have the EIA/TIA Serial to RJ-45 adapter, so I just needed the cable. The cable that comes supplied with Cisco equipment is a flat 8 wire telephone cable with two RJ-45 ends. The cable is called a rollover cable because Pin 1 is connected to Pin 8 on the other end and Pin 2 is connected to Pin 7 on the other end. It’ that simple!</p>
<p>It is sometimes called a null modem cable, because the all of the pins are reversed from side to side. The transmit is rolled over to the receive, the Ready To Send or RTS is directly connected to the Clear To Send or CTS, the Data Terminal Ready DTR is connected to the Data Set Ready or DSR, etc… All of the grounds are commonly tied together as well. This is why connecting to a Cisco device requires 9600 baud, 8 bits, No parity, 1 stop bit and no flow control. This is sometimes referred to as 9600,8,N,1.</p>
<p>The diagram below is how to make the rollover cable from simple Cat5 cable if you do not have the 8 wire flat Telco cable on hand that is usually gray in color. Simple crimp them down on each end of the cable as per the diagram. It does not matter which end is connected to the equipment and which end is connected to the EIA/TIA DB-9 RJ-45 connector.</p>
<a href="http://www.bohack.com/wp-content/uploads/2009/11/rollover-cable-wiring.jpg"  rel="lightbox[328]"  class="lightbox"><img src="http://www.bohack.com/wp-content/uploads/2009/11/rollover-cable-wiring.jpg" alt="Cisco Rollover Cable Wiring" title="rollover cable wiring" width="668" height="356" class="aligncenter size-full wp-image-329" /></a>
]]></content:encoded>
			<wfw:commentRss>http://www.bohack.com/2009/11/cisco-console-cable-wiring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get the URL from a hyperlink in Excel</title>
		<link>http://www.bohack.com/2009/06/get-the-url-from-a-hyperlink-in-excel/</link>
		<comments>http://www.bohack.com/2009/06/get-the-url-from-a-hyperlink-in-excel/#comments</comments>
		<pubDate>Sun, 14 Jun 2009 17:01:59 +0000</pubDate>
		<dc:creator>Bohack</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.bohack.com/?p=324</guid>
		<description><![CDATA[Recently I needed to extract a links from a web page; normally I would use some Linux commands ported to windows and get the job done. In the end I needed to format the relative link to a full URL, so I decided to use Excel. However when I imported the web page into excel [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I needed to extract a links from a web page; normally I would use some Linux commands ported to windows and get the job done. In the end I needed to format the relative link to a full URL, so I decided to use Excel. However when I imported the web page into excel I found that the URL was embedded in the friendly name of the hyperlink.</p>
<p><span id="more-324"></span>The hyperlink command in excel actually does the reverse of what I needed; it creates a hyperlink out of the URL and a friendly name and I needed the URL from the friendly name. So I dug in a little deeper and treated the URL like an object. It has properties and those properties can be exposed. The hyperlinkcell object has a type of range so it is passed to the function of GETURL. The first hyperlink in the range we will want the property of the address. Then we simply pass it back to the function so that we can display it.</p>
<p>To install this all you need to do is:</p>
<ol>
<li>Hit ALT + F11 (Opens Visual Basic Editor)</li>
<li>Click on Insert -&gt; Module (adds a module to your excel file)</li>
<li>Paste the code below for the function of GETURL</li>
<li>Hit ALT + Q (Closes the Visual Basic Editor)</li>
</ol>
<p>Now use the =GETURL(cell) to get the URL</p>
<p>Example: =GETURL(A1) will return the URL for the Hyperlink displayed in cell A1</p>
<pre>Function GETURL(HyperlinkCell As Range)

 GETURL = HyperlinkCell.Hyperlinks(1).Address

End Function</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.bohack.com/2009/06/get-the-url-from-a-hyperlink-in-excel/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Bascom-AVR and the Atmel ATtiny2313</title>
		<link>http://www.bohack.com/2009/05/bascom-avr-and-the-atmel-attiny2313/</link>
		<comments>http://www.bohack.com/2009/05/bascom-avr-and-the-atmel-attiny2313/#comments</comments>
		<pubDate>Sat, 30 May 2009 17:00:33 +0000</pubDate>
		<dc:creator>Bohack</dc:creator>
				<category><![CDATA[Homebrew]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.bohack.com/?p=316</guid>
		<description><![CDATA[Back in April I attended the Notacon the hacker-art convention up in Cleveland Ohio. The hardware hacking room had a number of little project kits they were giving out to teach people how to solder. These project kits included the chips, resistors, LEDs, serial connector and everything except the solder. They ran labs and the [...]]]></description>
			<content:encoded><![CDATA[<p>Back in April I attended the <a title="Notacon" href="http://www.notacon.org/" target="_blank">Notacon</a> the hacker-art convention up in Cleveland Ohio. The hardware hacking room had a number of little project kits they were giving out to teach people how to solder. These project kits included the chips, resistors, LEDs, serial connector and everything except the solder. They ran labs and the last day they just wanted to get rid of these project kits. So I grabbed a couple that caught my eye. One kit had an Atmel AVR programmable chip, eight LEDs and sported a 9-pin serial connector. The kit is the Mini-POV3 sold by <a title="adafruit" href="http://www.adafruit.com/" target="_blank">http://www.adafruit.com/</a> for $17.50, it’s all you need to get started with programmable chips!</p>
<p><span id="more-316"></span>So I got home that Sunday and my son and I put the Mini-POV3 kit together, it took all of 30 minutes. It is a persistence of view kit, so when you wave the device it spells a word or words out. This concept unfortunately is not something that a 4 year old can grasp and he is like “Wow, what else does it do?”</p>
<p>The heart of the kit is an Atmel AVR ATtiny2313 8-bit RISC Microcontroller; it has programmable inputs and outputs, 2KB of flash memory and can be programmed in-system. The design was ahead of its time and AVR stands for the two designers’ names “Alf and Vegard&#8217;s Risc”. The kit also comes with a 9-pin Serial connector. So a couple of tasks to program this thing…</p>
<ol>
<li>Build the project (takes about 30 minutes).</li>
<li>Get a straight thru serial cable or directly plug it into the serial port.</li>
<li>Download WinAVR from <a title="SourceForge" href="http://www.sourceforge.net/" target="_blank">http://www.sourceforge.net/</a></li>
<li>Download Bascom-AVR Demo from <a title="Bascom-AVR" href="http://www.mcselec.com/" target="_blank">http://www.mcselec.com/</a></li>
<li>Learn some QBasic and the inner workings of the Atmel AVR.</li>
</ol>
<p>Install the WinAVR program, this program will allow you to program the in-system Microcontroller. When you install it: change the path to “c:\WinAVR” and make sure that it puts the AVR binaries in the global path variable; you will be prompted during the install. Now we need to install the Bascom-AVR program which is the IDE or Integrated Development Environment and the Bascom BASIC to machine code complier. To install the Bascom-AVR program accept all defaults during the install, we will set it up next…</p>
<p>Inside of the Bascom-AVR program click on the ‘Options’ menu item and select ‘Programmer’. This is where we setup the tie between the WinAVR program called AVRDude.exe and the Bascom IDE for one click programming. Although you always have the option to find the BIN file and flash it via command line. Click the pull-down menu for Programmer and select ‘External programmer’ now in the tab below called ‘Other’ set the ‘Program’ to the path of the avrdude.exe; so it should look like this “C:\WinAVR\bin\avrdude.exe”. In the ‘Parameter’ field put “-p t2313 -P com1 -c dasa -U flash:w:{FILE}:a”; which tells avrdude.exe to write to a tiny2313, via comport 1, using direct access (dasa) and write to flash, substitute {FILE} for the filename and program it automatically. You can always Google ‘avrdude man’ for the manual page for the avrdude program or just type mine in.</p>
<a href="http://www.bohack.com/wp-content/uploads/2009/05/bascom-options.jpg"  rel="lightbox[316]"  class="lightbox"><img src="http://www.bohack.com/wp-content/uploads/2009/05/bascom-options.jpg" alt="Bascom Options for Programmers" title="bascom-options" width="412" height="298" class="alignnone size-full wp-image-321" /></a>
<p>Now let’s compile and program the equivalent of a hello world application… However if you want to backup the original program drop to a command prompt and type “avrdude -p t2313 -P com1 -c dasa -U flash:r:backup.hex:i” and you can always write it back via “avrdude -p t2313 -P com1 -c dasa -U flash:w:backup.hex:i”. Now open a new project in Bascom-AVR by clicking File-New and type the program in below, then hit ‘F7’ to compile and ‘F4’ to program to the chip. During this process the power switch must be in the ‘On’ position, remember you are programming a single chip computer!</p>
<p>The outcome when disconnected from the serial port is: a sequential lighting of the LEDs in 2 second intervals. Now it is time for you to learn some Bascom BASIC and play with the programming yourself. Start by downloading the Bascom-AVR PDF file and reading it. You can also customize my program to make the lights blink back and forth. Start by changing the timing to 1 second, then set your next goal and learn some of the language. Happy Hacking and visit some of my sponsors for deals on AVR products (I get paid when you visit them).</p>
<pre>'Sequence LEDs
Dim X As Byte
Config PortB = Output
PortB = 0

For X = 0 To 7
 Wait 2
 PortB.X = 1
Next X

End</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.bohack.com/2009/05/bascom-avr-and-the-atmel-attiny2313/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compacting Microsoft Virtual PC VHD Images 101</title>
		<link>http://www.bohack.com/2009/05/compacting-microsoft-virtual-pc-vhd-images-101/</link>
		<comments>http://www.bohack.com/2009/05/compacting-microsoft-virtual-pc-vhd-images-101/#comments</comments>
		<pubDate>Mon, 25 May 2009 17:14:07 +0000</pubDate>
		<dc:creator>Bohack</dc:creator>
				<category><![CDATA[Virtual PC]]></category>

		<guid isPermaLink="false">http://www.bohack.com/?p=258</guid>
		<description><![CDATA[I&#8217;ve been using Microsoft&#8217;s Virtual PC for the past 7 years, ever since I spoke with a kernel developer at Microsoft and found that they solely use Virtual PC for debug and development. Since then I have used it to build images and teach in the classroom as a learning device. It allows me to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using Microsoft&#8217;s Virtual PC for the past 7 years, ever since I spoke with a kernel developer at Microsoft and found that they solely use Virtual PC for debug and development. Since then I have used it to build images and teach in the classroom as a learning device. It allows me to teach with what I call a surgical approach, because every lab is perfectly clean every time for every student. However it is all about the footprint when it comes to storage of the Virtual Hard Drives, sometime you need to keep several VHD images around. So over the past few years I have put a collection of tools together that lead to the best compaction method.</p>
<p><span id="more-258"></span>To compact a VHD it is a two part process; the first part is done in the guest operating system, with a general cleanup. The second part of the process is completed by booting into RAM a second guest OS that can manipulate the original guest&#8217;s virtual hard disk. At this point we can further delete some files and truly defragment the VHD.</p>
<p>So first we begin by booting the guest Operating System and cleaning it up of unnecessary files. You can start by opening the %systemroot% and deleting any service pack or system update uninstalls, they usually look like &#8220;$NtUninstallKB952069_WM9$&#8221;. By doing this you can shave almost 1GB of space or more, depending on how old the image is and how many updates have been done. Next drop the &#8220;Restore Points&#8221; if you are dealing with Windows XP, just go in to My Computer properties under the &#8220;System Restore&#8221; tab and check &#8220;Turn off System Restore on all drives&#8221;. By doing this you can cut the VHD down by up to 10%, again it all depends on how old the OS is and how many restore points it has retained. The next step is to right click on the C drive or Local Disk, go to properties and select &#8220;Disk Cleanup&#8221;. Do not compress old files, but delete temporary Internet Files and downloaded content junk&#8230; etc&#8230; Again this can sustainably free up space on the drive.</p>
<p>At this point we have cleaned up the guest operating system as much as possible. Now we need to boot into a live install of Window that is in RAM and run some tools. The best way and quickest way is to download a Bart’s PE toolkit and make a custom Bart’s PE ISO; you can find this toolkit at http://www.nu2.nu/pebuilder/.</p>
<p>You will need to add two programs to the Bart’s PE disk; the first is a standalone defrag tool the second is the precompaction.exe from the ISO in the Virtual PC program files. I will explain… The best tool to defrag with is a program by Dave Whitney, however it’s hard to find. My suggestion is to Google “Dave Whitney defrag”; Dave’s current web site is “The Flexomizer”. This defrag will work stand alone and give you just about 100% defragmentation on the disk. The second tool is an executable named “Precompact.exe” in an ISO named “Virtual Disk Precompactor.iso” located in “C:\Program Files\Microsoft Virtual PC\Virtual Machine Additions\”. Use daemon-tools and remove the executable to be included in the Bart’s PE build following the Bart’s PE directions to build the bootable Bart’s PE ISO.</p>
<p>Now boot the Virtual PC containing the VHD with the Bart’s PE ISO created with the tools above. Once booted up open a command prompt and switch to “C:” which is your original VHD hard drive. We need to remove the “pagefile.sys” and “hiberfil.sys”, both of these can shave gigabytes of data off the VHD. First “attrib –r –s –h pagefile.sys”, then delete it and then repeat this for the “hiberfil.sys” file. Now defrag the C drive with the new defrag tool you downloaded from Dave Whitney’s web site. Now that we have defragged the VHD it’s time for the pre-compaction, by running the precompact.exe tool. This tool will zero and bytes unused be the defrag process; you can it is basically like repairing and compacting a database.</p>
<p>Once the tool is done shutdown the Virtual PC and go into the disk wizard and click on edit an existing disk and compact the disk replacing the original disk. When it goes thru this process it will create a second file and replace the first file, so the file will be somewhat contiguous. However if you wish you can always run the “contig” program from the Microsoft System Internals web site; this can speed the VHD up.</p>
<p>It’s actually a pretty simple process:</p>
<p>1.    Clean up the guest operating system, deleting any old junk.<br />
2.    Boot a Live version (RAM resident) of Windows.<br />
3.    Delete the page file and hibernation file.<br />
4.    Defragment the hard disk.<br />
5.    Precompact the hard disk.<br />
6.    Shut down and compact the hard disk.<br />
7.    Optionally run the contig program to defrag the file.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bohack.com/2009/05/compacting-microsoft-virtual-pc-vhd-images-101/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
