<?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>ACCES INTERZIS &#187; white hat</title>
	<atom:link href="http://www.accesinterzis.ro/index.php/tag/white-hat/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.accesinterzis.ro</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Tue, 20 Apr 2010 12:08:34 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Cum generez aleatoriu o parola?</title>
		<link>http://www.accesinterzis.ro/index.php/programare/cum-generez-aleatoriu-o-parola/</link>
		<comments>http://www.accesinterzis.ro/index.php/programare/cum-generez-aleatoriu-o-parola/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 17:36:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[programare]]></category>
		<category><![CDATA[securitate IT]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[white hat]]></category>

		<guid isPermaLink="false">http://www.accesinterzis.ro/?p=6</guid>
		<description><![CDATA[Acest script PHP genereaza aleatoriu o parola. Scriptul iti permite sa alegi numarul de  caractere al parolei si tipul de caractere din care va fi alcatuita  parola: minuscule (abcdef&#8230;), majuscule (ABCDEF&#8230;), cifre (123456&#8230;),  simboluri (!@#$%^&#8230;).
Avantajul folosirii parolelor generate aleatoriu este ca sunt  greu, poate imposbil, de spart de catre un script malitios sau [...]


<strong>Niciun articol asemanator.</strong>]]></description>
			<content:encoded><![CDATA[<p>Acest <a title="Cum generez aleatoriu o parola?" href="http://www.accesinterzis.ro/myfw/genpass-v.1.0.php" target="_blank">script PHP</a> genereaza aleatoriu o parola. Scriptul iti permite sa alegi numarul de  caractere al parolei si tipul de caractere din care va fi alcatuita  parola: minuscule (abcdef&#8230;), majuscule (ABCDEF&#8230;), cifre (123456&#8230;),  simboluri (!@#$%^&#8230;).</p>
<p>Avantajul folosirii parolelor generate aleatoriu este ca sunt  greu, poate imposbil, de spart de catre un script malitios sau ghicite  de catre cineva. Asadar, atata timp cat folositi parole generate  aleatoriu sunteti protejati de atacuri prin forta bruta (brute force  attacks), atacuri cu dictionarul (dictionary attacks), inginerie  sociala.</p>
<p><span id="more-6"></span></p>
<p>Cu toate acestea, exista si un dezavantaj: parolele generate aleatoriu  sunt greu de retinut. Din acest motiv, trebuie sa invatam sa ne alegem  propriile parole. O parola trebuie sa fie usor de retinut in minte dar  indeajuns de puternica cat sa nu fie sparta sau ghicita. In acest sens  va voi arata o metoda care va permite sa obtineti acest lucru. Trebui sa  alegem un cuvant familiar noua si sa-l scriem folosind un alfabet  special. Pentru o intelegere mai buna va voi prezenta un exemplu. Aleg  numele meu, care este Marian, si il scriu in felul urmator: |\/|@r!@|\|.  Asa cum se poate vedea am inlocuit &#8220;m&#8221; cu &#8220;|\/|&#8221;, &#8220;a&#8221; cu &#8220;@&#8221;, &#8220;i&#8221; cu  &#8220;!&#8221;, &#8220;n&#8221; cu &#8220;|\|&#8221;. Privitor la celelalte litere ale alfabetului puteti  inlocui:</p>
<ul>
<li>&#8220;b&#8221; cu &#8220;|3&#8243; (bara verticala, cifra trei)</li>
<li>&#8220;d&#8221; cu &#8220;|)&#8221; (bara verticala, paranteza deschiasa de inchidere)</li>
<li>&#8220;e&#8221; cu &#8220;3&#8243; (cifra trei)</li>
<li>&#8220;h&#8221; cu &#8220;|-|&#8221; (bara verticala, minus, bara verticala)</li>
<li>&#8220;k&#8221; cu &#8220;|&lt;&#8221; (bara vertical, semnul mai mic)</li>
<li>&#8220;o&#8221; cu &#8220;0&#8243; (cifra zero)</li>
<li>&#8220;u&#8221; cu &#8220;|_|&#8221; (bara verticala, underscore, bara verticala)</li>
<li>&#8220;x&#8221; cu &#8220;&gt;&lt;&#8221; (semnul mai mare, semnul mai mic)</li>
</ul>
<p>Si ca sa nu fiu zgarcit, sa fiu cat mai open-source o sa arat si codul-sursa al aplicatiei. Poate cineva ma va ajuta sa optimizez mai mult codul.</p>
<pre class="brush: php;">
&lt;?php
if (isset($_POST['generate'])) {
	if (!empty($_POST['lower_case'])) {
		$lower_case = 'abcdefghijklmnopqrstuvwxyz';
	} else {
		$lower_case = NULL;
	}

	if (!empty($_POST['capitals'])) {
		$capitals = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
	} else {
		$capitals = NULL;
	}

	if (!empty($_POST['digits'])) {
		$digits = '01234567890123456789';
	} else {
		$digits = NULL;
	}

	if (!empty($_POST['special_characters'])) {
		$special_characters = '!@#$%^&amp;*()!@#$%^&amp;*()';
	} else {
		$special_characters = NULL;
	}

	$characters = $lower_case.$capitals.$digits.$special_characters;

	if (empty($lower_case) &amp;&amp; empty($capitals) &amp;&amp; empty($digits) &amp;&amp; empty($special_characters)) {
		$error_message = &quot;&lt;span style=\&quot; color:red;\&quot;&gt;You must choose the type of characters.&lt;/span&gt;&quot;;
	} else {
		$password = '';

		//I generate randomly the password
		for ($i = 0; $i &lt; $_POST['number']; $i++) {
			$password .= substr($characters,rand(0,strlen($characters) - 1),1);
		}
	}
}
?&gt;
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;How can I get a ramdomly generated password?&lt;/title&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;meta http-equiv=&quot;Content-Language&quot; content=&quot;ro&quot; /&gt;
&lt;meta name=&quot;description&quot; content=&quot;How can I get a ramdomly generated password?&quot; /&gt;
&lt;meta name=&quot;keywords&quot; content=&quot;generate,password,random,ramdomly,php,javascript,script,strong,brute,force,dictionary,attack,special&quot; /&gt;
&lt;meta name=&quot;abstract&quot; content=&quot;How can I get a ramdomly generated password?&quot; /&gt;
&lt;meta name=&quot;author&quot; content=&quot;AccesInterzis&quot; /&gt;
&lt;meta name=&quot;copyright&quot; content=&quot;AccesInterzis&quot; /&gt;
&lt;meta name=&quot;robots&quot; content=&quot;index,follow&quot; /&gt;
&lt;meta name=&quot;revisit-after&quot; content=&quot;7 days&quot; /&gt;
&lt;link href=&quot;http://www.accesinterzis.ro/myportofolio/css/reset.css&quot; type=&quot;text/css&quot; rel=&quot;stylesheet&quot; media=&quot;all&quot; /&gt;
&lt;style type=&quot;text/css&quot;&gt;
div#main {
	width:450px;
	margin:0 auto;

	border:0px red solid;
}

form#random_form {
	border:0px red solid;
}

form#random_form div {
	margin:0 0 1px 0;
}
form#random_form label {
	width:150px;
	float:left;
	border:0px blue solid;
}

