<?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>nerthase 2.0 &#187; Java</title>
	<atom:link href="http://www.nerthase.com/blog/category/guide/java-guide/feed" rel="self" type="application/rss+xml" />
	<link>http://www.nerthase.com/blog</link>
	<description>Progettazione... Programmazione... Soluzione...</description>
	<lastBuildDate>Wed, 29 Jun 2011 07:11:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>[Java] Invio di File ad una Servlet</title>
		<link>http://www.nerthase.com/blog/java-invio-di-file-ad-una-servlet?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=java-invio-di-file-ad-una-servlet</link>
		<comments>http://www.nerthase.com/blog/java-invio-di-file-ad-una-servlet#comments</comments>
		<pubDate>Fri, 04 Jun 2010 17:37:06 +0000</pubDate>
		<dc:creator>nerthase</dc:creator>
				<category><![CDATA[Guide]]></category>
		<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[Informatica & co]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[GET]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[JavaDoc]]></category>
		<category><![CDATA[JSP]]></category>
		<category><![CDATA[MultipartRequest]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[POST]]></category>
		<category><![CDATA[Servlet]]></category>

		<guid isPermaLink="false">http://www.nerthase.com/blog/?p=827</guid>
		<description><![CDATA[In Java le Servlet sono il primo strumento con il quale si viene a contatto, se si vuole realizzare una applicazione Web dinamica che interagisca con l&#8217;utente. Come sicuramente saprete, le Servlet sono in grado di ricevere le richieste HTTP GET o POST, e di restituire un risultato, che puÃ² anche dipendere dai parametri passati&#8230;]]></description>
			<content:encoded><![CDATA[<p>In Java le Servlet sono il primo strumento con il quale si viene a contatto, se si vuole realizzare una <strong>applicazione Web dinamica</strong> che interagisca con l&#8217;utente. Come sicuramente saprete, le Servlet sono in grado di ricevere le <em>richieste HTTP GET o POST</em>, e di restituire un risultato, che puÃ² anche dipendere dai parametri passati tramite la richiesta. Questa semplice caratteristica, Ã¨ realizzabile grazie all&#8217;implementazione dei metodi <em>doGet(&#8230;, &#8230;)</em> e <em>doPost(&#8230;, &#8230;)</em> che la classe <em>javax.servlet.http.HttpServlet</em> mette a disposizione.</p>
<p>L&#8217;unico vero problema che ho riscontrato fin&#8217;ora con l&#8217;utilizzo di questa classe, Ã¨ la limitazione da essa imposta riguardo il tipo di dati che Ã¨ in grado di prelevare dalle richieste GET e POST che riceve. Infatti, con i due metodi sopracitati, Ã¨ possibile solo elaborare richieste che contengono campi testuali che non fanno riferimento a codifiche particolari. Un classico esempio di questa limitazione, Ã¨ l&#8217;<strong>impossibilitÃ  di inviare tramite GET o POST una immagine alla Servlet.</strong></p>
<div class="clear-block"><div class="ad alignleft"><script type="text/javascript"><!--
google_ad_client = "ca-pub-3082594121433544";
/* 728x90, creato 30/07/09 */
google_ad_slot = "9645358027";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></div>
<p>Java non offre nativamente altri strumenti per la gestione di contenuti di diverso tipo, quindi bisogna ricorrere ad una libreria esterna. Una libreria molto semplice ed intuitiva Ã¨ messa a disposizione da <a title="Servlets.com" href="http://www.servlets.com/" target="_blank">Servlets.com</a> ed Ã¨ reperibile a <a title="http://www.servlets.com/cos/" href="http://www.servlets.com/cos/" target="_blank">questo indirizzo</a>. La libreria in questione Ã¨ <strong>com.oreilly.servlet</strong>, ed in particolare la classe che ci serve per raggiungere il nostro scopo, Ã¨ la classe <strong>MultipartRequest</strong>. Vediamo di seguito un semplice esempio di utilizzo di quanto detto.</p>
<h4>HTML &#8211; PHP &#8211; JSP</h4>
<p>Questa porzione di codice, Ã¨ quella che implementa il form per la scelta del file da inviare alla servlet. PuÃ² essere implementato in qualsivoglia linguaggio Web, ma per semplicitÃ  assumiamo di volerlo implementare in html.</p>
<div class="codecolorer-container html4strict mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> <span style="color: #000066;">action</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;ServletDestinazione&quot;</span> <span style="color: #000066;">method</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;post&quot;</span> <span style="color: #000066;">enctype</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;multipart/form-data&quot;</span> &gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;file&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;file&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;</span></div></td></tr></tbody></table></div>
<p>Alcuni commenti riguardo il codice di cui sopra:</p>
<ul>
<li>Il form utilizza il metodo <em>HTTP POST</em> per l&#8217;invio dei dati</li>
<li><em>ServletDestinazione</em> Ã¨ la Servlet che implementa il metodo <em>doPost(&#8230;, &#8230;)</em> per la ricezione dei dati</li>
<li><em>multipart/form-data</em> Ã¨ la codifica dei dati inviati alla Servlet</li>
</ul>
<div class="clear-block"><div class="ad alignleft"><script type="text/javascript"><!--
google_ad_client = "ca-pub-3082594121433544";
/* 728x90, creato 30/07/09 */
google_ad_slot = "9645358027";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></div>
<h4>Java &#8211; Servlet</h4>
<p>Ed ora vediamo come nella Servlet possiamo recuperare i dati della richiesta.</p>
<div class="codecolorer-container java mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.File</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.ServletException</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.http.HttpServlet</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.http.HttpServletRequest</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.servlet.http.HttpServletResponse</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.oreilly.servlet.MultipartRequest</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ServletDestinazione <span style="color: #000000; font-weight: bold;">extends</span> HttpServlet <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> doPost<span style="color: #009900;">&#40;</span>HttpServletRequest request, HttpServletResponse response<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> ServletException, <span style="color: #003399;">IOException</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">String</span> temp_dir <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;.&quot;</span><span style="color: #339933;">;</span>&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Directory temporanea per il salvataggio del file</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">int</span> temp_size <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;65536&quot;</span><span style="color: #339933;">;</span>&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Dimensione massima del file</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; MultipartRequest mr <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> MultipartRequest<span style="color: #009900;">&#40;</span>request, temp_dir, temp_size<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">File</span> f <span style="color: #339933;">=</span> mr.<span style="color: #006633;">getFile</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;file&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// recupero l'oggetto passato nel campo &quot;file&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Gestione libera del File f</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; ...<br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>Dal codice di sopra, possiamo notare il semplice utilizzo della classe <em>MultipartRequest</em> e soprattutto delle poche componenti di essa utilizzate. Dai commenti e dai <a title="JavaDoc" href="http://www.servlets.com/cos/javadoc/index.html?com/oreilly/servlet/package-summary.html" target="_blank">JavaDoc</a> della classe, credo sia abbastanza comprensibile la scelta del costruttore utilizzato, e l&#8217;utilizzo del metodo <em>getFile(&#8230;)</em> per creare un oggetto File utilizzando l&#8217;attributo <em>file</em> della richiesta POST. Questo oggetto File sarÃ  poi completamente manipolabile dalla Servlet senza alcun vincolo riguardo la sua provenienza.</p>
<p><span style="color: #ffffff;">. . .</span><br />
<strong> Link utili</strong></p>
<p><a title="Libreria com.oreilly.servlet" href="http://www.servlets.com/cos/" target="_blank">Libreria com.oreilly.servlet</a></p>
<p><a title="JavaDoc - com.oreilly.servlet" href="http://www.servlets.com/cos/javadoc/index.html?com/oreilly/servlet/package-summary.html">JavaDocÂ completo della libreria COS</a></p>
<p><a title="JavaDoc della classe MultipartRequest" href="http://www.servlets.com/cos/javadoc/com/oreilly/servlet/MultipartRequest.html" target="_blank">JavaDoc della classe MultipartRequest</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nerthase.com/blog/java-invio-di-file-ad-una-servlet/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Live HTTP Headers: sniffare ed analizzare il traffico HTTP</title>
		<link>http://www.nerthase.com/blog/live-http-headers-sniffare-ed-analizzare-il-traffico-http?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=live-http-headers-sniffare-ed-analizzare-il-traffico-http</link>
		<comments>http://www.nerthase.com/blog/live-http-headers-sniffare-ed-analizzare-il-traffico-http#comments</comments>
		<pubDate>Sat, 15 May 2010 13:16:40 +0000</pubDate>
		<dc:creator>nerthase</dc:creator>
				<category><![CDATA[Guide]]></category>
		<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[Informatica & co]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Mondo Web]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[GET]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[Live HTTP Headers]]></category>
		<category><![CDATA[login]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[POST]]></category>

		<guid isPermaLink="false">http://www.nerthase.com/blog/?p=781</guid>
		<description><![CDATA[In un precedente articolo vi ho parlato di come sia possibile effettuare una richiesta POST verso un sito Web utilizzando Java, con il meccanismo dei Socket. Il metodo che vi avevo illustrato si basava principalmente sull&#8217;analisi del form presente nella pagina Web che normalmente si occupa dell&#8217;invio dei dati. Quindi successivamente in Java, si inviavano&#8230;]]></description>
			<content:encoded><![CDATA[<p>In un <a title="Effettuare una richiesta HTTP con Java Socket" href="http://www.nerthase.com/blog/java-http-post-con-socket" target="_blank">precedente articolo</a> vi ho parlato di come sia possibile <a title="Effettuare una richiesta HTTP POST con Java Socket" href="http://www.nerthase.com/blog/java-http-post-con-socket" target="_blank">effettuare una richiesta POST verso un sito Web utilizzando Java, con il meccanismo dei Socket</a>. Il metodo che vi avevo illustrato si basava principalmente sull&#8217;analisi del <strong>form</strong> presente nella pagina Web che normalmente si occupa dell&#8217;invio dei dati. Quindi successivamente in Java, si inviavano i dati al Server Web sostituendosi al Browser ed inviando gli stessi dati che il form avrebbe inviato.</p>
<p>Il problema, o la limitazione principale di questa tecnica, Ã¨ che non tiene conto di altri eventuali dati che il Browser potrebbe inviare al Server Web. Ad esempio, il Browser quando invia qualsiasi richiesta <strong>GET</strong> o <strong>POST</strong> invia anche un identificativo di esso, tramite il parametro <strong>User-Agent</strong>. Il Server Web che riceve una richiesta GET o POST, potrebbe analizzare i dati che riceve, e non accettare tutte le richieste dove questo parametro non Ã¨ impostato. Da notare che questo parametro non compare assolutamente nel codice HTTP della pagina.</p>
<p>Il parametro User-Agent non Ã¨ l&#8217;unico utilizzato dai Server Web per scartare richieste non provenienti da Browser comuni. Esistono molti altri parametri, che possono essere utilizzati a tale scopo. In questo articolo, utilizziamo <strong>Live HTTP Headers</strong> per <em>sniffare</em> tutto il traffico HTTP da e verso il Server Web, per capire quindi come configurare nel migliore dei modi il programma Java visto nelÂ <a title="Effettuare una richiesta HTTP con Java Socket" href="http://www.nerthase.com/blog/java-http-post-con-socket" target="_blank">precedente articolo</a>.</p>
<div class="clear-block"><div class="ad alignleft"><script type="text/javascript"><!--
google_ad_client = "ca-pub-3082594121433544";
/* 728x90, creato 30/07/09 */
google_ad_slot = "9645358027";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></div>
<p><a title="Live HTTP Headers" href="https://addons.mozilla.org/it/firefox/addon/3829/" target="_blank">Live HTTP Headers</a> Ã¨ un <strong>plug-in per Firefox</strong> che permette di <em>monitorare tutte le richieste che il Browser fa al Server Web, e tutte le risposte inviate da esso</em>. In questo modo, Ã¨ possibile visualizzare esattamente una <strong>richiesta POST</strong> inviata verso il Server, e quindi <strong>riprodurla fedelmente in Java</strong>. Nel seguito, vediamo come ci si dovrebbe comportare nel caso in cui si volesse riprodurre in Java un meccanismo di login presso un Sito Web, simile, ma piÃ¹ potente, a quello visto nel <a title="Effettuare una richiesta HTTP con Java Socket" href="http://www.nerthase.com/blog/java-http-post-con-socket" target="_blank">precedente articolo</a>.</p>
<h4>Login su Facebook</h4>
<p>Per realizzare questo esempio ho preso come cavia il sito Web piÃ¹ conosciuto al mondo, <a title="Facebook" href="http://www.facebook.com/" target="_blank">Facebook</a>. Il meccanismo di login di Facebook Ã¨ molto semplice, e del tutto analogo a molti altri metodi utilizzati dalla maggior parte dei siti web.</p>
<p><a class="lightbox" title="Facebook Login" href="http://www.nerthase.com/blog/wp-content/uploads/2010/05/Facebook-Login.png"><img class="aligncenter size-full wp-image-782" title="Facebook Login" src="http://www.nerthase.com/blog/wp-content/uploads/2010/05/Facebook-Login.png" alt="" width="414" height="66" /></a></p>
<p>Come prima analisi del sito, si puÃ² visualizzare il codice HTML ed individuare il <strong>form che effettua il login</strong>. Questo passaggio sarÃ  successivamente reso superfluo dall&#8217;uso di Live HTTP Headers, perÃ² Ã¨ comunque interessante capire come realizzano alcune tecniche. Di seguito, potete vedere la porzione di codice HTML dove viene costruito il form dell&#8217;immagine precedente.</p>
<div class="codecolorer-container html4strict mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> <span style="color: #000066;">method</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;POST&quot;</span> <span style="color: #000066;">action</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;https://login.facebook.com/login.php?login_attempt=1&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;login_form&quot;</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;hidden&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;charset_test&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&amp;euro;,´,â‚¬,Â´,æ°´,Ð”,Ð„&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;hidden&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;locale&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;locale&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;it_IT&quot;</span> autocomplete<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;off&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">table</span> <span style="color: #000066;">cellpadding</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">cellspacing</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;0&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">tr</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;login_form_label_field login_form_label_remember&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;checkbox&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;inputcheckbox&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;persistent&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;persistent&quot;</span> <span style="color: #000066;">tabindex</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;3&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;label_persistent&quot;</span> <span style="color: #000066;">for</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;persistent&quot;</span>&gt;</span>Resta collegato<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;</span> &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;login_form_label_field&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.facebook.com/reset.php&quot;</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;nofollow&quot;</span>&gt;</span>Hai dimenticato la password?<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;login_form_last_field login_form_label_field&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">tr</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">tr</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;inputtext &nbsp;DOMControl_placeholder&quot;</span> <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;E-mail&quot;</span> placeholder<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;E-mail&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;email&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;email&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;E-mail&quot;</span> <span style="color: #000066;">tabindex</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;password&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;inputpassword&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;pass&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;pass&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">tabindex</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;2&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;inputtext hidden_elem DOMControl_placeholder&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;pass_placeholder&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;pass_placeholder&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">tabindex</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;2&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;login_form_last_field&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;inner&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;uiButton uiButtonConfirm uiButtonMedium&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Accedi&quot;</span> <span style="color: #000066;">tabindex</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;4&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">tr</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">table</span>&gt;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;hidden&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;charset_test&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&amp;euro;,´,â‚¬,Â´,æ°´,Ð”,Ð„&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;hidden&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;lsd&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;lsd&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;VwSKT&quot;</span> autocomplete<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;off&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;</span></div></td></tr></tbody></table></div>
<div class="clear-block"><div class="ad alignleft"><script type="text/javascript"><!--
google_ad_client = "ca-pub-3082594121433544";
/* 728x90, creato 30/07/09 */
google_ad_slot = "9645358027";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></div>
<p>Una volta fatta una prima analisi della pagina Web, e di come il form invia i dati al Server, vediamo di iniziare ad imparare ad usare Live HTTP Header. Innanzitutto, bisogna scaricare ed installare il plug-in per Firefox, da link apposito: <a title="Live HTTP Headers" href="https://addons.mozilla.org/it/firefox/addon/3829/" target="_blank">Live HTTP Headers Download</a>. Una volta installato, il plug-in sarÃ  disponibile dal <strong>meÃ¹ Strumenti</strong>.</p>
<p style="text-align: center;"><a class="lightbox" style="text-decoration: none;" title="Live Http Headers 1" href="http://www.nerthase.com/blog/wp-content/uploads/2010/05/Live-Http-Headers-1.png"><img class="aligncenter size-full wp-image-783" title="Live Http Headers 1" src="http://www.nerthase.com/blog/wp-content/uploads/2010/05/Live-Http-Headers-1.png" alt="" width="625" height="472" /></a></p>
<p>Una nota molto importante, Ã¨ che una volta avviato il plug-in, questo visualizzerÃ  tutte le richieste HTTP che al momento Firefox sta effettuando. Quindi abbiate l&#8217;accortezza di posizionarvi sulla pagina che volete monitorare, farla caricare completamente, e solo dopo avviare il plug-in. Infatti, come potete vedere dall&#8217;immagine seguente, il plug-in Ã¨ avviato, ma non sta ancora intercettando nulla.</p>
<p style="text-align: center;"><a class="lightbox" style="text-decoration: none;" title="Live Http Headers 2" href="http://www.nerthase.com/blog/wp-content/uploads/2010/05/Live-Http-Headers-2.png"><img class="aligncenter size-large wp-image-784" title="Live Http Headers 2" src="http://www.nerthase.com/blog/wp-content/uploads/2010/05/Live-Http-Headers-2-1024x491.png" alt="" width="717" height="344" /></a></p>
<p>Una volta avviato il plug-in, potete inserire i vostri dati all&#8217;interno del form, e successivamente effettuare il login, come fate di solito.Â Adesso, potete vedere Live HTTP Headers popolarsi di numerose linee di codice, che rappresentano semplicemente le richieste e le risposte che il Browser fa e riceve dal Server Web. Per individuare quale Ã¨ la richiesta contenente i dati del form, che quindi vi permette di effettuare il login, dovete semplicemente ricercare la prima richiesta POST che Ã¨ stata effettuata.</p>
<p style="text-align: center;"><a class="lightbox" style="text-decoration: none;" title="Live Http Headers 4" href="http://www.nerthase.com/blog/wp-content/uploads/2010/05/Live-Http-Headers-4.png"><img class="aligncenter size-full wp-image-785" title="Live Http Headers 4" src="http://www.nerthase.com/blog/wp-content/uploads/2010/05/Live-Http-Headers-4.png" alt="" width="664" height="464" /></a></p>
<p>Come potete vedere dall&#8217;immagine precedente, la richiesta POST Ã¨ molto piÃ¹ complessa di quella vista e realizzata in Java nel <a title="Effettuare una richiesta HTTP con Java Socket" href="http://www.nerthase.com/blog/java-http-post-con-socket" target="_blank">precedente articolo</a>. In questa richiesta infatti, sono presenti <em>molti campi impostati dal Browser</em> e non dal form HTML, che quindi solo in questo modo potete visualizzare. L&#8217;ultima riga della richiesta POST, sono invece i dati inviati tramite il form HTML al Server Web, che dipendono esclusivamente ed interamente da come il form Ã¨ stato implementato.</p>
<p style="text-align: center;"><a class="lightbox" style="text-decoration: none;" title="Live Http Headers 5" href="http://www.nerthase.com/blog/wp-content/uploads/2010/05/Live-Http-Headers-5.png"><img class="aligncenter size-large wp-image-786" title="Live Http Headers 5" src="http://www.nerthase.com/blog/wp-content/uploads/2010/05/Live-Http-Headers-5-1024x526.png" alt="" width="717" height="368" /></a></p>
<p>In quest&#8217;altra immagine, ci tengo a farvi vedere che nonostante la vostra password non sia visibile nella casella di testo relativa ad essa e nemmeno nell&#8217;URL della pagina, viene comunque inviata al Server Web in chiaro. Quindi semplicemente <em>sniffando</em> le richieste HTTP di un Browser, sarÃ  possibile visualizzare tutte le informazioni trasmesse, soprattutto le password.</p>
<p>Di seguito trovate il codice della richiesta POST per intero, che potete usare per semplice curiositÃ , o per provare ad implementare una richiesta POST in Java leggermente piÃ¹ completa.</p>
<div class="codecolorer-container text mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">POST /login.php?login_attempt=1 HTTP/1.1<br />
Host: login.facebook.com<br />
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; it; rv:1.9.2) Gecko/20100115 Firefox/3.6<br />
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8<br />
Accept-Language: it-it,it;q=0.8,en-us;q=0.5,en;q=0.3<br />
Accept-Encoding: gzip,deflate<br />
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7<br />
Keep-Alive: 115<br />
Connection: keep-alive<br />
Referer: http://www.facebook.com/<br />
Cookie: datr=1273922752-7f53f02bbc25f61b71562a08d1db5c02169342202a5a2c11c0482; lsd=VwSKT; reg_fb_gate=http%3A%2F%2Fwww.facebook.com%2F; reg_fb_ref=http%3A%2F%2Fwww.facebook.com%2F; test_cookie=1<br />
Content-Type: application/x-www-form-urlencoded<br />
Content-Length: 236<br />
charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&amp;locale=it_IT&amp;email=email_login%40email.com&amp;pass=tua_password&amp;charset_test=%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84&amp;lsd=VwSKT</div></td></tr></tbody></table></div>
<p>Spero che questo semplice esempio sia utile a molti di voi, e preciso che non Ã¨ stato realizzato con secondi fini e non Ã¨ stato scelto il sito di Facebook a caso. Facebook infatti impone molti ulteriori controlli quando si tenta di effettuare il login, che rende quindi impraticabile la realizzazione in Java di un programma apposito. Per effettuare un login su Facebook, ma anche molte altre operazioni, sono disponibili API che consentono di usare molti degli strumenti di Facebook in modo molto semplice e soprattutto consentito.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nerthase.com/blog/live-http-headers-sniffare-ed-analizzare-il-traffico-http/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Java: HTTP POST con Socket</title>
		<link>http://www.nerthase.com/blog/java-http-post-con-socket?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=java-http-post-con-socket</link>
		<comments>http://www.nerthase.com/blog/java-http-post-con-socket#comments</comments>
		<pubDate>Sat, 24 Apr 2010 21:39:16 +0000</pubDate>
		<dc:creator>nerthase</dc:creator>
				<category><![CDATA[Guide]]></category>
		<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[Informatica & co]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[PHP & MySql]]></category>
		<category><![CDATA[crack]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[hacker]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[login]]></category>
		<category><![CDATA[Password]]></category>
		<category><![CDATA[POST]]></category>
		<category><![CDATA[Socket]]></category>
		<category><![CDATA[username]]></category>

		<guid isPermaLink="false">http://www.nerthase.com/blog/?p=603</guid>
		<description><![CDATA[Come potete vedere nei precedenti articoli riguardanti il Brute Force in Java e i vari metodi di attacco per le password, la sicurezza informatica Ã¨ uno degli aspetti dell&#8217;informatica che preferisco, soprattutto per quanto riguarda la sicurezza in Internet. Vi sembrerÃ  strano, ma non potete immaginare quanta gente dia per scontato il fattore sicurezza mentre&#8230;]]></description>
			<content:encoded><![CDATA[<p>Come potete vedere nei precedenti articoli riguardanti il <a title="Brute Force in Java - Attacco - Crack - Hack" href="http://www.nerthase.com/blog/brute-force-in-java" target="_blank">Brute Force in Java</a> e i vari metodi di <a title="Attacco password - Crack - Hack" href="http://www.nerthase.com/blog/password-come-evitare-il-crack" target="_blank">attacco per le password</a>, la sicurezza informatica Ã¨ uno degli aspetti dell&#8217;informatica che preferisco, soprattutto per quanto riguarda la sicurezza in Internet. Vi sembrerÃ  strano, ma non potete immaginare quanta gente dia per scontato il fattore sicurezza mentre naviga in rete, crea account e soprattutto quanto <strong>sceglie la password</strong>.</p>
<p>Proprio sulla scelta della password vorrei soffermarmi un attimo con una piccola considerazione, basata su dati statistici. Infatti, secondo alcuni studi, la password usata piÃ¹ spesso dagli utenti Ã¨ la stringa <em>&#8220;123456&#8243;</em>. Questo dato mi Ã¨ sembrato sconvolgente, ma posso assicurarvi che Ã¨ molto realistico. Su questo argomento credo di fare a breve un articolo piÃ¹ approfondito, quindi per ora consideriamo semplicemente l&#8217;aspetto che riguarda Java, ed in particolare <strong>come fare una richiesta http usando il metodo POST, sfruttando i Socket</strong>.</p>
<div class="clear-block"><div class="ad alignleft"><script type="text/javascript"><!--
google_ad_client = "ca-pub-3082594121433544";
/* 728x90, creato 30/07/09 */
google_ad_slot = "9645358027";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></div>
<p>I due argomenti sopra citati sono strettamente collegati, in quanto le applicazioni web sono costruite essenzialmente sfruttando il metodo GET per le varie richieste. Il metodo POST viene usato per elementari requisiti di sicurezza per la trasmissione di dati sensibili, quali appunto <strong>username</strong> e <strong>password</strong> al momento del login su un servizio web. Il metodo che vi mostro quindi, puÃ² essere appositamente adattato per effettuare un login su un&#8217;applicazione web usando Java. Un esempio concreto di ciÃ², potrebbe essere la creazione di un&#8217;applicazione Java che effettua una connessione all&#8217;applicazione web per effettuare determinate operazioni.</p>
<p>Solitamente una applicazione web che richiede il login, ha una porzione della pagina che effettua una richiesta POST verso una specifica pagina che si occupa di verificare la correttezza dei dati forniti:</p>
<div class="codecolorer-container html4strict mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> <span style="color: #000066;">action</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;login.php&quot;</span> <span style="color: #000066;">method</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;post&quot;</span> <span style="color: #000066;">target</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;_top&quot;</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;username&quot;</span> <span style="color: #000066;">size</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;30&quot;</span> <span style="color: #000066;">maxlength</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;20&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;password&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;password&quot;</span> <span style="color: #000066;">size</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;30&quot;</span> <span style="color: #000066;">maxlength</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;20&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;login&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Login&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;</span></div></td></tr></tbody></table></div>
<p>Per realizzare il nostro scopo, dobbiamo analizzare la pagina specifica, ed annotare la struttura del messaggio inviato tramite POST, e la pagina che riceve i dati, che Ã¨ specificata nel parametro <strong>action</strong> dell&#8217;elemento <em>form</em>.</p>
<div class="clear-block"><div class="ad alignleft"><script type="text/javascript"><!--
google_ad_client = "ca-pub-3082594121433544";
/* 728x90, creato 30/07/09 */
google_ad_slot = "9645358027";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></div>
<p>Per quanto riguarda la parte Java, questo Ã¨ un esempio di come realizzare la richiesta POST usando solo le Socket.</p>
<div class="codecolorer-container java mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.BufferedReader</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.BufferedWriter</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.InputStreamReader</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.OutputStreamWriter</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.net.InetAddress</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.net.Socket</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.net.URLEncoder</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> SocketPost <span style="color: #009900;">&#123;</span> &nbsp; <br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> args<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">String</span> host &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;HOST-WEB-APP&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">int</span> port &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=</span> <span style="color: #cc66cc;">80</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">String</span> form_action &nbsp;<span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;PAGINA-DI-LOGIN&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">String</span> username &nbsp; &nbsp; <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;TUO-USERNAME&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">String</span> password &nbsp; &nbsp; <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;TUA-PASSWORD&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">boolean</span> result <span style="color: #339933;">=</span> login<span style="color: #009900;">&#40;</span>host, port, form_action, username, password<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">boolean</span> login <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> host, <span style="color: #000066; font-weight: bold;">int</span> port, <span style="color: #003399;">String</span> form_action, <span style="color: #003399;">String</span> username, <span style="color: #003399;">String</span> password<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Dati da inviare tramite POST</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Copmosizione tipica: &nbsp; &nbsp;username=TUOUSER&amp;password=TUAPASSWORD</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">String</span> data <span style="color: #339933;">=</span> &nbsp; <span style="color: #003399;">URLEncoder</span>.<span style="color: #006633;">encode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;username&quot;</span>, <span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;=&quot;</span> <span style="color: #339933;">+</span> <span style="color: #003399;">URLEncoder</span>.<span style="color: #006633;">encode</span><span style="color: #009900;">&#40;</span>username, <span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;&amp;&quot;</span> <span style="color: #339933;">+</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">URLEncoder</span>.<span style="color: #006633;">encode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;password&quot;</span>, <span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;=&quot;</span> <span style="color: #339933;">+</span> <span style="color: #003399;">URLEncoder</span>.<span style="color: #006633;">encode</span><span style="color: #009900;">&#40;</span>password, <span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Creo il Socket per la connessione all'host</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">InetAddress</span> addr <span style="color: #339933;">=</span> <span style="color: #003399;">InetAddress</span>.<span style="color: #006633;">getByName</span><span style="color: #009900;">&#40;</span>host<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">Socket</span> socket <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Socket</span><span style="color: #009900;">&#40;</span>addr, port<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">BufferedWriter</span> wr <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">BufferedWriter</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">OutputStreamWriter</span><span style="color: #009900;">&#40;</span>socket.<span style="color: #006633;">getOutputStream</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, <span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; wr.<span style="color: #006633;">write</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;POST &quot;</span> <span style="color: #339933;">+</span> form_action <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; HTTP/1.0<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; wr.<span style="color: #006633;">write</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Host: &quot;</span> <span style="color: #339933;">+</span> host <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; wr.<span style="color: #006633;">write</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Length: &quot;</span> <span style="color: #339933;">+</span> data.<span style="color: #006633;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; wr.<span style="color: #006633;">write</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Invio i dati tramite POST</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; wr.<span style="color: #006633;">write</span><span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; wr.<span style="color: #006633;">flush</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Leggo la risposta dall'host</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">BufferedReader</span> br <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">BufferedReader</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">InputStreamReader</span><span style="color: #009900;">&#40;</span>socket.<span style="color: #006633;">getInputStream</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Solitamente, in caso di pagine di login, </span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// il codice di risposta per un login valido Ã¨ 302</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>br.<span style="color: #006633;">readLine</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;HTTP/1.1 302 Found&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; wr.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; br.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>Prima di poter essere in grado di riempire il codice Java, bisogna analizzare il sito presso il quale si vuole effettuare il login, per estrapolare tutti i dati necessari. Questa operazione non richiede un particolare sforzo, ma un minimo di esperienza Ã¨ sempre d&#8217;obbligo. Se avete bisogno di una mano, potete chiedere tranquillamente. Il metodo su illustrato Ã¨ stato realizzato solo a scopo illustrativo e deve essere utilizzato solo in possesso delle credenziali di accesso, e non per scopi malevoli.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nerthase.com/blog/java-http-post-con-socket/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MySQL con Java grazie a JDBC</title>
		<link>http://www.nerthase.com/blog/mysql-con-java-grazie-a-jdbc?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mysql-con-java-grazie-a-jdbc</link>
		<comments>http://www.nerthase.com/blog/mysql-con-java-grazie-a-jdbc#comments</comments>
		<pubDate>Tue, 09 Mar 2010 20:55:35 +0000</pubDate>
		<dc:creator>nerthase</dc:creator>
				<category><![CDATA[Guide]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[PHP & MySql]]></category>
		<category><![CDATA[connector]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[JDBC]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.nerthase.com/blog/?p=342</guid>
		<description><![CDATA[Nei miei ultimi esperimenti con Java, mi Ã¨ capitato di dover interagire con database MySQL. Per la parte che riguarda il database, ho sempre usato MAMP, un ottimo programma che gestisce in una semplice interfaccia grafica, Apache, MySQL e PHP. Per far comunicare Java ed il database MySQL c&#8217;Ã¨ bisogno di un driver, in particolare&#8230;]]></description>
			<content:encoded><![CDATA[<p>Nei miei ultimi esperimenti con <a title="Java" href="http://www.nerthase.com/blog/tag/java" target="_blank">Java</a>, mi Ã¨ capitato di dover interagire con database MySQL. Per la parte che riguarda il database, ho sempre usato <a title="Mac Apache MySQL Php" href="http://www.mamp.info/en/index.html" target="_blank">MAMP</a>, un ottimo programma che gestisce in una semplice interfaccia grafica, Apache, MySQL e PHP.</p>
<p>Per far comunicare Java ed il database MySQL c&#8217;Ã¨ bisogno di un driver, in particolare ho usato <a title="Driver JDBC Connector MySQL" href="http://www.mysql.com/products/connector/" target="_blank">JDBC</a>. Un esempio di utilizzo del driver Ã¨ il seguente:</p>
<div class="codecolorer-container java mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.sql.Connection</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.sql.DriverManager</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.sql.ResultSet</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.sql.Statement</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> DataBaseTest <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> testDB <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span> &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Carico il Driver</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">Class</span>.<span style="color: #006633;">forName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;com.mysql.jdbc.Driver&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Connetto al Database (URL DB, USER, PWD)</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">Connection</span> db <span style="color: #339933;">=</span> <span style="color: #003399;">DriverManager</span>.<span style="color: #006633;">getConnection</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;jdbc:mysql://localhost:3306/test&quot;</span>, <span style="color: #0000ff;">&quot;root&quot;</span>, <span style="color: #0000ff;">&quot;root&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Creo uno Statement per l'invio della query</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">Statement</span> s <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">db</span>.<span style="color: #006633;">createStatement</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Invio la query e catturo i risultati</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">ResultSet</span> rs <span style="color: #339933;">=</span> s.<span style="color: #006633;">executeQuery</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT nome FROM tabella WHERE nick = 'nerthase'&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">boolean</span> o <span style="color: #339933;">=</span> rs.<span style="color: #006633;">first</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// In caso non siano stati trovati risultati, inserisco l'entry nel database</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>o<span style="color: #009900;">&#41;</span> s.<span style="color: #006633;">executeUpdate</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;INSERT INTO tabella (nome, nick) VALUES ('mario', 'nerthase')&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; s.<span style="color: #006633;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p><div class="clear-block"><div class="ad alignleft"><script type="text/javascript"><!--
google_ad_client = "ca-pub-3082594121433544";
/* 728x90, creato 30/07/09 */
google_ad_slot = "9645358027";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></div><br />
Questo codice, implica che sia stato creato un database chiamato <em><strong>test</strong></em> con una tabella chiamata <strong><em>tabella</em></strong> costituita da almeno due campi chiamati <em><strong>nome</strong></em> e <em><strong>nick</strong></em>. Il particolare questo piccolo esempio di codice, verifica se nella tabella Ã¨ presente una entry che verifica la condizione <em>nick = &#8216;nerthase&#8217;</em>, ed in caso questa non Ã¨ presente, inserisce la entry completa corrispondente. Un esempio di tabella usata per il test potrebbe essere il seguente:</p>
<table style="width: 150px;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="text-align: center;"><strong>nome</strong></td>
<td style="text-align: center;"><strong>nick</strong></td>
</tr>
<tr>
<td style="text-align: center;">silvia</td>
<td style="text-align: center;">moonny</td>
</tr>
<tr>
<td style="text-align: center;">fabio</td>
<td style="text-align: center;">noeffex</td>
</tr>
<tr>
<td style="text-align: center;">mario</td>
<td style="text-align: center;">nerthase</td>
</tr>
</tbody>
</table>
<p>Questa Ã¨ la mia prima esperienza con MySQL e soprattutto per l&#8217;integrazione con <a title="Java" href="http://www.nerthase.com/blog/tag/java" target="_blank">Java</a>. Questo metodo perÃ² funziona molto bene, senza alcun errore, almeno per il momento. Per consigli o chiarimenti non esitate a contattarmi.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nerthase.com/blog/mysql-con-java-grazie-a-jdbc/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Algoritmo di Vigenere</title>
		<link>http://www.nerthase.com/blog/algoritmo-di-vigenere?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=algoritmo-di-vigenere</link>
		<comments>http://www.nerthase.com/blog/algoritmo-di-vigenere#comments</comments>
		<pubDate>Wed, 03 Mar 2010 21:26:51 +0000</pubDate>
		<dc:creator>nerthase</dc:creator>
				<category><![CDATA[Guide]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[algoritmo]]></category>
		<category><![CDATA[chiave]]></category>
		<category><![CDATA[decifrare]]></category>
		<category><![CDATA[decriptare]]></category>
		<category><![CDATA[messaggi cifrati]]></category>
		<category><![CDATA[vigenere]]></category>

		<guid isPermaLink="false">http://www.nerthase.com/blog/?p=302</guid>
		<description><![CDATA[Come ormai avrete capito, la crittografia e la sicurezza informatica sono argomenti che mi appassionano molto. Oggi infatti, ho realizzato un piccolo tool per la decifrazione di semplici messaggi cifrati tramite l&#8217;algoritmo di Vigenere. Questo tool si limita a provare tutte le possibili chiavi, ed a stampare a video tutte le possibili soluzioni. Dovrete essere&#8230;]]></description>
			<content:encoded><![CDATA[<p>Come ormai avrete capito, la crittografia e la sicurezza informatica sono argomenti che mi appassionano molto. Oggi infatti, ho realizzato un piccolo tool per la decifrazione di semplici messaggi cifrati tramite l&#8217;<a title="Cifrario di Vigenere" href="http://it.wikipedia.org/wiki/Cifrario_di_VigenÃ¨re" target="_blank">algoritmo di Vigenere</a>. Questo tool si limita a provare tutte le possibili chiavi, ed a stampare a video tutte le possibili soluzioni. Dovrete essere voi poi, ad individuare quella giusta. Questo tool si appoggia al codice per il <a title="Brute Force in Java" href="http://www.nerthase.com/blog/brute-force-in-java" target="_blank">Brute Force</a> di cui abbiamo parlato in <a title="Brute Force in Java" href="http://www.nerthase.com/blog/brute-force-in-java" target="_blank">questo articolo</a>. Ma veniamo direttamente al codice:<br />
<div class="clear-block"><div class="ad alignleft"><script type="text/javascript"><!--
google_ad_client = "ca-pub-3082594121433544";
/* 728x90, creato 30/07/09 */
google_ad_slot = "9645358027";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></div></p>
<div class="codecolorer-container java mac-classic" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Crack<br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Testo cifrato</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">String</span> cypher <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;testocifrato&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Uso chiavi di 6 caratteri</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; BruteForce bf <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> BruteForce<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">null</span>, <span style="color: #000066; font-weight: bold;">null</span>, <span style="color: #cc66cc;">6</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">String</span> key<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>key <span style="color: #339933;">=</span> bf.<span style="color: #006633;">prossimaPermutazione</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Decifro</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">String</span> plaintext <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Decifro un carattere alla volta</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> cypher.<span style="color: #006633;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span> <span style="color: #339933;">++</span>i<span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Carattere i-esimo</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">char</span> cypherchar <span style="color: #339933;">=</span> cypher.<span style="color: #006633;">charAt</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">char</span> keychar <span style="color: #339933;">=</span> key.<span style="color: #006633;">charAt</span><span style="color: #009900;">&#40;</span>i <span style="color: #339933;">%</span> key.<span style="color: #006633;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Calcolo la posizione del carattere nell'alfabeto</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">int</span> poschar <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#41;</span> cypherchar<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">int</span> poskey <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#41;</span> keychar<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Trasformo il carattere cifrato in quello in chiaro</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">int</span> offset <span style="color: #339933;">=</span> poschar <span style="color: #339933;">-</span> poskey<span style="color: #339933;">;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">int</span> posplain <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>offset <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">?</span> offset <span style="color: #339933;">+</span> <span style="color: #cc66cc;">26</span> <span style="color: #339933;">:</span> offset <span style="color: #339933;">%</span> <span style="color: #cc66cc;">26</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">'a'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; plaintext <span style="color: #339933;">+=</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">char</span><span style="color: #009900;">&#41;</span> posplain<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Key: &quot;</span> <span style="color: #339933;">+</span> key <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; &quot;</span> <span style="color: #339933;">+</span> plaintext<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>Come vedete, il codice Ã¨ molto semplice. Si limita solo a decifrare ogni volta il messaggio, con tutte le possibili chiavi. Per maggiori informazioni sull&#8217;implementazione dell&#8217;algoritmo, potete visitare la voce di Wikipidia suÂ <a title="Cifrario di Vigenere" href="http://it.wikipedia.org/wiki/Cifrario_di_VigenÃ¨re" target="_blank">Vigenere</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nerthase.com/blog/algoritmo-di-vigenere/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>jDownloader: RapidShare e MegaUpload senza limiti</title>
		<link>http://www.nerthase.com/blog/jdownloader-rapidshare-e-megaupload-senza-limiti?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jdownloader-rapidshare-e-megaupload-senza-limiti</link>
		<comments>http://www.nerthase.com/blog/jdownloader-rapidshare-e-megaupload-senza-limiti#comments</comments>
		<pubDate>Sat, 27 Feb 2010 21:14:08 +0000</pubDate>
		<dc:creator>nerthase</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Guide]]></category>
		<category><![CDATA[Informatica & co]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Mondo Linux]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Tutto il resto]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[account premium]]></category>
		<category><![CDATA[CAPTCHA]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[download senza limiti]]></category>
		<category><![CDATA[HotFile]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jDownloader]]></category>
		<category><![CDATA[MegaUpload]]></category>
		<category><![CDATA[MegaVideo]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[RapidShare]]></category>
		<category><![CDATA[YouTube]]></category>

		<guid isPermaLink="false">http://www.nerthase.com/blog/?p=276</guid>
		<description><![CDATA[jDownloader Ã¨ un utilissimo programma open source scritto completamente in Java, e quindi compatibile con tutti i sistemi operativi che lo supportano. Il suo scopo Ã¨ quello di scaricare file da siti come RapidShare e MegaUpload, ma anche tanti altri come loro. jDownloader si occuperÃ  di attendere la disponibilitÃ  del download al posto nostro, ed&#8230;]]></description>
			<content:encoded><![CDATA[<p><a title="jDownloader: RapidShare e MegaUpload senza limiti" href="http://jdownloader.org/" target="_blank">jDownloader</a> Ã¨ un utilissimo programma <strong>open source</strong> scritto completamente in Java, e quindi compatibile con tutti i sistemi operativi che lo supportano. Il suo scopo Ã¨ quello di scaricare file da siti come RapidShare e MegaUpload, ma anche tanti altri come loro. jDownloader si occuperÃ  di attendere la disponibilitÃ  del download al posto nostro, ed effettuerÃ  anche il bypass dei codici CAPTCHA spesso utilizzati da siti del genere.</p>
<p>Ma le novitÃ  e le potenzialitÃ  di jDownloader non sono finite qui. Esso infatti Ã¨ in grado di effettuare il download di filmati di YouTube, MegaVideo e quanto altro possiate immaginare. Inoltre ha anche l&#8217;opzione per effettuare i download usufruendo di un account premium in vostro possesso. E se invece non possedete un account premium, jDownloader si occuperÃ  di effettuare un cambio di IP per il vostro computer, in modo da evitare controlli e barriere applicati da alcuni siti di File Sharing.<br />
<div class="clear-block"><div class="ad alignleft"><script type="text/javascript"><!--
google_ad_client = "ca-pub-3082594121433544";
/* 728x90, creato 30/07/09 */
google_ad_slot = "9645358027";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></div><br />
Dopo questa breve panoramica per questo meraviglioso software, veniamo ad una breve guida di configurazione ed utilizzo:</p>
<p><a class="lightbox" style="text-decoration: none;" title="jD1" href="http://www.nerthase.com/blog/wp-content/uploads/2010/02/jD1.png"><img class="aligncenter size-full wp-image-278" title="jD1" src="http://www.nerthase.com/blog/wp-content/uploads/2010/02/jD1.png" alt="" width="270" height="334" /></a></p>
<p>Dopo l&#8217;installazione, Ã¨ necessario settare alcune impostazioni iniziali per l&#8217;utilizzo del software,</p>
<p style="text-align: center;"><a class="lightbox" style="text-decoration: none;" title="jD2" href="http://www.nerthase.com/blog/wp-content/uploads/2010/02/jD2.png"><img class="aligncenter size-full wp-image-279" title="jD2" src="http://www.nerthase.com/blog/wp-content/uploads/2010/02/jD2.png" alt="" width="575" height="376" /></a></p>
<p>Impostiamo il percorso per i nostri download ed il comportamento che jDownloader dovrÃ  adottare per i file scaricati. Queste semplici impostazioni sono giÃ  sufficienti per iniziare ad effettuare il download dei nostri file.</p>
<p style="text-align: center;"><a class="lightbox" style="text-decoration: none;" title="jD3" href="http://www.nerthase.com/blog/wp-content/uploads/2010/02/jD3.png"><img class="aligncenter size-full wp-image-280" title="jD3" src="http://www.nerthase.com/blog/wp-content/uploads/2010/02/jD3.png" alt="" width="575" height="376" /></a></p>
<p>Come vi dicevo prima, jDownload Ã¨ in grado di cambiare l&#8217;IP del nostro computer mediante una riconnessione del router. Questa impostazione Ã¨ molto utile nel caso di siti di File Sharing che effettuano controlli su IP. BasterÃ  individuare il modello del nostro router, selezionare &#8220;<em>Ottieni IP router</em>&#8221; ed infine &#8220;<em>Crea script di riconnessione</em>&#8220;. Automaticamente jDownloader creerÃ  uno script ad hoc per il nostro router in grado di effettuare una riconnessione, e quindi il cambio di IP.<br />
<div class="clear-block"><div class="ad alignleft"><script type="text/javascript"><!--
google_ad_client = "ca-pub-3082594121433544";
/* 728x90, creato 30/07/09 */
google_ad_slot = "9645358027";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></div></p>
<p style="text-align: center;"><a class="lightbox" style="text-decoration: none;" title="jD4" href="http://www.nerthase.com/blog/wp-content/uploads/2010/02/jD4.png"><img class="aligncenter size-full wp-image-281" title="jD4" src="http://www.nerthase.com/blog/wp-content/uploads/2010/02/jD4.png" alt="" width="575" height="376" /></a></p>
<p>Per chi di noi possiede un <strong>account premium</strong>, puÃ² usarlo tramite jDownloader per scaricare al massimo della velocitÃ  con il massimo della comoditÃ . Sono supportati piÃ¹ di 100 servizi di Hosting.</p>
<p style="text-align: center;"><a class="lightbox" style="text-decoration: none;" title="jD5" href="http://www.nerthase.com/blog/wp-content/uploads/2010/02/jD5.png"><img class="aligncenter size-full wp-image-282" title="jD5" src="http://www.nerthase.com/blog/wp-content/uploads/2010/02/jD5.png" alt="" width="575" height="376" /></a></p>
<p>jDownloader ha la possibilitÃ  di intercettare il contenuto degli <em>appunti di sistema</em>. In pratica ci basterÃ  individuare su internet l&#8217;elenco dei link del file che vogliamo scaricare, copiarli e spostarci su jDownloader. Il programma avrÃ  giÃ  intercettato i nostri appunti, e sarÃ  in corso l&#8217;analisi dei link. Se al termine dell&#8217;analisi i file che si desidera scaricare sono tutti online, basterÃ  premere il tasto &#8220;<em>Continua</em>&#8221; per iniziare il download.</p>
<p style="text-align: center;"><a class="lightbox" style="text-decoration: none;" title="jD6" href="http://www.nerthase.com/blog/wp-content/uploads/2010/02/jD6.png"><img class="aligncenter size-full wp-image-283" title="jD6" src="http://www.nerthase.com/blog/wp-content/uploads/2010/02/jD6.png" alt="" width="575" height="376" /></a></p>
<p>jDownloader Ã¨ in grado di estrarre i file una volta scaricati, anche se protetti da password, e di unirli in un unico file, come da origine. Voi non dovrete fare assolutamente nulla.</p>
<p>. . .</p>
<p>jDownloader Ã¨ un software molto completo e funzionale. Lo sviluppatore rilascia continui aggiornamenti, che ne garantiscono il funzionamento continuo. Adesso vi lascio alcuni link per il download del programma e delle dipendenze necessarie:</p>
<ul>
<li><a title="jDownloader downloads" href="http://jdownloader.org/download/index" target="_blank">jDownloader</a></li>
<li><a title="Java" href="http://www.java.com/en/download/manual.jsp" target="_blank">Java</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.nerthase.com/blog/jdownloader-rapidshare-e-megaupload-senza-limiti/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Generatore di Password</title>
		<link>http://www.nerthase.com/blog/generatore-di-password?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=generatore-di-password</link>
		<comments>http://www.nerthase.com/blog/generatore-di-password#comments</comments>
		<pubDate>Sat, 27 Feb 2010 00:09:13 +0000</pubDate>
		<dc:creator>nerthase</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Guide]]></category>
		<category><![CDATA[Informatica & co]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Mondo Linux]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Tutto il resto]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[cracker]]></category>
		<category><![CDATA[generare password]]></category>
		<category><![CDATA[generator]]></category>
		<category><![CDATA[hacker]]></category>
		<category><![CDATA[Mnemonic]]></category>
		<category><![CDATA[Password]]></category>
		<category><![CDATA[sicurezza]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.nerthase.com/blog/?p=246</guid>
		<description><![CDATA[Dopo aver visto come creare una password sicura, e come evitare di farsi rubare la propria password, non poteva mancare un programma per la generazione di password robuste, ma allo stesso tempo facili da ricordare. Il programma da me realizzato, si chiama Mnemonic Password Generator, e ha lo scopo di generare una password diversa per&#8230;]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Dopo aver visto come <a title="Creare password" href="http://www.nerthase.com/blog/password-come-evitare-il-crack" target="_blank">creare una password sicura</a>, e come evitare di farsi <a title="rubare password" href="http://www.nerthase.com/blog/password-come-evitare-il-crack" target="_blank">rubare la propria password</a>, non poteva mancare un programma per la generazione di password robuste, ma allo stesso tempo facili da ricordare.</p>
<div class="clear-block"><div class="ad alignleft"><script type="text/javascript"><!--
google_ad_client = "ca-pub-3082594121433544";
/* 728x90, creato 30/07/09 */
google_ad_slot = "9645358027";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></div>
<p style="text-align: justify;">Il programma da me realizzato, si chiama<strong> Mnemonic Password Generator</strong>, e ha lo scopo di generare una password diversa per ogni servizio che voi utilizzate. Questa password inoltre, sarÃ  basata su vostri dati personali, e quindi facile da ricordare. Ad esempio, basterÃ  dire al programma che io mi chiamo <strong>Mario</strong>, nato a <strong>Settembre</strong>, e che voglio una password per <a title="nerthase" href="http://twitter.com/nerthase" target="_blank">Twitter</a>, ed una possibile password che il programma mi proporrÃ , potrebbe essere <strong>mario09twitter</strong>. Come potete vedere questa password Ã¨ molto facile da ricordare, ma ha tutti gli elementi necessari per durare a lungo contro attacchi di hacker, cracker e malintenzionati.</p>
<p style="text-align: center;"><a class="lightbox" title="Mnemonic Password Generator" href="http://www.nerthase.com/blog/wp-content/uploads/2010/02/mpg-screen.png"><img class="aligncenter size-full wp-image-247" title="Mnemonic Password Generator" src="http://www.nerthase.com/blog/wp-content/uploads/2010/02/mpg-screen.png" alt="" width="573" height="318" /></a></p>
<p style="text-align: justify;">Mnemonic Password Generator Ã¨ stato realizzato in Java ed offre tutte i controlli necessari a personalizzare la propria password preferendo facilitÃ  o sicurezza. Il programma non fa alcun uso delle password generate e/o dei dati inseriti. Questi ultimi sono richiesti al solo scopo di generare una password che sia adatta a voi, e quindi facile da ricordare. MPG (sigla del programma) memorizza i dati da voi inseriti (ma non la password) in un file temporaneo sul vostro computer. L&#8217;unico scopo di questo salvataggio, Ã¨ di evitarvi di riempire tutti i campi ogni volta. Potete, comunque, in qualunque momento eliminare il file contenente questi dati.</p>
<p style="text-align: justify;">Il programma Mnemonic Password Generator Ã¨ disponibile per il download per diverse piattaforme:</p>
<div class="clear-block"><div class="ad alignleft"><script type="text/javascript"><!--
google_ad_client = "ca-pub-3082594121433544";
/* 728x90, creato 30/07/09 */
google_ad_slot = "9645358027";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></div>
<table style="text-align: justify; border: 0px solid #ffffff;" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><a class="lightbox" title="windows" href="http://www.nerthase.com/blog/wp-content/uploads/2010/02/windows.png"><img class="aligncenter size-full wp-image-251" title="windows" src="http://www.nerthase.com/blog/wp-content/uploads/2010/02/windows.png" alt="" width="58" height="58" /></a></td>
<td>
<p style="text-align: left;"><a title="Mnemonic Password Generator - Windows XP Vista Seven" href="http://www.nerthase.com/blog/wp-content/uploads/2010/02/MnemonicPasswordGenerator.exe.zip" target="_blank">Mnemonic Password Generator compatibile con Windows XP / Vista / Seven</a></p>
<p>Non necessita di installazione. Applicazione portabile.</td>
</tr>
<tr>
<td>
<p style="text-align: center;"><a class="lightbox" title="Icona Finder" href="http://www.nerthase.com/blog/wp-content/uploads/2010/02/mac.png"><img class="size-full wp-image-249 aligncenter" title="Icona Finder" src="http://www.nerthase.com/blog/wp-content/uploads/2010/02/mac.png" alt="Icona Finder" width="58" height="58" /></a></p>
</td>
<td><a title="Mnemonic Password Generator - Mac OS X" href="http://www.nerthase.com/blog/wp-content/uploads/2010/02/MnemonicPasswordGenerator.zip" target="_blank">Mnemonic Password Generator compatibile con Mac OS X v10.5 e successive</a></p>
<p>Versione sviluppata su piattaforma Mac OS X 10.6 e quindi pienamente compatibile.</td>
</tr>
<tr>
<td><a class="lightbox" title="universal" href="http://www.nerthase.com/blog/wp-content/uploads/2010/02/universal.png"><img class="aligncenter size-full wp-image-250" title="universal" src="http://www.nerthase.com/blog/wp-content/uploads/2010/02/universal.png" alt="" width="48" height="58" /></a></td>
<td><a title="Mnemonic Password Generator - Universal Binary" href="http://www.nerthase.com/blog/wp-content/uploads/2010/02/MnemonicPasswordGenerator.jar.zip" target="_blank">Mnemonic Password Generator compatibile con Linux ed altre piattaforme</a></p>
<p>Versione Universal Binary dell&#8217;applicazione. Funziona su qualsiasi sistema.</td>
</tr>
</tbody>
</table>
<p style="text-align: justify;">Per malfunzionamenti o problemi di vario genere, sono a vostra completa disposizione.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nerthase.com/blog/generatore-di-password/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Password: come evitare il Crack</title>
		<link>http://www.nerthase.com/blog/password-come-evitare-il-crack?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=password-come-evitare-il-crack</link>
		<comments>http://www.nerthase.com/blog/password-come-evitare-il-crack#comments</comments>
		<pubDate>Fri, 26 Feb 2010 00:33:46 +0000</pubDate>
		<dc:creator>nerthase</dc:creator>
				<category><![CDATA[Guide]]></category>
		<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[Informatica & co]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Tutto il resto]]></category>
		<category><![CDATA[attacco dizionario]]></category>
		<category><![CDATA[brute force]]></category>
		<category><![CDATA[crack]]></category>
		<category><![CDATA[cracker]]></category>
		<category><![CDATA[ddos]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[hacker]]></category>
		<category><![CDATA[Password]]></category>
		<category><![CDATA[phishing]]></category>
		<category><![CDATA[scoprire password]]></category>
		<category><![CDATA[sicurezza]]></category>
		<category><![CDATA[trojan]]></category>
		<category><![CDATA[virus]]></category>

		<guid isPermaLink="false">http://www.nerthase.com/blog/?p=231</guid>
		<description><![CDATA[Dopo avervi parlato del Brute Force, delle sue applicazioni e avervi rilasciato un esempio di codice Java che lo implementa, vi voglio parlare delle PASSWORD, della loro importanza, e soprattutto dell&#8217;attenzione che bisogna avere al momento di sceglierne una. Analizziamo prima alcuni dati fondamentali: Con un semplice programma Java, un tentativo di login presso un&#8230;]]></description>
			<content:encoded><![CDATA[<p>Dopo avervi parlato del <a title="Brute Force per crackare una password" href="http://www.nerthase.com/blog/brute-force-in-java" target="_blank">Brute Force</a>, delle sue applicazioni e avervi rilasciato un esempio di <a title="Brute Force in Java" href="http://www.nerthase.com/blog/brute-force-in-java" target="_blank">codice Java</a> che lo implementa, vi voglio parlare delle <strong>PASSWORD</strong>, della loro importanza, e soprattutto dell&#8217;attenzione che bisogna avere al momento di sceglierne una.</p>
<p>Analizziamo prima alcuni dati fondamentali:</p>
<ul>
<li>Con un semplice programma Java, <em>un tentativo di login presso un sito richiede meno di un secondo</em>;</li>
<li><em>La lunghezza media delle password</em> piÃ¹ usate Ã¨ di 6 caratteri (il minimo che forum come phpBB permettono);</li>
<li>Se nella password di 6 caratteri sono usati solo numeri (data di nascita) i casi possibili sono 10<sup>6</sup> = 1000000;</li>
<li>Se nella password di 6 caratteri sono usate solo lettere, i casi possibili sono 21<sup>6 </sup>= 85766121;</li>
<li>Se la password Ã¨ una parola italiana di senso compiuto, abbiamo questi valori relativi alla lunghezza:
<ul>
<li>Parole italiane di 6 caratteri: 13545</li>
<li>Parole italiane di 7 caratteri: 25802</li>
<li>Parole italiane di 8 caratteri: 35409</li>
<li>Parole italiane di 9 caratteri: 46069</li>
<li>Parole italiane di 10 caratteri: 47932</li>
</ul>
</li>
</ul>
<p>Detto questo, i conti sono presto fatti. Un possibile malintenzionato, sicuramente partirebbe a tentare le password che richiedono il minor numero di tentativi:<br />
<div class="clear-block"><div class="ad alignleft"><script type="text/javascript"><!--
google_ad_client = "ca-pub-3082594121433544";
/* 728x90, creato 30/07/09 */
google_ad_slot = "9645358027";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></div></p>
<h4>Attacco a dizionario</h4>
<p>Questo tipo di attacco, Ã¨ uno dei piÃ¹ semplici ma anche dei piÃ¹ riusciti. Se non vi sembra possibile, provate a ricordare, se avete mai pensato di inserire come password il nome di un vostro animale preferito, della vostra ragazza, della vostra auto preferita, e molto altro ancora&#8230; Tutte queste parole in genere sono presenti nel dizionario italiano, o in alcuni dizionari che Hacker o Cracker si costruiscono arricchendo il dizionario italiano, con parole aggiuntive, che potrebbero essere usate come password.</p>
<p>Facendo due rapidi calcoli, l&#8217;attaccante impiegherebbe:</p>
<ul>
<li>Password di 6 caratteri:Â <strong>13545 tentativi</strong> x <strong>1 secondo</strong> = <strong>13545 secondi</strong> = <strong>quasi 4 ore</strong></li>
<li>Password di 7 caratteri:<strong> <strong>25802 tentativi</strong> xÂ <strong>1 secondo</strong> = 25802Â <strong>secondi</strong> =Â <strong>quasi 8 ore</strong></strong></li>
<li><span style="font-weight: 800;">. Â . Â .</span></li>
</ul>
<p>Vediamo subito che in un giorno, la nostra password potrebbe essere facilmente violata. Per questo Ã¨ sempre consigliabile adottare password che non sono presenti in un dizionario, o combinare due parole di senso compiuto, o alternare parole e numeri. In pratica allungare la password, e spaziare tra caratteri e numeri.</p>
<h4>Attacco a Forza Bruta (<a title="Brute Force in Java" href="http://www.nerthase.com/blog/brute-force-in-java" target="_blank">Brute Force</a>)</h4>
<p>Questo tipo di attacco, sicuramente Ã¨ conosciuto da tutti, se non altro per il <a title="Brute Force in Java" href="http://www.nerthase.com/blog/brute-force-in-java" target="_blank">mio precedente articolo</a>. In questo caso l&#8217;attaccante proverÃ  inizialmente password numeriche, perchÃ© come ben sapete, molti di noi ancora usano come password la propria data di nascita. Purtroppo proprio queste password, sono quelle che vengono violate piÃ¹ spesso, non da attaccanti esterni, ma da conoscenti che si divertono ad incasinare la vita altrui.</p>
<p>Comunque, un possibile attaccante questa volta impiegherebbe:</p>
<ul>
<li>Password di 6 caratteri composta da soli numeri: <strong>10</strong><sup><strong>6</strong></sup> <strong>tentativi </strong>x <strong>1 secondo</strong> = <strong>piÃ¹ di 10 giorni</strong></li>
<li>Password di 6 caratteri composta da sole lettere:<strong> <strong>21</strong><sup><strong>6</strong></sup> <strong>tentativi</strong><span style="font-weight: normal;"> x </span><strong>1 secondo</strong> =Â <strong>piÃ¹ di 2 anni</strong></strong></li>
</ul>
<p>Questi valori cosÃ¬ elevati non devono affatto rassicurarvi, perchÃ© come vedremo piÃ¹ avanti, l&#8217;ipotesi di impiegare un secondo per tentare una password, Ã¨ si realistica, ma molto obsoleta.<br />
<div class="clear-block"><div class="ad alignleft"><script type="text/javascript"><!--
google_ad_client = "ca-pub-3082594121433544";
/* 728x90, creato 30/07/09 */
google_ad_slot = "9645358027";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></div></p>
<h4>Phishing</h4>
<p>Questo tipo di attacco, Ã¨ uno dei piÃ¹ subdoli che possa esistere. Basato sull&#8217;Ingegneria Sociale, trae l&#8217;utente in inganno, in modo che sia egli stesso a fornire la password all&#8217;attaccante. Ormai si sentono notizie tutti i giorni su persone cadute in un attacco del genere. Il problema piÃ¹ grande, Ã¨ generato dal fatto che questo attacco Ã¨ semplicissimo da applicare, e che le persone non prestano mai attenzione quando forniscono i propri dati personali.</p>
<p>Il phishing in pratica consiste nel creare una falsa pagina di login (ad esempio una copia esatta della pagina di login del sito delle poste) e fornirla agli utenti in svariati modi (e-mail, forum, newsletter etc&#8230;). L&#8217;utente, ad esempio, riceve una e-mail in cui gli viene gentilmente chiesto di controllare periodicamente il suo conto Banco Posta presso il link fornito (che non punterÃ  al sito delle Poste Italiane, ma bensÃ¬ alla falsa pagina di login creata dall&#8217;attaccante). L&#8217;utente, riconoscendo visivamente la pagina di login, inserirÃ  senza problemi i propri dati personali. Ed Ã¨ qui, che ha perso tutto quello che possedeva.</p>
<p>Per evitare questo tipo di attaccho, basta prestare attenzione ai link che si visitano, e soprattutto all&#8217;URL della pagina nella quale forniamo i nostri dati. Verifichiamo che sia sempre la giusta pagina, e possibilmente, che usi il protocollo <strong>https</strong>.</p>
<h4>Attacco distribuito</h4>
<p>Questo non Ã¨ un vero e proprio attacco, ma Ã¨ un&#8217;evoluzione dei primi due attacchi che abbiamo visto. Infatti, per ridurre i tempi per portare a segno un attacco, non si usa un solo computer, ma se ne usano diversi, dividendosi i compiti. Se avete letto il mio recente articolo sul <a title="Calcolo distribuito per risolvere un Puzzle" href="http://www.nerthase.com/blog/puzzle-risolto-con-lelaborazione-distribuita" target="_blank">Puzzle Distribuito</a> sapete di sicuro di cosa vi sto parlando.</p>
<p>In pratica, con un attacco a dizionario per parole di 6 lettere, usando un solo computer, venivano impiegate 4 ore. Se lo stesso attacco, fosse portato a compimento usando 4 computer, e dividendosi equamente le 13545 parole di 6 lettere,<em> impiegherebbe solamente un&#8217;ora</em>. Usando ancora piÃ¹ computer, questo attacco potrebbe impiegare pochi minuti. Un miglioramento di prestazioni elevato perÃ², potrÃ  essere quantificabile solo se il numero dei computer coinvolti Ã¨ molto elevato. Pensate che un attacco a Forza Bruta usando <em>caratteri e numeri</em> potrebbe essere compiuto in meno di un giorno, invece dei 2 anni precedentemente calcolati.</p>
<p>Se vi state domandando come possano, eventuali Hacker o Cracker avere a disposizione una simile potenza di calcolo, vi dico un solo termine: <strong>Trojan</strong>. Sicuramente nella vostra vita, avete ricevuto almeno un allarme dall&#8217;antivirus, in cui vi veniva notificata la presenza di un Trojan all&#8217;interno del vostro computer. I Trojan non sono veri e propri virus che infettano e/o compromettono il vostro computer. BensÃ¬ sono dei <em>cavalli di Troia</em> che possono eseguire all&#8217;interno del vostro computer operazioni senza il vostro consenso. Spesso questi Trojan infettano milioni di computer restando apparentemente innocui per un lungo periodo di tempo. Infatti, Ã¨ dopo aver infettato il giusto numero di macchine, che questi Trojan entrano in azioni, comandati da un Server centrale. Il Server comunicherÃ  quindi ai Trojan il sito bersaglio, dividerÃ  le possibili password tra i vari computer infettati, e l&#8217;attacco sarÃ  compiuto in un batter d&#8217;occhio. Se ci pensate bene, Ã¨ lo stesso sistema che ho usato io nella realizzazione delÂ <a title="Calcolo distribuito per risolvere un Puzzle" href="http://www.nerthase.com/blog/?p=226" target="_blank">Puzzle Distribuito</a>. Un semplice e banale sistema, che perÃ² puÃ² compromettere la sicurezza di intere strutture, in un tempo brevissimo.</p>
<p>Dopo essermi tanto dilungato, concluderei semplicemente con il consigliarvi di utilizzare password abbastanza robuste, che non siano individuabili con un semplice attacco a dizionario o Brute Force usando solo lettere o numeri. Usate sempre lettere <strong>E</strong> numeri, e perchÃ© no, anche qualche carattere speciale. Tanto i tasti della tastiera li abbiamo pagati tutti, quindi perchÃ© non usare anche il simbolo <strong>Â§</strong> che altrimenti non sappiamo mai dove mettere?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nerthase.com/blog/password-come-evitare-il-crack/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Puzzle risolto con l&#8217;elaborazione distribuita</title>
		<link>http://www.nerthase.com/blog/puzzle-risolto-con-lelaborazione-distribuita?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=puzzle-risolto-con-lelaborazione-distribuita</link>
		<comments>http://www.nerthase.com/blog/puzzle-risolto-con-lelaborazione-distribuita#comments</comments>
		<pubDate>Thu, 25 Feb 2010 15:57:01 +0000</pubDate>
		<dc:creator>nerthase</dc:creator>
				<category><![CDATA[Aggiornamento]]></category>
		<category><![CDATA[Guide]]></category>
		<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[Informatica & co]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[calcolo distribuito]]></category>
		<category><![CDATA[Client]]></category>
		<category><![CDATA[elaborazione distribuita]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[puzzle distribuito]]></category>
		<category><![CDATA[risolvere puzzle]]></category>
		<category><![CDATA[Roma]]></category>
		<category><![CDATA[Sapienza]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[universitÃ ]]></category>
		<category><![CDATA[YouTube]]></category>

		<guid isPermaLink="false">http://www.nerthase.com/blog/?p=226</guid>
		<description><![CDATA[Dopo avervi parlato dell&#8217;ultimo progetto realizzato per l&#8217;universitÃ , un semplice motore di ricerca che aggrega i risultati di Google, YouTube e Wikipedia, voglio condividere con voi il progetto che ho realizzato come Prova Finale per la Laurea Triennale. Si tratta di un sistema distribuito Client/Server applicato alla risoluzione di un Puzzle. Il Puzzle Distribuito Il&#8230;]]></description>
			<content:encoded><![CDATA[<p>Dopo avervi parlato dell&#8217;ultimo progetto realizzato per l&#8217;universitÃ , <a title="People Finder: Google, YouTube e Wikipedia in un solo motore di ricerca" href="http://www.nerthase.com/blog/google-youtube-wikipedia-in-people-finder" target="_blank">un semplice motore di ricerca che aggrega i risultati di Google, YouTube e Wikipedia</a>, voglio condividere con voi il progetto che ho realizzato come Prova Finale per la Laurea Triennale. Si tratta di un sistema distribuito Client/Server applicato alla risoluzione di un Puzzle.<br />
<div class="clear-block"><div class="ad alignleft"><script type="text/javascript"><!--
google_ad_client = "ca-pub-3082594121433544";
/* 728x90, creato 30/07/09 */
google_ad_slot = "9645358027";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></div></p>
<p><strong>Il Puzzle Distribuito</strong></p>
<p>Il Puzzle Distribuito Ã¨ un progetto che simula quello che nella realtÃ  Ã¨ un puzzle, dalla sua origine (la creazione dei pezzi) al lavoro fatto dalle persone per riunire i pezzi e formare lâ€™immagine originale. Un puzzle reale per essere risolto necessita, a volte, di tempi molto lunghi, i quali perÃ² si possono ridurre se nella risoluzione del puzzle partecipano piÃ¹ persone. Questo effetto nel Puzzle Distribuito Ã¨ simulato attraverso lâ€™uso dellâ€™elaborazione distribuita.</p>
<p><strong>Lâ€™elaborazione distribuita</strong></p>
<p>L&#8217;elaborazione distribuita puÃ² essere facilmente descritta come lo sforzo di unire un complesso di macchine connesse in rete in modo che l&#8217;informazione o altre risorse possano essere condivise da tutte le macchine connesse. La speranza Ã¨ che la divisione possa aver luogo su grandi aree, molte macchine e molti utenti, unificandoli in una consistente e coerente struttura.Â In questa particolare applicazione dellâ€™elaborazione distribuita, sono presenti un sistema centrale, e molti sistemi decentralizzati che gestiscono i calcoli. In questo modo si puÃ² trarre vantaggio dalla potenza di calcolo e dalla memoria disponibile su una possibile vasta rete di computer. Il sistema centrale, invece, ha il compito di stabilire la connessione tra i nodi della rete e coordinare i risultati del calcolo.</p>
<p style="text-align: center;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/n8WsXo789kE&amp;hl=it_IT&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/n8WsXo789kE&amp;hl=it_IT&amp;fs=1&amp;" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>Come il mio solito, vi rendo partecipi dei miei progetti attraverso un semplice video. Questa volta metto a disposizione anche la mia <a title="Puzzle Distribuito - Risolvere un Puzzle utilizzando l'elaborazione distribuita" href="http://www.nerthase.com/blog/wp-content/uploads/2010/02/PuzzleDistribuito.pdf" target="_blank">Relazione per la Prova Finale</a>, che potete consultare per capire meglio il funzionamento del Puzzle Distribuito.</p>
<p>Per ulteriori informazioni non esitate a contattarmi. Durante lo sviluppo del progetto ho spesso ricorso ad Internet per dubbi o aiuti sulla programmazione, quindi mi fa piacere condividerlo con voi.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nerthase.com/blog/puzzle-risolto-con-lelaborazione-distribuita/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Google, YouTube, Wikipedia insieme in People Finder</title>
		<link>http://www.nerthase.com/blog/google-youtube-wikipedia-in-people-finder?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=google-youtube-wikipedia-in-people-finder</link>
		<comments>http://www.nerthase.com/blog/google-youtube-wikipedia-in-people-finder#comments</comments>
		<pubDate>Tue, 23 Feb 2010 16:11:24 +0000</pubDate>
		<dc:creator>nerthase</dc:creator>
				<category><![CDATA[Guide]]></category>
		<category><![CDATA[HTML & CSS]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Tutto il resto]]></category>
		<category><![CDATA[Angelina Jolie]]></category>
		<category><![CDATA[BeyoncÃ©]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Michelle Hunziker]]></category>
		<category><![CDATA[Motore di ricerca]]></category>
		<category><![CDATA[people finder]]></category>
		<category><![CDATA[personaggi famosi]]></category>
		<category><![CDATA[toutube]]></category>
		<category><![CDATA[VIP]]></category>
		<category><![CDATA[wikipedia]]></category>

		<guid isPermaLink="false">http://www.nerthase.com/blog/?p=210</guid>
		<description><![CDATA[Oggi voglio condividere con voi il progetto che ho realizzato con alcuni compagni di UniversitÃ  qualche tempo fa. People Finder, questo Ã¨ il nome del progetto, nasce dall&#8217;esigenza di molti di avere a disposizioni informazioni di diverso genere a natura, tutto su un&#8217;unica pagina Web. People Finder realizza proprio questo. People Finder permette di effettuare&#8230;]]></description>
			<content:encoded><![CDATA[<p>Oggi voglio condividere con voi il progetto che ho realizzato con alcuni compagni di UniversitÃ  qualche tempo fa. <strong>People Finder</strong>, questo Ã¨ il nome del progetto, nasce dall&#8217;esigenza di molti di avere a disposizioni informazioni di diverso genere a natura, tutto su un&#8217;unica pagina Web.</p>
<p><a class="lightbox" title="People Finder" href="http://www.nerthase.com/blog/wp-content/uploads/2010/02/People-Finder.png"><img class="aligncenter size-full wp-image-211" title="People Finder" src="http://www.nerthase.com/blog/wp-content/uploads/2010/02/People-Finder.png" alt="" width="500" height="83" /></a></p>
<p>People Finder realizza proprio questo. People Finder permette di effettuare ricerche su personaggi famosi (ma potete spaziare su qualsiasi genere vogliate), e restituisce i risultati della ricerca, interrogando a sua volta Google Immagini, YouTube e Wikipedia. Come potete vedere dall&#8217;immagine seguente, tutte le informazioni vengono visualizzate in una singola pagina, e messe cosÃ¬ a completa disposizione dell&#8217;utente finale. In particolare, in People Finder, potreteÂ <em>navigare</em> tra le prima 16 immagini restituite da Google inerenti al personaggio desiderato, o tra 4 video dello stesso, ognuno avente un diverso criterio di valutazione,Â <em><strong>il tutto effettuando una sola ricerca, e su una sola pagina</strong></em>.</p>
<p style="text-align: center;"><a class="lightbox" title="People Finder" href="http://www.nerthase.com/blog/wp-content/uploads/2010/02/People-Finder-screen.png"><img class="aligncenter size-full wp-image-212" title="People Finder" src="http://www.nerthase.com/blog/wp-content/uploads/2010/02/People-Finder-screen.png" alt="" width="622" height="389" /></a></p>
<p>People Finder Ã¨ stato realizzato in <strong>Java</strong> ed usa diverse librerie esterne per la gestione di Google, YouTube ed altro ancora. Per essere reso disponibile a tutti gli utenti, senza necessitÃ  di software di installazione, Ã¨ stato sviluppato con tecnologia Web, e quindi il fulcro di People Finder Ã¨ proprio la pagina JSP che si visualizza al momento della ricerca.<br />
<div class="clear-block"><div class="ad alignleft"><script type="text/javascript"><!--
google_ad_client = "ca-pub-3082594121433544";
/* 728x90, creato 30/07/09 */
google_ad_slot = "9645358027";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></div><br />
Come potete vedere nel video seguente, la navigazione tra le immagini ed i video Ã¨ veramente immediata ed intuitiva. Inoltre viene messa in risalto la descrizione iniziale che Wikipedia offre del personaggio cercato. Nel resto della pagina, viene riportato il contenuto della pagina di Wikipedia, ovviamente ripulita e riorganizzata. People Finder Ã¨ stato progettato e realizzato avendo cura di occupare il minor numero di risorse possibile, soprattutto per quanto riguarda la banda a disposizione.</p>
<p style="text-align: center;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/7UB1OnOOSZE&amp;hl=it_IT&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/7UB1OnOOSZE&amp;hl=it_IT&amp;fs=1&amp;" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>Ma non Ã¨ finita qui. <strong>People Finder puÃ² essere usato anche senza una connessione internet</strong>. Infatti Ã¨ disponibile un piccolo applicativo da poter usare sul proprio computer, che permette di effettuare ricerche, di qualsiasi genere, e fornire i risultati interrogando la <em>base documentale</em> precostruita. Questa base documentale puÃ² essere completamente personalizzata, arricchita e adattata alle proprie esigenze. Quando si effettuano modifiche alla base documentale, c&#8217;Ã¨ bisogno di ricostruirla per poter poi essere di nuovo utilizzata. Questo Ã¨ l&#8217;unico momento in cui Ã¨ necessaria una connessione internet.<br />
<div class="clear-block"><div class="ad alignleft"><script type="text/javascript"><!--
google_ad_client = "ca-pub-3082594121433544";
/* 728x90, creato 30/07/09 */
google_ad_slot = "9645358027";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div></div><br />
I documenti all&#8217;interno della base documentale, vengono prelevati direttamente dal Web, utilizzando il portale di People Finder, ma questa volta limitandosi ai soli risultati di Wikipedia. Una volta collezionati questi documenti, vengono indicizzati esattamente nello stesso modo utilizzato da Google, ma con algoritmi diversi. SarÃ  quindi possibile effettuare ricerche libere, senza essere vincolati a ricercare esattamente il personaggio desiderato. L&#8217;utilizzo del software Ã¨ mostrato nel seguente video.</p>
<p style="text-align: center;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/nrj2BTwXKDM&amp;hl=it_IT&amp;fs=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/nrj2BTwXKDM&amp;hl=it_IT&amp;fs=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>People Finder Ã¨ stato realizzato come progetto universitario, ma come potete vedere ha tutte le caratteristiche e potenzialitÃ  per essere usato e distribuito nel mondo reale. Avere una <em>galleria di immagini</em>, una <em>galleria di video</em> e la descrizione accurata e controllata di Wikipedia come risultato della ricerca, il tutto in una sola pagina, Ã¨ per molti ancora un&#8217;utopia, che costringe ad effettuare piÃ¹ volte la stessa ricerca, per ottenere risultati di natura diversa, offerti da portali diversi.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nerthase.com/blog/google-youtube-wikipedia-in-people-finder/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

