<?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>Just Uber &#187; coding</title>
	<atom:link href="http://www.justuber.com/blog/tag/coding/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.justuber.com/blog</link>
	<description>Dancing with Nerds</description>
	<lastBuildDate>Thu, 17 Mar 2011 11:11:52 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to read data from a remote Windows registry using Python</title>
		<link>http://www.justuber.com/blog/2011/03/17/how-to-read-data-from-a-remote-windows-registry-using-python/</link>
		<comments>http://www.justuber.com/blog/2011/03/17/how-to-read-data-from-a-remote-windows-registry-using-python/#comments</comments>
		<pubDate>Thu, 17 Mar 2011 11:08:46 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Rants]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.justuber.com/blog/?p=258</guid>
		<description><![CDATA[It is easy to connect to a remote Windows machine and retrieve information from the registry using the Python Windows registry access module _winreg
from _winreg import *
reg = ConnectRegistry('computer123222', HKEY_LOCAL_MACHINE)
key = OpenKey(reg, 'SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate',0,KEY_READ)
value = QueryValueEx(key, 'SusClientId')
ConnectRegistry() allows you to specify the remote computer and one of the HKEY constants like HKEY_LOCAL_MACHINE or HKEY_USERS.
OpenKey() specifies the [...]]]></description>
			<content:encoded><![CDATA[<p>It is easy to connect to a remote Windows machine and retrieve information from the registry using the Python Windows registry access module <a href="http://docs.python.org/library/_winreg.html">_winreg</a></p>
<p><code>from _winreg import *</code></p>
<p><code>reg = ConnectRegistry('computer123222', HKEY_LOCAL_MACHINE)<br />
key = OpenKey(reg, 'SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate',0,KEY_READ)<br />
value = QueryValueEx(key, 'SusClientId')</code></p>
<p>ConnectRegistry() allows you to specify the remote computer and one of the <a href="http://docs.python.org/library/_winreg.html#hkey-constants">HKEY constants</a> like HKEY_LOCAL_MACHINE or HKEY_USERS.</p>
<p>OpenKey() specifies the remote registry as the location of the hive), the sub key, an integer of 0 (it  must be 0!) followed by the <a href="http://docs.python.org/library/_winreg.html#access-rights">registry key access rights</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.justuber.com/blog/2011/03/17/how-to-read-data-from-a-remote-windows-registry-using-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Symfony &#8211; cssTabsPlugin and security</title>
		<link>http://www.justuber.com/blog/2009/03/11/symfony-csstabsplugin-and-security/</link>
		<comments>http://www.justuber.com/blog/2009/03/11/symfony-csstabsplugin-and-security/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 23:36:48 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Rants]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[sfCssTabsPlugin]]></category>
		<category><![CDATA[sfGuardPlugin]]></category>
		<category><![CDATA[sfSettingsPlugin]]></category>
		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://www.justuber.com/blog/?p=154</guid>
		<description><![CDATA[Hi all,
I have been working on a Symfony (ver1 of the MVC) based application.  It needs really tight security that is really granular.  So I did what most people do and installed the cool sfGuardPlugin.
It works a treat.
But.. I started to look at how I secure individual buttons, or sections of code etc.
The [...]]]></description>
			<content:encoded><![CDATA[<p>Hi all,<br />
I have been working on a Symfony (ver1 of the MVC) based application.  It needs really tight security that is really granular.  So I did what most people do and installed the cool sfGuardPlugin.</p>
<p>It works a treat.</p>
<p>But.. I started to look at how I secure individual buttons, or sections of code etc.<br />
The best way would be to create a load of credentials, e.g view_token, add_token, edit_token, view_token_history, etc etc which can then be grouped together to allow access via groups or individual assignement.</p>
<p>Then I started thinking about the use of hardcoded text within the code, such as the following example and &#8216;viewtoken&#8217;.</p>
<p><code> $sf_user-&gt;hasCredential('view_token');</code></p>
<p>I don&#8217;t like hardcoding anything if I can help it, so installed the <a href="http://www.symfony-project.org/plugins/sfSettingsPlugin">sfSettingsPlugin</a>, added the line of code:</p>
<p><code>include_once (sfConfigCache::getInstance()-&gt;checkConfig('config/db_settings.yml'));</code></p>
<p>to my controllers (it doesn&#8217;t mention that anywhere on the plugin site or within the code!), did a quick symfony propel-build-all-load  &amp; symfony cc and added a few settings.</p>
<p>The settings are available in your app as a normal CONSTANT, I created view_token with the value of viewtoken, so I could access it within the application as the constant VIEW_TOKEN.</p>
<p>You may wonder why I didn&#8217;t just hardcode the values?  I am not sure at the moment, its a lot of hassle so far, but at least it will be highly configurable <img src='http://www.justuber.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Any ways, we have installed the sfSettings plugin, I have the very good wordpress style menus plugin called <a href="http://www.symfony-project.org/plugins/sfCssTabsPlugin">sfCssTabsPlugin</a> already installed and working well.  Finding this great add on that allowed the  <a href="http://www.symfony-framework.com/2007/10/18/symfony-plugin-sfcsstabs-recognition-of-credentials-addon/#comment-2807">sfcsstabs to recognise security credentials</a> that are based in any modules /config/security.yml, I thought great!</p>
<p>But I hit a snag, once installed and working it only recognised the first credential of that user.<br />
If you have a lot of credentials, and I do, then it fails <img src='http://www.justuber.com/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>I found a work around though:<br />
In \plugins\sfGuardPlugin\lib\user\sfGuardSecurityUser.class.php<br />
I replaced:</p>
<p><code><br />
return $this-&gt;hasCredential($credentials);<br />
</code></p>
<p>with:</p>
<p><code><br />
$permissions=$this-&gt;getAllPermissionNames();<br />
if(in_array($credentials, $permissions)) {<br />
return true;<br />
}else{<br />
return false;<br />
}<br />
</code></p>
<p>This gets all the permissions, those set within a group and those assigned to an individual user.<br />
I am not sure if this is best way to do it, I am sure writing another method within the model would probably be a better bet, but I am soooOO lazy.  If I do (or you?) then I will post it on here.</p>
<p>The above code allowed me to get all the credentials and display individual elements of the menu according to the security credentials of the user.</p>
<p>thanks</p>
<p>Adam</p>
]]></content:encoded>
			<wfw:commentRss>http://www.justuber.com/blog/2009/03/11/symfony-csstabsplugin-and-security/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