form#random_form select {
	width:45px;
	border:1px #900;
}

form#random_form input#generate {
	width:auto;
	border:none;
	color:#efefef;
	background-color:#666;
	cursor:pointer;
}

form#random_form input#generate:hover {
	background-color:#333;
}
&lt;/style&gt;

&lt;/head&gt;
&lt;body&gt;
&lt;!--main--&gt;
&lt;div id=&quot;main&quot;&gt;
	&lt;?php
	if (!empty($error_message)) echo $error_message;
	?&gt;
	&lt;!--PHP script--&gt;
	&lt;form action=&quot;&lt;?php echo htmlentities(strip_tags('http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']), ENT_QUOTES, 'utf-8'); ?&gt;&quot; method=&quot;post&quot; id=&quot;random_form&quot;&gt;
		&lt;div&gt;
			&lt;label for=&quot;number&quot;&gt;number of characters:&lt;/label&gt;
			&lt;select name=&quot;number&quot; id=&quot;number&quot;&gt;
			&lt;?php
			$min_max = range(6,30);
			foreach ($min_max as $item) {
				if(strcmp($_POST['number'],$item) == 0) {
					echo '&lt;option selected=&quot;selected&quot;&gt;'.$item.'&lt;/option&gt;'.&quot;\r\n&quot;;
				} else {
					echo '&lt;option&gt;'.$item.'&lt;/option&gt;'.&quot;\r\n&quot;;
				}
			}
			?&gt;
			&lt;/select&gt;
		&lt;/div&gt;

		&lt;div&gt;
			&lt;label for=&quot;lower_case&quot;&gt;lower case:&lt;/label&gt;
			&lt;input type=&quot;checkbox&quot; name=&quot;lower_case&quot; id=&quot;lower_case&quot; &lt;?php if (!empty($lower_case)) {echo 'checked=&quot;checked&quot;';} ?&gt; /&gt;
			&lt;span style=&quot;color:#ccc&quot;&gt;(abcdefg...)&lt;/span&gt;
		&lt;/div&gt;

		&lt;div&gt;
			&lt;label for=&quot;capitals&quot;&gt;capitals:&lt;/label&gt;
			&lt;input type=&quot;checkbox&quot; name=&quot;capitals&quot; id=&quot;capitals&quot; &lt;?php if (!empty($capitals)) {echo 'checked=&quot;checked&quot;';} ?&gt; /&gt;
			&lt;span style=&quot;color:#ccc&quot;&gt;(ABCDEFG...)&lt;/span&gt;
		&lt;/div&gt;

		&lt;div&gt;
			&lt;label for=&quot;digits&quot;&gt;digits:&lt;/label&gt;
			&lt;input type=&quot;checkbox&quot; name=&quot;digits&quot; id=&quot;digits&quot; &lt;?php if (!empty($digits)) {echo 'checked=&quot;checked&quot;';} ?&gt; /&gt;
			&lt;span style=&quot;color:#ccc&quot;&gt;(0123456...)&lt;/span&gt;
		&lt;/div&gt;

		&lt;div&gt;
			&lt;label for=&quot;special_characters&quot;&gt;special characters:&lt;/label&gt;
			&lt;input type=&quot;checkbox&quot; name=&quot;special_characters&quot; id=&quot;special_characters&quot; &lt;?php if (!empty($special_characters)) {echo 'checked=&quot;checked&quot;';} ?&gt; /&gt;
			&lt;span style=&quot;color:#ccc&quot;&gt;(!@#$%^...)&lt;/span&gt;
		&lt;/div&gt;

		&lt;div style=&quot;margin:10px 0 10px 0;&quot;&gt;
			&lt;label&gt;&lt;strong&gt;password&lt;/strong&gt;:&lt;/label&gt;
			&lt;?php
			if (!empty($password)) {
				echo $password;
			} else {
				echo '&lt;span style=&quot;color:#ccc;&quot;&gt;Your password will be generated here.&lt;/span&gt;';
			}
			?&gt;
		&lt;/div&gt;

		&lt;div&gt;
			&lt;label&gt; &amp;nbsp; &lt;/label&gt;
			&lt;input name=&quot;generate&quot; type=&quot;submit&quot; id=&quot;generate&quot; value=&quot;generate&quot; /&gt;
		&lt;/div&gt;
	&lt;/form&gt;
	&lt;!--/PHP script--&gt;
&lt;/div&gt;
&lt;!--/main--&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Cum+generez+aleatoriu+o+parola%3F+http://x57cz.th8.us" title="Publica acest articol pe Twitter"><img class="nothumb" src="http://www.accesinterzis.ro/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://twitter.com/home/?status=Cum+generez+aleatoriu+o+parola%3F+http://x57cz.th8.us" title="Publica acest articol pe Twitter">Publica acest articol pe Twitter</a></p>

<p><strong>Niciun articol asemanator.</strong></p>]]></content:encoded>
			<wfw:commentRss>http://www.accesinterzis.ro/index.php/programare/cum-generez-aleatoriu-o-parola/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
