<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.digitalinternals.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>Digital Internals</title>
	
	<link>http://www.digitalinternals.com</link>
	<description>Technology Deciphered</description>
	<lastBuildDate>Sun, 29 Jan 2012 16:12:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.digitalinternals.com/digitalinternals" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="digitalinternals" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">digitalinternals</feedburner:emailServiceId><feedburner:feedburnerHostname xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Generate Random Password on Linux</title>
		<link>http://www.digitalinternals.com/168/20120130/generate-random-password-on-linux/</link>
		<comments>http://www.digitalinternals.com/168/20120130/generate-random-password-on-linux/#comments</comments>
		<pubDate>Sun, 29 Jan 2012 16:12:06 +0000</pubDate>
		<dc:creator>ibrahim</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[random number generator]]></category>

		<guid isPermaLink="false">http://www.digitalinternals.com/?p=168</guid>
		<description><![CDATA[Linux has all the tools you need to generate a random password. This can be accomplished by a special file /dev/random, that serves as a random number generator. The Linux random number generator gathers environmental noise from device drivers and other sources into an entropy pool. To generate passwords based on the random number generator, [...]]]></description>
			<content:encoded><![CDATA[<p>Linux has all the tools you need to generate a random password. This can be accomplished by a special file <code>/dev/random</code>, that serves as a random number generator.</p>
<p><span id="more-168"></span></p>
<p>The Linux random number generator gathers environmental noise from device drivers and other sources into an entropy pool. To generate passwords based on the random number generator, try running the following commands on a Linux machine.</p>
<p>This method will generate a 8-character random password:</p>
<pre class="brush: bash; gutter: false; highlight: [1];">
ibrahim@anfield-vm:~$ cat /dev/urandom | tr -dc &quot;a-zA-Z0-9@#*=[]&quot; | head -c8
</pre>
<p>This method uses the <code>dd</code> command to output the password.</p>
<pre class="brush: bash; gutter: false; highlight: [1];">
ibrahim@anfield-vm:~$ dd if=/dev/urandom bs=1 count=128 2&gt;/dev/null | tr -dc &quot;a-zA-Z0-9@#*=[]&quot; | head -c8
</pre>

<p><a href="http://feedads.g.doubleclick.net/~a/D-Ql8bBbVWRdO54-rYeGhI0Fc6Y/0/da"><img src="http://feedads.g.doubleclick.net/~a/D-Ql8bBbVWRdO54-rYeGhI0Fc6Y/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/D-Ql8bBbVWRdO54-rYeGhI0Fc6Y/1/da"><img src="http://feedads.g.doubleclick.net/~a/D-Ql8bBbVWRdO54-rYeGhI0Fc6Y/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.digitalinternals.com/168/20120130/generate-random-password-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Safely Remove USB Mass Storage Device</title>
		<link>http://www.digitalinternals.com/164/20111023/how-to-safely-remove-usb-mass-storage-device/</link>
		<comments>http://www.digitalinternals.com/164/20111023/how-to-safely-remove-usb-mass-storage-device/#comments</comments>
		<pubDate>Sun, 23 Oct 2011 10:33:32 +0000</pubDate>
		<dc:creator>ibrahim</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[eject]]></category>
		<category><![CDATA[process explorer]]></category>
		<category><![CDATA[storage device]]></category>
		<category><![CDATA[usb]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.digitalinternals.com/?p=164</guid>
		<description><![CDATA[When you click on the &#8220;Safely Remove Hardware&#8221; icon in the system tray to remove your USB thumbdrive, you may receive an error message saying that it is still in use and you may not be able to remove it successfully. Do the following error messages look familiar to you? Windows Can&#8217;t stop your &#8216;generic [...]]]></description>
			<content:encoded><![CDATA[<p>When you click on the &#8220;Safely Remove Hardware&#8221; icon in the system tray to remove your USB thumbdrive, you may receive an error message saying that it is still in use and you may not be able to remove it successfully.</p>
<p><span id="more-164"></span></p>
<p>Do the following error messages look familiar to you?</p>
<blockquote><p>Windows Can&#8217;t stop your &#8216;generic device&#8217; because it is in use. Close any programs or windows that might be using the device, and then try again later.</p>
</blockquote>
<p><img src="http://i.digitalinternals.com/2011/10/164/usb-eject-error-vista.png" alt="Windows can't stop your 'generic deivice' because it is in use. Close any programs or windows that might be using the device, and then try again" /></p>
<blockquote><p>The device is currently in use. Close any programs or windows that might be using the device, and then try again.</p>
</blockquote>
<p><img src="http://i.digitalinternals.com/2011/10/164/usb-eject-error-win7.jpg" alt="The device is currently in use. Close any programs or windows that might be using the device, and then try again" /></p>
<p>The above errors are reported if there are processes with file handles opened on the USB drive. To safely remove the drives, you will need to determine the offending processes and terminate them.</p>
<p>To resolve this :</p>
<ol>
<li>Download a copy of <a href="http://technet.microsoft.com/en-us/sysinternals/bb896653">Process Explorer</a> from the Microsoft TechNet website. Once downloaded, extract the executable from the ZIP archive and run it.</li>
<li>Press &#8216;Ctrl-F&#8217; or goto the Find menu and click on the &#8216;Find Handle or DLL&#8217; option.</li>
<li>Type the drive letter of the USB device in the textbox and click on the &#8216;Search&#8217; button.</li>
<li>Take note of the process name and it&#8217;s PID. Look at the screenshot below for an example.
<p><img src="http://i.digitalinternals.com/2011/10/164/process-explorer-search.jpg" alt="Process Explorer Search" /></li>
<li>From the main process tree view, click on the PID header to sort the entries based on the process ID and search for the offending process.</li>
<li>Right-click on the process and kill the process.<br />
<img src="http://i.digitalinternals.com/2011/10/164/process-explorer-kill.jpg" alt="Process Explorer kill process" />
</li>
</ol>
<p>You should now be able to safely remove your USB drive. If you are still facing problems with the USB drive, a restart of you computer may be required.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/uM6v96NIO36TcyvJ9Pazd1DFzTU/0/da"><img src="http://feedads.g.doubleclick.net/~a/uM6v96NIO36TcyvJ9Pazd1DFzTU/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/uM6v96NIO36TcyvJ9Pazd1DFzTU/1/da"><img src="http://feedads.g.doubleclick.net/~a/uM6v96NIO36TcyvJ9Pazd1DFzTU/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.digitalinternals.com/164/20111023/how-to-safely-remove-usb-mass-storage-device/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Completely Wipe Hard Disk Contents</title>
		<link>http://www.digitalinternals.com/162/20110831/how-to-completely-wipe-hard-disk-contents/</link>
		<comments>http://www.digitalinternals.com/162/20110831/how-to-completely-wipe-hard-disk-contents/#comments</comments>
		<pubDate>Wed, 31 Aug 2011 12:28:53 +0000</pubDate>
		<dc:creator>ibrahim</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[content]]></category>
		<category><![CDATA[dd]]></category>
		<category><![CDATA[hard disk]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[wipe]]></category>

		<guid isPermaLink="false">http://www.digitalinternals.com/?p=162</guid>
		<description><![CDATA[If you are planning to discard your old hard disk, make sure that they do not contain any valuable information when they head out of your door. The last thing on your mind is the potential of having your identity stolen from sensitive information stored in that hard disk. When you delete a file, the [...]]]></description>
			<content:encoded><![CDATA[<p>If you are planning to discard your old hard disk, make sure that they do not contain any valuable information when they head out of your door. The last thing on your mind is the potential of having your identity stolen from sensitive information stored in that hard disk.</p>
<p><span id="more-162"></span></p>
<p>When you delete a file, the file is removed from the filesystem. But the contents of the file can still be retrieved, as the areas of the disk used to store the contents are never wiped but simply marked as &#8220;free&#8221; for use by other data. The contents will be available till those areas of the disk are overwritten by new data. Formatting of the hard disk will not wipe the data either.</p>
<p>Normally, hard disk manufacturers provide tools that can be used to wipe the hard disks. But a computer running Linux can be used to wipe the data as well. Here&#8217;s how&#8230;</p>
<ol>
<li>Connect the hard disk to the computer running Linux using a spare SATA or IDE cable and boot the computer.</li>
<li>Check for the device <code>/dev/urandom</code>.</li>
<pre class="brush: plain; gutter: false; highlight: [1,2];">
ibrahim@anfield-vm:~$ ls -l /dev/urandom
crw-rw-rw- 1 root root 1, 9 2011-08-31 18:21 /dev/urandom
</pre>
<li>If the device is not found, create it using <code>mknod</code> command as root user.</li>
<pre class="brush: plain; gutter: false; highlight: [1,2,3,4];">
ibrahim@anfield-vm:~$ sudo mknod /dev/urandom c 1 9
[sudo] password for ibrahim:
ibrahim@anfield-vm:~$ ls -l /dev/urandom
crw-r--r-- 1 root root 1, 9 2011-08-31 19:17 /dev/urandom
</pre>
<li>Determine the block device for the hard disk you want to wipe. Use the output of <code>dmesg</code> or <code>lshw</code> commands to determine the correct block device, you wouldn&#8217;t want to wipe off the wrong hard disk!</li>
<li>Use the Linux <code>dd</code> command to write random data and wipe the disk. This will take some time, depending on the size of the hard disk. I am wiping the disk <code>/dev/sde</code> in the example below.</li>
<pre class="brush: plain; gutter: false; highlight: [1,2,3,4,5,6];">
ibrahim@anfield-vm:~$ sudo dd if=/dev/urandom of=/dev/sde
[sudo] password for ibrahim:
dd: writing to `/dev/sde': No space left on device
262145+0 records in
262144+0 records out
134217728 bytes (134 MB) copied, 30.5276 s, 4.4 MB/s
</pre>
</ol>
<p>Although the <code>dd</code> command only needs to be run once, you can increase the level of security by running the <code>dd</code> command a number of times to wipe the hard disk. If you are unable to use the <code>/dev/urandom</code> device, you can try your luck by substituting it with devices such as <code>/dev/random</code> or <code>/dev/zero</code>. Once the <code>dd</code> command has completed, shutdown the computer and remove the hard disk.</p>
<p>Note that with sensitive and sophisticated equipment, it is theoretically possible to recover data even after it has been over written. Hard disks with extremely sensitive information need to be sent for degaussing. A hard drive that is degaussed is rendered useless.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/NMpAQP0Z9M6o5pmSzvIV7HmDbX4/0/da"><img src="http://feedads.g.doubleclick.net/~a/NMpAQP0Z9M6o5pmSzvIV7HmDbX4/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/NMpAQP0Z9M6o5pmSzvIV7HmDbX4/1/da"><img src="http://feedads.g.doubleclick.net/~a/NMpAQP0Z9M6o5pmSzvIV7HmDbX4/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.digitalinternals.com/162/20110831/how-to-completely-wipe-hard-disk-contents/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Decompile Java Classes</title>
		<link>http://www.digitalinternals.com/159/20110731/how-to-decompile-java-classes/</link>
		<comments>http://www.digitalinternals.com/159/20110731/how-to-decompile-java-classes/#comments</comments>
		<pubDate>Sun, 31 Jul 2011 07:19:04 +0000</pubDate>
		<dc:creator>ibrahim</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[decompiler]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[reverse engineering]]></category>

		<guid isPermaLink="false">http://www.digitalinternals.com/?p=159</guid>
		<description><![CDATA[Java class files are compiled bytecode files that could be loaded and run on a JVM or a Java Virtual Machine. To generate a Java source file from a Java class file, you will need a Java decompiler. Why do we need to decompile Java classes ? Well, I do it to study how the [...]]]></description>
			<content:encoded><![CDATA[<p>Java class files are compiled bytecode files that could be loaded and run on a JVM or a Java Virtual Machine. To generate a Java source file from a Java class file, you will need a Java decompiler.</p>
<p><span id="more-159"></span></p>
<p>Why do we need to decompile Java classes ? Well, I do it to study how the Java compiler optimises my code.</p>
<p>Below are the list of Java decompilers that I use:
<ul>
<li>JAD Java Decompiler &#8211; the official site for this decompiler has expired, but you can find a mirror site <a href="http://www.varaneckas.com/jad">here</a>.</li>
<li><a href="http://java.decompiler.free.fr/?q=jdgui">JD-GUI</a> &#8211; that seems to support jdk 1.6 and it&#8217;s my personal favourite</li>
</ul>
<p><img src="http://i.digitalinternals.com/2011/07/159/jd-gui.png" alt="jd-gui java decompiler" /></p>
<p>Get a copy of JD-GUI, run the executable and open a Java class or a JAR (Java archive) file and the decompiled code can be viewed within the JD-GUI itself. There is also an option to save the decompiled code into Java source files.</p>
</p>
<p class="red">DISCLAIMER: THE ABOVE ARTICLE IS MEANT FOR EDUCATIONAL PURPOSES ONLY. I DO NOT PROMOTE OR SUPPORT ANY KIND OF REVERSE ENGINEERING OF COPYRIGHTED MATERIAL OR CONTENTS. I AM NOT RESPONSIBLE FOR ANY LEGAL ISSUES YOU ENCOUNTER IF YOU FOLLOW THE ABOVE GUIDES/INSTRUCTIONS. I AM NOT RESPONSIBLE OF ANY OUTCOME, LOST OF DATA OR ANY DAMAGES RESULTED DUE TO THE ACT OF YOU PROCEEDING WITH THE ABOVE GUIDES/INSTRUCTIONS.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/_MbvNsVkF53I1WcMY2-r0s5P36A/0/da"><img src="http://feedads.g.doubleclick.net/~a/_MbvNsVkF53I1WcMY2-r0s5P36A/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/_MbvNsVkF53I1WcMY2-r0s5P36A/1/da"><img src="http://feedads.g.doubleclick.net/~a/_MbvNsVkF53I1WcMY2-r0s5P36A/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.digitalinternals.com/159/20110731/how-to-decompile-java-classes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Change IP Address from the Command Prompt</title>
		<link>http://www.digitalinternals.com/158/20110619/change-ip-address-from-the-command-prompt/</link>
		<comments>http://www.digitalinternals.com/158/20110619/change-ip-address-from-the-command-prompt/#comments</comments>
		<pubDate>Sun, 19 Jun 2011 08:58:12 +0000</pubDate>
		<dc:creator>ibrahim</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[command prompt]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[netsh]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.digitalinternals.com/?p=158</guid>
		<description><![CDATA[Changing the IP settings from the Windows GUI is a no-brainer! I have never been a fan of using the GUI for system configuration. I change the network settings of the ethernet and wifi interfaces from the command line! There is a Windows utility called netsh, that will allow us to change system networking settings. [...]]]></description>
			<content:encoded><![CDATA[<p>Changing the IP settings from the Windows GUI is a no-brainer! I have never been a fan of using the GUI for system configuration.  I change the network settings of the ethernet and wifi interfaces from the command line!</p>
<p><span id="more-158"></span></p>
<p>There is a Windows utility called <strong><code>netsh</code></strong>, that will allow us to change system networking settings. As you will need to modify the system settings, you will need to run the <code>netsh</code> with Administrator privileges.</p>
<p>To set a static IP address, subnet mask and the default gateway for your ethernet interface, run the following command:</p>
<pre class="brush: plain; gutter: false; highlight: [1];">
C:\&gt;netsh interface ip set address name=&quot;Local Area Connection&quot; source=static address=192.168.1.10 mask=255.255.255.0 gateway=192.168.1.1
</pre>
<p>Note that the default gateway address is optional and you have to specify the network interface either by it&#8217;s name or by the index. If you prefer to specify the network interface with the index number, you can retrieve the indexes from running the following command:</p>
<pre class="brush: plain; gutter: false; highlight: [1];">
C:\&gt;netsh interface ip  show interface
</pre>
<p>You are also to modify the DNS settings similarly:</p>
<pre class="brush: plain; gutter: false; highlight: [1];">
C:\&gt;netsh interface ip set dns &quot;Local Area Connection&quot; static 192.168.1.1
</pre>
<p>Below are two batch files that I frequently use to modify the IP address settings.</p>
<p>Copy the following code to a file called <strong><code>staticip.bat</code></strong> and keep it somewhere in your PATH.</p>
<pre class="brush: plain;">
@echo off
setlocal enableextensions enabledelayedexpansion

set argc=0
for %%x in (%*) do set /A argc+=1

if %argc% LEQ 2 goto help
if %argc% == 3 goto nogw
if %argc% == 4 goto dogw

goto help

:dogw
netsh interface ip set address name=&quot;%1&quot; source=static address=%2 mask=%3 gateway=%4
goto endp

:nogw
netsh interface ip set address name=&quot;%1&quot; source=static address=%2 mask=%3
goto endp

:help
echo.
echo Usage: staticip interface-name ipaddress netmask [gateway]
echo.
echo Assigns a static IP to the network interface.
echo If the gateway is not defined, a default route is not created
echo. 

:endp
</pre>
<p>Copy the following code to a file called <strong><code>dhcpip.bat</code></strong> and keep it somewhere in your PATH.</p>
<pre class="brush: plain;">
@echo off
setlocal enableextensions enabledelayedexpansion

set argc=0
for %%x in (%*) do set /A argc+=1

if %argc% == 0 goto help
if %argc% == 1 goto doip

goto help

:doip
netsh interface ip set address name=&quot;%1&quot; source=dhcp
netsh interface ip set dns name=&quot;%1&quot; dhcp
goto endp

:help
echo.
echo Usage: dhcpip interface-name
echo.
echo Sets specified network interface to DHCP mode
echo. 

:endp
</pre>
<p>You can use the batch files by passing the necessary arguments similar to the examples shown below:</p>
<pre class="brush: plain; gutter: false; highlight: [1];">
C:\&gt;staticip &quot;Local Area Connection&quot; 192.168.1.10 255.255.255.0
</pre>
<pre class="brush: plain; gutter: false; highlight: [1];">
C:\&gt;dhcpip &quot;Local Area Connection&quot;
</pre>

<p><a href="http://feedads.g.doubleclick.net/~a/-5CyJSwdGw4z784x9YbwpTPTC4I/0/da"><img src="http://feedads.g.doubleclick.net/~a/-5CyJSwdGw4z784x9YbwpTPTC4I/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/-5CyJSwdGw4z784x9YbwpTPTC4I/1/da"><img src="http://feedads.g.doubleclick.net/~a/-5CyJSwdGw4z784x9YbwpTPTC4I/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.digitalinternals.com/158/20110619/change-ip-address-from-the-command-prompt/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Get the Home Directory of an User</title>
		<link>http://www.digitalinternals.com/155/20110529/how-to-get-the-home-directory-of-an-user/</link>
		<comments>http://www.digitalinternals.com/155/20110529/how-to-get-the-home-directory-of-an-user/#comments</comments>
		<pubDate>Sun, 29 May 2011 12:33:50 +0000</pubDate>
		<dc:creator>ibrahim</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[home directory]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[shell-script]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.digitalinternals.com/?p=155</guid>
		<description><![CDATA[To perform disk usage monitoring of users on a UNIX system, you will, first of all, need to determine the home directories of the users. You might ask, &#8220;Aren&#8217;t all the user home directories found under /home?&#8221;. Well, typically yes, but it&#8217;s not always true. There are a couple of ways to determine the home [...]]]></description>
			<content:encoded><![CDATA[<p>To perform disk usage monitoring of users on a UNIX system, you will, first of all, need to determine the home directories of the users. You might ask, &#8220;Aren&#8217;t all the user home directories found under <strong>/home</strong>?&#8221;.  Well, typically yes, but it&#8217;s not always true.</p>
<p><span id="more-155"></span></p>
<p>There are a couple of ways to determine the home directory of an user. I know of two methods at the moment.</p>
<ol>
<li>Extract the home directory field from /etc/passwd
<pre>
root@anfield:~# grep ibrahim /etc/passwd | awk -F":" '{ print $6 }'
/users/ibrahim
</pre>
</li>
<li>Use Tilde Expansion &#8211; this is useful when the user management/authentication is done via NIS or LDAP.
<pre>
root@anfield:~# echo ~ibrahim
/users/ibrahim
</pre>
</li>
</ol>

<p><a href="http://feedads.g.doubleclick.net/~a/tgRNw5ssiFDaU9A1cNjQSWuD_2Y/0/da"><img src="http://feedads.g.doubleclick.net/~a/tgRNw5ssiFDaU9A1cNjQSWuD_2Y/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/tgRNw5ssiFDaU9A1cNjQSWuD_2Y/1/da"><img src="http://feedads.g.doubleclick.net/~a/tgRNw5ssiFDaU9A1cNjQSWuD_2Y/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.digitalinternals.com/155/20110529/how-to-get-the-home-directory-of-an-user/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Perform Reverse DNS Lookup</title>
		<link>http://www.digitalinternals.com/153/20110331/how-to-perform-reverse-dns-lookup/</link>
		<comments>http://www.digitalinternals.com/153/20110331/how-to-perform-reverse-dns-lookup/#comments</comments>
		<pubDate>Thu, 31 Mar 2011 14:32:46 +0000</pubDate>
		<dc:creator>ibrahim</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[nslookup]]></category>
		<category><![CDATA[ping]]></category>
		<category><![CDATA[reverse dns]]></category>

		<guid isPermaLink="false">http://www.digitalinternals.com/?p=153</guid>
		<description><![CDATA[Everyone knows that DNS is used to translate hostnames to IP addresses, but do you know that DNS can also be used to retrieve the domain name when the IP address is known? I am not a DNS guru, but I do know that the ping command in Windows can be used to resolve IP [...]]]></description>
			<content:encoded><![CDATA[<p>Everyone knows that DNS is used to translate hostnames to IP addresses, but do you know that DNS can also be used to retrieve the domain name when the IP address is known?<span id="more-153"></span></p>
<p>I am not a DNS guru, but I do know that the <strong><code>ping</code></strong> command in Windows can be used to resolve IP addresses to hostnames by using the <strong><code>-a</code></strong> option.</p>
<pre>
C:\Users\ibrahim>ping -a 8.8.4.4

Pinging google-public-dns-b.google.com [8.8.4.4] with 32 bytes of data:
Reply from 8.8.4.4: bytes=32 time=31ms TTL=50
Reply from 8.8.4.4: bytes=32 time=22ms TTL=53
Reply from 8.8.4.4: bytes=32 time=24ms TTL=50
Reply from 8.8.4.4: bytes=32 time=23ms TTL=50

Ping statistics for 8.8.4.4:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 22ms, Maximum = 31ms, Average = 25ms
</pre>
<p>I had no clue how the reverse DNS query was performed by the ping command. To find out, I decided to analyse the DNS lookup query by using Wireshark, a network protocol analyzer. While trying to get the DNS name of the IP address of <strong>8.8.4.4</strong> (one of Google&#8217;s public DNS servers), I performed a packet capture.</p>
<p><img src="http://i.digitalinternals.com/2011/03/153/wireshark-reversedns.png" alt="wireshark reverse dns packet capture" /></p>
<p>After some reading up, I managed to find out how reverse DNS works.</p>
<ol>
<li>The IP address is first reversed and the string &#8220;<strong>.in-addr.arpa</strong>&#8221; is added to the end of the IP address. So if the IP address is <strong>8.8.4.4</strong>, then the query becomes &#8220;<strong>4.4.8.8.in-addr.arpa</strong>&#8220;</li>
<li>The DNS query type is <strong>PTR</strong></li>
<li>The DNS query class is <strong>IN</strong></li>
</ol>
<p>Now we have the necessary info to perform reverse DNS lookup using <strong>nslookup</strong>, a DNS query tool.</p>
<pre>
C:\Users\ibrahim>nslookup
Default Server:  google-public-dns-a.google.com
Address:  8.8.8.8

> set type=PTR
> set class=IN
> 4.4.8.8.in-addr.arpa
Server:  google-public-dns-a.google.com
Address:  8.8.8.8

Non-authoritative answer:
4.4.8.8.in-addr.arpa    name = google-public-dns-b.google.com
</pre>
<p>Is it too complicated? Fret not! There is another simpler way to do it using <strong>nslookup</strong>! Here you go:</p>
<pre>
C:\Users\ibrahim>nslookup 8.8.4.4
Server:  google-public-dns-a.google.com
Address:  8.8.8.8

Name:    google-public-dns-b.google.com
Address:  8.8.4.4
</pre>

<p><a href="http://feedads.g.doubleclick.net/~a/981V9iMaB3cxHVxvDGh09PeJ46o/0/da"><img src="http://feedads.g.doubleclick.net/~a/981V9iMaB3cxHVxvDGh09PeJ46o/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/981V9iMaB3cxHVxvDGh09PeJ46o/1/da"><img src="http://feedads.g.doubleclick.net/~a/981V9iMaB3cxHVxvDGh09PeJ46o/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.digitalinternals.com/153/20110331/how-to-perform-reverse-dns-lookup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Access Experts Exchange Answers for Free</title>
		<link>http://www.digitalinternals.com/151/20110221/access-experts-exchange-answers-for-free/</link>
		<comments>http://www.digitalinternals.com/151/20110221/access-experts-exchange-answers-for-free/#comments</comments>
		<pubDate>Mon, 21 Feb 2011 14:11:23 +0000</pubDate>
		<dc:creator>ibrahim</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[experts-exchange]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[subscription]]></category>

		<guid isPermaLink="false">http://www.digitalinternals.com/?p=151</guid>
		<description><![CDATA[Have you ever asked Google something, and it replied that the answer could be found at the Experts-Exchange.com site ? Only after clicking on that link do you realise that the answer can only be viewed after becoming a premium member. If you would like to view the answers from Experts-Exchange without any subscription or [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft" src="http://i.digitalinternals.com/2011/02/151/ee_logo.png" alt="experts-exchange logo" />Have you ever asked Google something, and it replied that the answer could be found at the Experts-Exchange.com site ? Only after clicking on that link do you realise that the answer can only be viewed after becoming a premium member. If you would like to view the answers from Experts-Exchange without any subscription or login account, read on.</p>
<p><span id="more-151"></span></p>
<p>Have you ever wondered why the answer are always available to Google but not to you ? Experts-Exchange seems to give free full access to the answers if they detect Googlebot, or Google&#8217;s web crawling robot. They therefore enable Google to index the entire page, as opposed to just indexing the questions.</p>
<p>Another thing that I have always noticed is that, if a Experts-Exchange link is clicked from the Google search results page, I am able to view the answers for a couple of (usually in the range of five to seven) questions. Beyond that, I am forced to subscribe. This means that the Experts-Exchange site looks at the HTTP referrer as well as the cookie information to determine if you are given free access to view the answers.</p>
<p>Now, let&#8217;s get started! By the way, this trick only works on Mozilla Firefox.</p>
<ol>
<li>Install the <a href="https://addons.mozilla.org/en-US/firefox/addon/user-agent-switcher/">User Agent Switcher</a> and <a href="https://addons.mozilla.org/en-US/firefox/addon/refcontrol/">RefControl</a> addons and restart Firefox</li>
<li>From Firefox <strong>Options</strong> window, select <strong>Show Cookies</strong> from the <strong>Privacy</strong> tab. Search for &#8220;experts-exchange.com&#8221; and delete all the cookies.
<p><img src="http://i.digitalinternals.com/2011/02/151/ff_cookies.png" alt="mozilla firefox cookies" /></p>
</li>
<li>From the <strong>Options</strong> window, select <strong>Exceptions</strong> from the <strong>Privacy</strong> tab. Enter &#8220;experts-exchange.com&#8221; and click on the <strong>Block </strong> button.
<p><img src="http://i.digitalinternals.com/2011/02/151/ff_exceptions.png" alt="mozilla firefox exceptions" /></p>
</li>
<li>Click on <strong>RefControl Options</strong> and set <strong>Site</strong> to <strong>www.experts-exchange.com</strong>. Set the <strong>Action</strong> to <strong>Custom</strong> and set it to <strong>http://www.google.com/</strong>
<p><img src="http://i.digitalinternals.com/2011/02/151/refcontrol.png" alt="mozilla firefox refcontrol" /></li>
<li>Access the User Agent Switcher options and select &#8216;Googlebot&#8217;
<p><img src="http://i.digitalinternals.com/2011/02/151/ua_switcher.png" alt="mozilla firefox user agent switcher" /></li>
<li>Now try accessing the Experts-Exchange site. The answers can be found at the bottom of the page!</li>
</ol>
<p>This trick has been working well for me for a month or so. If it does not work anymore, it means that Experts-Exchange has tweaked or improved their logic.</p>
<p><img class="alignright" src="http://i.digitalinternals.com/2011/02/151/gcache.png" alt="google cache link" /> By the way, if you don&#8217;t already know, you can also view the Experts-Exchange answers by clicking on the Google cached view link.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/KMbFihdP1GDFDNRbt4abDu3qek0/0/da"><img src="http://feedads.g.doubleclick.net/~a/KMbFihdP1GDFDNRbt4abDu3qek0/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/KMbFihdP1GDFDNRbt4abDu3qek0/1/da"><img src="http://feedads.g.doubleclick.net/~a/KMbFihdP1GDFDNRbt4abDu3qek0/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.digitalinternals.com/151/20110221/access-experts-exchange-answers-for-free/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WZR-HP-G300NH Modding Guide</title>
		<link>http://www.digitalinternals.com/150/20110130/wzr-hp-g300nh-modding-guide/</link>
		<comments>http://www.digitalinternals.com/150/20110130/wzr-hp-g300nh-modding-guide/#comments</comments>
		<pubDate>Sun, 30 Jan 2011 14:01:37 +0000</pubDate>
		<dc:creator>ibrahim</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bittorrent]]></category>
		<category><![CDATA[buffalo]]></category>
		<category><![CDATA[dd-wrt]]></category>
		<category><![CDATA[optware]]></category>
		<category><![CDATA[transmission]]></category>
		<category><![CDATA[wzr-hp-g300-nh]]></category>

		<guid isPermaLink="false">http://www.digitalinternals.com/?p=150</guid>
		<description><![CDATA[I recently upgraded to a Buffalo WZR-HP-G300NH home broadband router after my Linksys WRT54GL router running on DD-WRT died on me. I was looking for a router that could support the custom DD-WRT firmware, USB storage, BitTorrent downloads, Optware and with Wireless-N capability. The Buffalo WZR-HP-G300NH simply met all my requirements! This article will guide [...]]]></description>
			<content:encoded><![CDATA[<p>I recently upgraded to a Buffalo WZR-HP-G300NH home broadband router after my Linksys WRT54GL router running on <a href="http://www.dd-wrt.com/">DD-WRT</a> died on me. I was looking for a router that could support the custom DD-WRT firmware, USB storage, BitTorrent downloads, <a href="http://www.nslu2-linux.org/wiki/Optware/Packages">Optware</a> and with Wireless-N capability. The Buffalo WZR-HP-G300NH simply met all my requirements!</p>
<p><span id="more-150"></span></p>
<p>This article will guide you on how to install a vanilla version of DD-WRT on the router together with the <a href="http://www.transmissionbt.com/">Transmission</a> BitTorrent client running on top of Optware.</p>
<h5>Install DD-WRT</h5>
<p>Buffalo ships the current models of the WZR-HP-G300NH routers with DD-WRT firmware, but features like SSH are disabled. I was also unable to install additional packages using Optware, therefore I decided to mod the router with a vanilla version of DD-WRT.</p>
<p>For the normal DD-WRT releases, goto <a href="http://www.dd-wrt.com/site/support/router-database">DD-WRT Router Database</a> and enter &#8220;WZR-HP-G300NH&#8221; in the search box. Download the image which is used for the initial flashing.</p>
<p><img src="http://i.digitalinternals.com/2011/01/150/router-database.gif" alt="dd-wrt router database" /></p>
<p>For the latest DD-WRT releases, go <a href="http://www.dd-wrt.com/site/support/other-downloads">here</a> and navigate to &#8220;Downloads -> others -> eko -> BrainSlayer-V24-preSP2&#8243; and navigate further into the latest DD-WRT firmware build directory and download the latest available firmware images.</p>
<p><img src="http://i.digitalinternals.com/2011/01/150/other-downloads.gif" alt="dd-wrt other downloads" /></p>
<p>Flash the router using the router&#8217;s web interface once you have downloaded the firmware. I am using the latest DD-WRT firmware that was released on the 24-Dec-2010. Remember to change the password and configure the router as necessary. I will not go into details on the basic configuration for the router as the <a href="http://www.dd-wrt.com/wiki/index.php/Main_Page">DD-WRT wiki</a> site has all the necessary details.</p>
<h5>Prepare USB Disk</h5>
<p>To use the USB disk with the router, at least one of the partitions has to be formatted as ext2 or ext3. I recommend to use the ext3 partition. If you do not have a Linux machine to do the partitioning, do not panic. You can use the <a href="http://www.minitool-partitionrecovery.com/download.html">MiniTool Partition Wizard Home Edition</a> to modify the partitions of the USB disk within Windows. Create a primary partition and format it as ext3.</p>
<p>Before plugging in the USB disk to the router, enable the USB support in the router. Under DD-WRT web gui, navigate to &#8220;Services -> USB&#8221; and turn on all the features and set the mount point to be &#8220;/mnt&#8221;.</p>
<p><img src="http://i.digitalinternals.com/2011/01/150/ddwrt-usb-options.gif" alt="dd-wrt usb support" /></p>
<p>To transfer files between the USB disk and to my PC, I use FTP. Enable FTP in the router by navigating to &#8220;Services -> NAS&#8221;. You can specify username-password combinations for the FTP login if necessary.</p>
<p><img src="http://i.digitalinternals.com/2011/01/150/ddwrt-ftp.gif" alt="dd-wrt nas ftp" /></p>
<p>Connect the USB disk to the router once you are done.</p>
<h5>Directory and mount-point structure</h5>
<p>I am using the following directory structure:</p>
<ul>
<li><strong>/mnt</strong><br />
<blockquote><p>mount point for the USB disk</p></blockquote>
</li>
<li><strong>/mnt/d01/torrent</strong><br />
<blockquote><p>directory used to hold the torrent configuration as well as the torrent downloads</p></blockquote>
</li>
<li><strong>/mnt/opt_xx</strong> eg. <strong>/mnt/opt_01</strong>, <strong>/mnt/opt_02</strong><br />
<blockquote><p>different optware installation directories for different possible optware builds</p></blockquote>
</li>
<li><strong>/opt</strong><br />
<blockquote><p>this directory will be mounted with a loopback device by pointing to one of the optware directories (eg. /mnt/opt_xx ). this will give the flexibility to test different optware packages just by mounting a different source directory.</p></blockquote>
</li>
</ul>
<h5>Configure Optware and Transmission</h5>
<p>The default Optware packages for DD-WRT are built for the mipsel architecture. The Buffalo WZR-HP-G300NH is using Atheros chipset which is based on mips architecture. I got the optware packages for this router from <a href="http://www.openwrt.org/">OpenWrt</a> site. Do note that the optware packages will be accessible via a chroot&#8217;ed environment.</p>
<p>To proceed further, you will need a SSH client. I am using the free PuTTY SSH client. SSH to the router and run the following commands.</p>
<pre class="brush: bash; gutter: false; highlight: [1]; wrap-lines: false;">
# touch /mnt/optware.enable
# mkdir /mnt/opt_01
# cd /mnt/opt_01
# mkdir dev ; mkdir sys ; mkdir proc ; mkdir tmp ; mkdir -p var/lock ; mkdir d01
# mkdir -p /mnt/d01/torrent/dl
# mkdir -p /mnt/d01/torrent/.config/transmission
# mkdir -p /mnt/d01/torrent/.incomplete
# mkdir -p /mnt/d01/torrent/.watch
# wget http://downloads.openwrt.org/backfire/10.03.1-rc3/ar71xx/openwrt-ar71xx-rootfs.tar.gz
# tar xzvf openwrt-ar71xx-rootfs.tar.gz
# echo &quot;export PS1='[\u@\h:(chroot)\w]\$ '&quot; &gt;&gt; /mnt/opt_01/etc/profile
# mkdir /opt
# mount -o bind /mnt/opt_01 /opt
# mount -o bind /mnt/d01 /opt/d01
# for fs in dev sys proc tmp ; do mount -o bind /$fs /opt/$fs ; done
# cd /
# chroot /opt /bin/sh --login
</pre>
<p>You should now be in a chroot&#8217;ed optware environment. Continue installing the optware packages.</p>
<pre class="brush: bash; gutter: false; wrap-lines: false;">
# opkg update
# opkg --force-overwrite install coreutils
# opkg install transmission-daemon
# opkg install transmission-remote
# opkg install transmission-cli
# opkg install transmission-web
# opkg install tune2fs
</pre>
<p>Now, modify the configuration file, <strong>/etc/config/transmission</strong> (in the chroot&#8217;ed environment), which is used for the Transmission BitTorrent client. The contents of my configuration file can be found below. Take note of the directory related options.</p>
<pre class="brush: plain; gutter: false;">
config transmission
        option enable 1
        option config_dir '/d01/torrent/.config/transmission'
        option alt_speed_down 50
        option alt_speed_enabled false
        option alt_speed_time_begin  540
        option alt_speed_time_day 127
        option alt_speed_time_enabled false
        option alt_speed_time_end 1020
        option alt_speed_up 50
        option bind_address_ipv4 '0.0.0.0'
        option bind_address_ipv6 '::'
        option blocklist_enabled false
        option dht_enabled true
        option download_dir '/d01/torrent/dl'
        option encryption 1
        option incomplete_dir '/d01/torrent/.incomplete'
        option incomplete_dir_enabled false
        option lazy_bitfield_enabled true
        option lpd_enabled false
        option message_level 2
        option open_file_limit 32
        option peer_limit_global 240
        option peer_limit_per_torrent 60
        option peer_port 51413
        option peer_port_random_high 65535
        option peer_port_random_low 49152
        option peer_port_random_on_start false
        option peer_socket_tos 0
        option pex_enabled true
        option port_forwarding_enabled true
        option preallocation 1
        option proxy &quot;&quot;
        option proxy_auth_enabled false
        option proxy_auth_password ''
        option proxy_auth_username ''
        option proxy_enabled false
        option proxy_port 80
        option proxy_type 0
        option ratio_limit 2.0000
        option ratio_limit_enabled false
        option rename_partial_files true
        option rpc_authentication_required false
        option rpc_bind_address '0.0.0.0'
        option rpc_enabled true
        option rpc_password ''
        option rpc_port 9091
        option rpc_username ''
        option rpc_whitelist '127.0.0.1,192.168.1.*'
        option rpc_whitelist_enabled true
        option script_torrent_done_enabled false
        option script_torrent_done_filename ''
        option speed_limit_down 4096
        option speed_limit_down_enabled true
        option speed_limit_up 32
        option speed_limit_up_enabled true
        option start_added_torrents true
        option trash_original_torrent_files false
        option umask 18
        option upload_slots_per_torrent 14
        option watch_dir_enabled false
        option watch_dir '/d01/torrent/.watch'
</pre>
<p>Exit out of the chroot&#8217;ed enviroment and unmount the USB disk.</p>
<pre class="brush: bash; gutter: false; wrap-lines: false;">
# exit
# for fs in dev sys proc tmp ; do umount /opt/$fs ; done
# umount /opt/d01
# umount /opt
# umount /mnt
</pre>
<h5>Enable Autostart of Transmission BitTorrent Client</h5>
<p>To automatically start the Transmission client during the router&#8217;s startup, we will need to make use of DD-WRT&#8217;s startup scripts.</p>
<p>The scripts will auto-mount the USB disk on startup and will also start the torrent client. Once the USB disk is mounted, the scripts will also enable the blue LED at the back of the router. When the disk is unmounted, the blue LED will be turned off.</p>
<p>The scripts will also configure the AOSS switch on the router as a toggle switch. Upon every press of the switch, the scripts will automatically either mount or unmount the USB disk. In this way, you may press the AOSS button to shutdown the torrent client and also to unmount the USB disk before you poweroff the router.</p>
<p>From DD-WRT web interface, navigate to &#8220;Administration -> Commands&#8221;.</p>
<p>Copy the following code and save it to the &#8216;Custom Script section:</p>
<pre class="brush: bash;">
#!/bin/sh

# usb mount/umount script, this script will be saved in /tmp/custom.sh

# this is where the usb disk will be mounted
USBMP=/mnt

# directory pointintg to the physical optware root
OROOT=$USBMP/opt_01

# directory to mount the optware root; $OROOT will be mounted under this dir
OMP=/opt

# directory where the torrent data resides in the usb disk
TORRENTROOT=$USBMP/d01

# directory to mount the torrent data; must be somewhere under optware root
# $TORRENTROOT will be mounted under this dir
TORRENTMP=$OMP/d01

# GPIO USB led number
GPIO_LED_USB=0

# usb partition 1 device
USBPART1=/dev/sda1
USBFS=ext3

# aoss button script; refer to http://www.dd-wrt.com/wiki/index.php/Script_Execution
AOSS_SCRIPT=/tmp/etc/config/usbdisk.sesbutton

# pidfile
PIDFILE=/var/run/rc_custom.pid

BIN=rc_custom

# the PATH was not set correctly and chroot was not found initially,
# therefore set the PATH variable
PATH=$PATH:/opt/sbin:/opt/bin:/opt/usr/sbin:/opt/usr/bin

# debug flag
debugon=1

# will return 0 if mounted
is_usb_mounted ()
{
  grep -q $USBPART1 /proc/mounts
}

usb_mount ()
{
  debugprint &quot;attempting to mount usb&quot;
  logger -p info -t $BIN &quot;attempting to mount usb&quot;

  # if partition does not exist, just terminate
  [ -z &quot;$USBPART1&quot; ] &amp;&amp; exit 0
  debugprint &quot;usb disk found&quot;

  sleep 2
  mount -t $USBFS $USBPART1 $USBMP

  # turn on USB led if mounted
  gpio enable $GPIO_LED_USB
  is_usb_mounted
  [ $? -eq 0 ] &amp;&amp; ( debugprint &quot;usb mounted&quot; ; gpio disable $GPIO_LED_USB )

  if [ -f $USBMP/optware.enable ]; then
  mount -o bind $OROOT       $OMP
  #mount -o bind $OMP/etc     /etc
  for fs in dev sys proc tmp ; do mount -o bind /$fs /$OMP/$fs ; done
  mount -o bind $TORRENTROOT    $TORRENTMP
  mkdir /$OMP/var/lock
  echo UTC &gt; /tmp/TZ

  chroot $OMP /etc/init.d/transmission start
  sleep 5
  [ -n &quot;`pidof transmission-daemon`&quot; ] &amp;&amp;  debugprint &quot;transmission-daemon started&quot;
  fi
}

usb_umount ()
{
  debugprint &quot;attempting to umount usb&quot;
  logger -p info -t $BIN &quot;attempting to umount usb&quot;

  # transmission takes a while to terminate
  n=1
  while true; do
    chroot $OMP /etc/init.d/transmission stop
    sleep 1
    [ ! -n &quot;`pidof transmission-daemon`&quot; ] &amp;&amp; break
    sleep 4
    [ $n -gt 5 ] &amp;&amp; break
    let n+=1
  done

  # sometimes transmission is not killed properly, if not killed, do not proceed
  [ -n &quot;`pidof transmission-daemon`&quot; ] &amp;&amp; return
  debugprint &quot;transmission-daemon killed&quot;

  umount $TORRENTMP
  for fs in dev sys proc tmp ; do umount $OMP/$fs ; done
  #umount /etc
  umount $OMP
  umount $USBMP

  # turn off USB led if not mounted
  is_usb_mounted
  [ $? -eq 1 ] &amp;&amp; ( debugprint &quot;usb unmounted&quot; ; gpio enable $GPIO_LED_USB )

}

prepare_aoss_script ()
{
  #prepare for disk mount/umount when AOSS button is pressed

  # return if file is already there
  mkdir -p `dirname $AOSS_SCRIPT`
  ln -s /tmp/custom.sh $AOSS_SCRIPT
}

debugprint ()
{
  [ $debugon -eq 1 ] &amp;&amp; printf &quot;usbmount: %s\n&quot; &quot;$1&quot;
}

# before doing anything, check if we are already running
[ -f $PIDFILE ] &amp;&amp; [ -d /proc/`cat $PIDFILE` ] &amp;&amp; exit
echo $$ &gt; $PIDFILE

mountarg=usbumount

is_usb_mounted
[ $? -eq 1 ] &amp;&amp; mountarg=&quot;usbmount&quot;
[ $# -eq 1 ] &amp;&amp; mountarg=$1

case &quot;$mountarg&quot; in
  usbmount)
          #is_usb_mounted
          #[ $? -eq 1 ] &amp;&amp; usb_mount
          usb_mount
          ;;

  usbumount)
          is_usb_mounted
          [ $? -eq 0 ] &amp;&amp; usb_umount
          ;;

  prepareaoss)
          prepare_aoss_script
          ;;

  *)
          exit
          ;;
esac

rm -rf $PIDFILE
</pre>
<p>Copy the following code and save it to the &#8216;Startup&#8217; section:</p>
<pre class="brush: plain; gutter: false;">
sleep 20

/tmp/custom.sh usbmount
/tmp/custom.sh prepareaoss
</pre>
<p>Copy the following code and save it to the &#8216;Shutdown&#8217; section:</p>
<pre class="brush: plain; gutter: false;">
/tmp/custom.sh usbumount
</pre>
<p>Finally, we will need to open the firewall ports for the torrent client to work. Copy the following code and save it to the &#8216;Firewall&#8217; section:</p>
<pre class="brush: plain; gutter: false;">
iptables -I INPUT 1 -p tcp --dport 51413 -j logaccept
iptables -I INPUT 1 -p udp --dport 51413 -j logaccept
</pre>
<p>Save the changes and reboot the router for the changes to take effect.</p>
<p>The web interface for the Transmission BitTorrent client can be accessed on port 9091. If your router&#8217;s IP address is 192.168.1.1, try opening the URL <a href="http://192.168.1.1:9091/">http://192.168.1.1:9091/</a> from your browser.</p>
<h5>Final Notes</h5>
<ol>
<li>To access the chroot&#8217;ed Optware environment, run the following chroot command within a SSH session:
<pre class="brush: bash; gutter: false;">
# chroot /opt /bin/sh --login
</pre>
</li>
<li>The block device that I am using in the script to point to the USB disk is <strong>/dev/sda1</strong>. In older DD-WRT firmwares, it used to be <strong>/dev/scsi/host0/bus0/target0/lun0/part1</strong>.</li>
<li>You may want to perform a manual filesystem check on the USB disk once a while to check for a possible filesystem corruption, if any.</li>
<li>Buffalo has an alternate DD-WRT (Professional) firmware version for this router, but this firmware does not seem to work on Asian models of the same router model.</li>
<li>The latest Optware packages from OpenWrt can be downloaded from <a href="http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/">http://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/</a>. But the torrent downloads were frequently getting corrupted with the latest snapshots, therefore I opted for an older build of Optware.</li>
</ol>

<p><a href="http://feedads.g.doubleclick.net/~a/wqtKug7b4Eh2T_XWr4HhKW-qoO4/0/da"><img src="http://feedads.g.doubleclick.net/~a/wqtKug7b4Eh2T_XWr4HhKW-qoO4/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/wqtKug7b4Eh2T_XWr4HhKW-qoO4/1/da"><img src="http://feedads.g.doubleclick.net/~a/wqtKug7b4Eh2T_XWr4HhKW-qoO4/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.digitalinternals.com/150/20110130/wzr-hp-g300nh-modding-guide/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Facebook E-Mail Address for Engineering Puzzles Submission</title>
		<link>http://www.digitalinternals.com/148/20101229/facebook-e-mail-address-for-engineering-puzzles-submission/</link>
		<comments>http://www.digitalinternals.com/148/20101229/facebook-e-mail-address-for-engineering-puzzles-submission/#comments</comments>
		<pubDate>Wed, 29 Dec 2010 14:02:22 +0000</pubDate>
		<dc:creator>ibrahim</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[puzzle]]></category>

		<guid isPermaLink="false">http://www.digitalinternals.com/?p=148</guid>
		<description><![CDATA[Have you tried the Engineering Puzzles found on Facebook ? You not only need to solve the puzzle but you will also need to decode the e-mail address ({0xFACEB00C&#62;&#62;2 in decimal}@fb.com) that is used for the submission of the answers for the various puzzles. If you send an e-mail to that address as it is, [...]]]></description>
			<content:encoded><![CDATA[<p>Have you tried the <a href="http://www.facebook.com/careers/puzzles.php">Engineering Puzzles</a> found on Facebook ? You not only need to solve the puzzle but you will also need to decode the e-mail address (<strong>{0xFACEB00C&gt;&gt;2 in decimal}@fb.com</strong>) that is used for the submission of the answers for the various puzzles.</p>
<p><span id="more-148"></span></p>
<p>If you send an e-mail to that address as it is, it will most probably bounce back. You will need to decode that piece of information.</p>
<ol>
<li><strong>0x</strong> &#8211; means that <strong>FACEB00C</strong> is to be interpreted as hexadecimal code.
<p><strong>0xFACEB00C</strong> is <strong>11111010110011101011000000001100</strong> in binary.</p>
</li>
<li><strong>&gt;&gt;2</strong> &#8211; means that a right bit shift operation has to be performed twice.
<p><strong>11111010110011101011000000001100</strong> bit-shifted twice to the right becomes <strong>111110101100111010110000000011</strong></p>
</li>
<li><strong>in decimal</strong> &#8211; so we convert our result to decimal, which is 1051962371</li>
</ol>
<p>There, we got the result. The e-mail address to send your results is <strong>1051962371@fb.com</strong>. I really wonder how many spam mails would they get in a day!</p>

<p><a href="http://feedads.g.doubleclick.net/~a/mtkx6-iiUc7g6FjfNURx7qySDFA/0/da"><img src="http://feedads.g.doubleclick.net/~a/mtkx6-iiUc7g6FjfNURx7qySDFA/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/mtkx6-iiUc7g6FjfNURx7qySDFA/1/da"><img src="http://feedads.g.doubleclick.net/~a/mtkx6-iiUc7g6FjfNURx7qySDFA/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.digitalinternals.com/148/20101229/facebook-e-mail-address-for-engineering-puzzles-submission/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

