<?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>Gaurav &#187; security</title>
	<atom:link href="http://allyourcodearebelongto.me/blog/category/security/feed/" rel="self" type="application/rss+xml" />
	<link>http://allyourcodearebelongto.me/blog</link>
	<description>All About Everything</description>
	<lastBuildDate>Sun, 23 Nov 2008 19:44:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>New and Improved Sudo for Vista (now remembers credentials)</title>
		<link>http://allyourcodearebelongto.me/blog/2008/04/02/new-and-improved-sudo-for-vista-now-remembers-credentials/</link>
		<comments>http://allyourcodearebelongto.me/blog/2008/04/02/new-and-improved-sudo-for-vista-now-remembers-credentials/#comments</comments>
		<pubDate>Wed, 02 Apr 2008 11:02:14 +0000</pubDate>
		<dc:creator>Gaurav</dc:creator>
				<category><![CDATA[security]]></category>
		<category><![CDATA[sudo]]></category>
		<category><![CDATA[vista]]></category>
		<category><![CDATA[vista, security]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://techblogging.wordpress.com/2008/04/02/new-and-improved-sudo-for-vista-now-remembers-credentials/</guid>
		<description><![CDATA[In one of my earlier blog post I shared source code for a simple utility that I had made. It could be used to launch elevated processes from the command line.
So opening a Elevated command prompt was as simple as writing


sudo cmd


Actually the code for this is very simple as it just executes a well [...]]]></description>
			<content:encoded><![CDATA[<p>In one of my earlier <a href="http://techblogging.wordpress.com/2007/11/28/sudo-for-vista/">blog post</a> I shared source code for a simple utility that I had made. It could be used to launch elevated processes from the command line.</p>
<p>So opening a Elevated command prompt was as simple as writing</p>
<div style="border-right:gray 1px solid;border-top:gray 1px solid;font-size:8pt;overflow:auto;border-left:gray 1px solid;width:97.5%;cursor:text;max-height:200px;line-height:12pt;border-bottom:gray 1px solid;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;margin:20px 0 10px;padding:4px;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;padding:0;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;">sudo cmd</pre>
</div>
</div>
<p>Actually the code for this is very simple as it just executes a well documented system function <a href="http://msdn2.microsoft.com/en-us/library/ms647732.aspx">ShellExecute</a>.</p>
<p>I have made some changes to the script and now it remembers the credentials. So once you execute any command, Vista will ask you confirmation only once and any subsequent call won&#8217;t ask for the confirmation with the UAC dialog box.</p>
<p><span id="more-80"></span></p>
<p>The concept behind this is very simple too:</p>
<p>A process launched from any elevated process will be (by default) automatically elevated at administrative assess. So what this script (client) does is launch a <em>elevated Ruby server </em>first time you run it, so it will Vista will prompt you for confirmation. For any subsequent call it will just see that the server is already running and it will just use that server for elevating launched processes.</p>
<p><u></u>&nbsp;</p>
<h4><u>How it works:</u></h4>
<p>When you write &#8220;sudo cmd&#8221; in the command prompt (or run it any where else):</p>
<ul>
<li>Check if the &#8220;sudo server&#8221; process is running. If not then start it. (This will result in a UAC prompt).
<li>Connect to the server using TCP and ask it to run the command &#8220;sudo cmd&#8221;.
<li>The server will launch the elevated process.</li>
</ul>
<p>&nbsp;</p>
<p>The code for Client and the Server is in Ruby and thus can easily be improved upon. One can easily add code to kill the server after a specific time interval or after running a fixed number of commands. Actually <strong>I am not sure if this is the correct way to handle this</strong>, so any comments will be welcome.</p>
<p>&nbsp;<u><a href="http://cid-49208a72e4eb818c.skydrive.live.com/self.aspx/world/code/sudo.rar">Download Here</a></u></p>
<p>Just un-rar this file anywhere and add it to <a href="http://banagale.com/changing-your-system-path-in-windows-vista.htm">system path</a>. To run it just write sudo &lt;command name&gt; in &#8220;command prompt&#8221; of in the &#8220;Run dialog box&#8221;. Example to run notepad: &#8220;sudo notepad&#8221;</p>
<p>This code was written with ruby 1.8.6.</p>
]]></content:encoded>
			<wfw:commentRss>http://allyourcodearebelongto.me/blog/2008/04/02/new-and-improved-sudo-for-vista-now-remembers-credentials/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sudo for Vista</title>
		<link>http://allyourcodearebelongto.me/blog/2007/11/28/sudo-for-vista/</link>
		<comments>http://allyourcodearebelongto.me/blog/2007/11/28/sudo-for-vista/#comments</comments>
		<pubDate>Wed, 28 Nov 2007 05:16:40 +0000</pubDate>
		<dc:creator>Gaurav</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[vista]]></category>

		<guid isPermaLink="false">http://techblogging.wordpress.com/2007/11/28/sudo-for-vista/</guid>
		<description><![CDATA[The following ruby script when given any executable file path as the argument runs it in administrative mode.


   1: require 'Win32API'
   2:&#160; 
   3: def shell_execute(process_name)
   4:     process = ''
   5:     process.replace(process_name)
   6:   [...]]]></description>
			<content:encoded><![CDATA[<p>The following ruby script when given any executable file path as the argument runs it in administrative mode.</p>
<div>
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;padding:0;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   1:</span> require <span style="color:#008000;">'Win32API'</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   2:</span>&nbsp; </pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   3:</span> def shell_execute(process_name)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   4:</span>     process = <span style="color:#008000;">''</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   5:</span>     process.replace(process_name)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   6:</span>     se = Win32API.<span style="color:#0000ff;">new</span>(<span style="color:#006080;">"shell32"</span>, <span style="color:#006080;">"ShellExecute"</span>, [<span style="color:#008000;">'P','P','P','P','P','I'], 'I')</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   7:</span>     se.<span style="color:#0000ff;">Call</span>(nil,<span style="color:#006080;">"runas"</span>,process,nil,nil,5)</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   8:</span> <span style="color:#0000ff;">end</span></pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   9:</span>&nbsp; </pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  10:</span> shell_execute(ARGV[0])</pre>
</div>
</div>
<p>&nbsp;</p>
<p>In Vista you can do the same by right clicking on the file and selecting &#8220;Run as Administrator&#8221; but this script allows you to run a process in admin mode using the command line.</p>
<p>The ShellExecute function resides in the shell32.dll and is documented <a href="http://msdn2.microsoft.com/en-us/library/ms647732.aspx">here</a>.</p>
<p>By just giving &#8220;runas&#8221; as the second parameter to the function the process is executed in the administrative mode.</p>
]]></content:encoded>
			<wfw:commentRss>http://allyourcodearebelongto.me/blog/2007/11/28/sudo-for-vista/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Disabling Vista UAC Temporarily</title>
		<link>http://allyourcodearebelongto.me/blog/2007/10/09/disabling-vista-uac-temporarily/</link>
		<comments>http://allyourcodearebelongto.me/blog/2007/10/09/disabling-vista-uac-temporarily/#comments</comments>
		<pubDate>Tue, 09 Oct 2007 12:47:21 +0000</pubDate>
		<dc:creator>Gaurav</dc:creator>
				<category><![CDATA[security]]></category>
		<category><![CDATA[vista, security]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://techblogging.wordpress.com/2007/10/09/disabling-vista-uac-temporarily/</guid>
		<description><![CDATA[From Wikipedia:    User Account Control (UAC) is a technology and security infrastructure introduced with Microsoft&#8217;s Windows Vista operating system. It aims to improve the security of Windows by limiting applications to standard user privileges until an administrator authorizes an increase in privilege level, in a manner very similar to that seen in [...]]]></description>
			<content:encoded><![CDATA[<p>From <a href="http://en.wikipedia.org/wiki/User_Account_Control" target="_blank">Wikipedia</a>:    <br /><em>User Account Control (UAC) is a technology and security infrastructure introduced with Microsoft&#8217;s Windows Vista operating system. It aims to improve the security of Windows by limiting applications to standard user privileges until an administrator authorizes an increase in privilege level, in a manner very similar to that seen in Ubuntu Linux.</em></p>
<p>So this allows a normal user to have elevated privileges whenever required.</p>
<p>Also I always give the default user read only permission and the administrator full permission to the folder that contains my important data. This way I can be sure that if any virus manages to break into my system, it is not able to corrupt my important data.</p>
<p>So by running in the non-admin mode I cannot move files inside the folder that contains my important data or install any software without being prompted for my permission. This can be very annoying especially you are installing many softwares. A work-around for this is opening a command prompt with admin privileges and using that for moving and installing stuff.</p>
<p>Another way of doing this is by opening the explorer.exe process with admin privileges. This doesn&#8217;t work by default as opening explorer.exe doesn&#8217;t create a new instance of it. To make explorer.exe open new instances every time you have to enable it. It can be enabled by opening any folder, selecting organize from the toolbar -&gt; Folder and Search options -&gt; View (tab) and check the option &quot;Launch folder windows in separate process&quot;.</p>
<p>That&#8217;s it, now whenever you open explorer.exe from the Vista start menu with admin privileges by right clicking it, any process that you open from inside it will not prompt you for confirmation and thus saving you the headache as you will be in admin mode inside that window.</p>
]]></content:encoded>
			<wfw:commentRss>http://allyourcodearebelongto.me/blog/2007/10/09/disabling-vista-uac-temporarily/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

