<?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>Linux 360° &#124; Italia &#187; php</title>
	<atom:link href="http://www.linux360.it/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.linux360.it</link>
	<description>Notizie, guide e tutorial per il mondo Linux a 360°</description>
	<lastBuildDate>Tue, 16 Dec 2014 14:03:33 +0000</lastBuildDate>
	<language>it-IT</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=3.9.40</generator>
	<item>
		<title>Sito Web attaccato? Strategie di Difesa</title>
		<link>http://www.linux360.it/2014/11/22/sito-web-attaccato-strategie-di-difesa/</link>
		<comments>http://www.linux360.it/2014/11/22/sito-web-attaccato-strategie-di-difesa/#comments</comments>
		<pubDate>Sat, 22 Nov 2014 11:03:48 +0000</pubDate>
		<dc:creator><![CDATA[Paolo Daniele]]></dc:creator>
				<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[Vari]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[base64]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[compromesso]]></category>
		<category><![CDATA[eval]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[sito]]></category>

		<guid isPermaLink="false">http://www.paolodaniele.it/?p=2043</guid>
		<description><![CDATA[<p>Ciao Ragazzi, oggi ho deciso di affrontare un argomento interessante. La maggior parte dei siti web php based oggi utilizza un CMS (Content Management System) come Joomla, WordPress, phpBB, siti di ecommerce etc. Questi hanno semplificato di molto la vita degli utenti ma hanno anche aperto le porte ad attacchi di cracker sempre più frequenti. ...</p>
<p>L'articolo <a rel="nofollow" href="http://www.linux360.it/2014/11/22/sito-web-attaccato-strategie-di-difesa/">Sito Web attaccato? Strategie di Difesa</a> sembra essere il primo su <a rel="nofollow" href="http://www.linux360.it">Linux 360° | Italia</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Ciao Ragazzi,</p>
<p>oggi ho deciso di affrontare un argomento interessante.</p>
<p>La maggior parte dei siti web php based oggi utilizza un CMS (Content Management System) come Joomla, WordPress, phpBB, siti di ecommerce etc.</p>
<p>Questi hanno semplificato di molto la vita degli utenti ma hanno anche aperto le porte ad attacchi di cracker sempre più frequenti.</p>
<p>Molto spesso il nostro sito è sotto attacco e noi non ce ne accorgiamo nemmeno!</p>
<p>Vediamo un po&#8217; come accorgersi se un sito web è stato attaccato e quindi compromesso!</p>
<p><strong>ATTENZIONE: questa guida presuppone che voi possiate accedere ai log del vostro server web e soprattutto al terminale.</strong></p>
<p>Possiamo cominciare.</p>
<p>Per prima cosa si cercano i file .php che sono stati modificati negli ultimi giorni:</p>
<div id="wpshdo_1" class="wp-synhighlighter-outer"><div id="wpshdt_1" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_1"></a><a id="wpshat_1" class="wp-synhighlighter-title" href="#codesyntax_1"  onClick="javascript:wpsh_toggleBlock(1)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_1" onClick="javascript:wpsh_code(1)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_1" onClick="javascript:wpsh_print(1)" title="Print code"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.linux360.it/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_1" class="wp-synhighlighter-inner" style="display: block;"><pre class="bash" style="font-family:monospace;"><span class="kw2">find</span> . <span class="re5">-type</span> f <span class="re5">-name</span> <span class="st_h">'*.php'</span> <span class="sy0">|</span> <span class="kw2">xargs</span> <span class="kw2">grep</span> <span class="re5">-l</span> <span class="st0">&quot;eval *(&quot;</span> <span class="re5">--color</span>
<span class="kw2">find</span> . <span class="re5">-type</span> f <span class="re5">-name</span> <span class="st_h">'*.php'</span> <span class="sy0">|</span> <span class="kw2">xargs</span> <span class="kw2">grep</span> <span class="re5">-l</span> <span class="st0">&quot;base64_decode *(&quot;</span> <span class="re5">--color</span>
<span class="kw2">find</span> . <span class="re5">-type</span> f <span class="re5">-name</span> <span class="st_h">'*.php'</span> <span class="sy0">|</span> <span class="kw2">xargs</span> <span class="kw2">grep</span> <span class="re5">-l</span> <span class="st0">&quot;gzinflate *(&quot;</span> <span class="re5">--color</span></pre></div></div>
<p>In genere gli autori degli script utilizzati per attaccare i siti li mascherano per evitare eventuali antivirus o software capaci di identificare codice maligno.</p>
<p>In questo modo i file che verranno restituiti saranno al 90% sicuramente compromessi (a meno che non abbiate acquisto un qualche script php che non viene fornito con codice sorgente ma viene mascherato!)</p>
<p>Vediamo un esempio pratico che cerca nella cartella wp-content di WordPress:</p>
<div id="wpshdo_2" class="wp-synhighlighter-outer"><div id="wpshdt_2" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_2"></a><a id="wpshat_2" class="wp-synhighlighter-title" href="#codesyntax_2"  onClick="javascript:wpsh_toggleBlock(2)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_2" onClick="javascript:wpsh_code(2)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_2" onClick="javascript:wpsh_print(2)" title="Print code"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.linux360.it/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_2" class="wp-synhighlighter-inner" style="display: block;"><pre class="bash" style="font-family:monospace;"><span class="kw2">find</span> wp-content <span class="re5">-type</span> f <span class="re5">-name</span> <span class="st_h">'*.php'</span> <span class="sy0">|</span> <span class="kw2">xargs</span> <span class="kw2">grep</span> <span class="re5">-l</span> <span class="st0">&quot;gzinflate *(&quot;</span> <span class="re5">--color</span></pre></div></div>
<p>In alcuni casi, dove gli script sono in chiaro alcune delle opzioni che usano sono quelle di aprire dei socket oppure lanciare comandi per eseguire operazioni sul server: Ecco come cercare questo tipo di files:</p>
<div id="wpshdo_3" class="wp-synhighlighter-outer"><div id="wpshdt_3" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_3"></a><a id="wpshat_3" class="wp-synhighlighter-title" href="#codesyntax_3"  onClick="javascript:wpsh_toggleBlock(3)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_3" onClick="javascript:wpsh_code(3)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_3" onClick="javascript:wpsh_print(3)" title="Print code"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.linux360.it/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_3" class="wp-synhighlighter-inner" style="display: block;"><pre class="bash" style="font-family:monospace;"><span class="kw2">find</span> . <span class="re5">-type</span> f <span class="re5">-name</span> <span class="st_h">'*.php'</span> <span class="sy0">|</span> <span class="kw2">xargs</span> <span class="kw2">egrep</span> <span class="re5">-i</span> <span class="st0">&quot;(mail|fsockopen|pfsockopen|stream_socket_client|exec|system|passthru|eval|base64_decode) *(&quot;</span></pre></div></div>
<p>Ma chi attacca i siti queste cose le sa bene, per cui spesso maschera questo tipo di operazioni utilizzando direttamente la codifica Esadecimale (HEX)</p>
<p>In questo modo noi non troveremmo niente eppure il sito rimane compromesso&#8230;</p>
<p>Ecco come fare:</p>
<div id="wpshdo_4" class="wp-synhighlighter-outer"><div id="wpshdt_4" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_4"></a><a id="wpshat_4" class="wp-synhighlighter-title" href="#codesyntax_4"  onClick="javascript:wpsh_toggleBlock(4)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_4" onClick="javascript:wpsh_code(4)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_4" onClick="javascript:wpsh_print(4)" title="Print code"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.linux360.it/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_4" class="wp-synhighlighter-inner" style="display: block;"><pre class="bash" style="font-family:monospace;"><span class="kw2">find</span> . <span class="re5">-type</span> f <span class="re5">-name</span> <span class="st_h">'*.php'</span> <span class="sy0">|</span> <span class="kw2">xargs</span> <span class="kw2">egrep</span> <span class="re5">-i</span> <span class="st0">&quot;preg_replace *((['|&quot;</span><span class="br0">]</span><span class="br0">&#41;</span><span class="br0">&#40;</span>.<span class="br0">&#41;</span>.<span class="sy0">*</span><span class="nu0">2</span><span class="br0">[</span>a-z<span class="br0">]</span><span class="sy0">*</span>e<span class="br0">[</span>^<span class="nu0">1</span><span class="br0">]</span><span class="sy0">*</span><span class="nu0">1</span> <span class="sy0">*</span>,<span class="st0">&quot; --color</span></pre></div></div>
<p>Con il codice che ho scritto sopra si vanno a cercare tutti i preg_replace dove si cerca di inserire del codice esadecimale!</p>
<p>Continuiamo con l&#8217;esempio di WordPress.</p>
<p>Mettiamo il caso di avere il sospetto o la certezza che il sito sia stato compromesso.</p>
<p>Possiamo effettuare un upload sul server di una versione &#8220;pulita&#8221; di wordpress( o un altro cms) in un&#8217;altra cartella ed effettuare un <strong>diff</strong> per notare eventuali differenze (Attenzione perchè in questo caso le versioni del CMS devono essere uguali!)</p>
<div id="wpshdo_5" class="wp-synhighlighter-outer"><div id="wpshdt_5" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_5"></a><a id="wpshat_5" class="wp-synhighlighter-title" href="#codesyntax_5"  onClick="javascript:wpsh_toggleBlock(5)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_5" onClick="javascript:wpsh_code(5)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_5" onClick="javascript:wpsh_print(5)" title="Print code"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.linux360.it/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_5" class="wp-synhighlighter-inner" style="display: block;"><pre class="bash" style="font-family:monospace;"><span class="kw2">diff</span> <span class="re5">-r</span> wordpress-ok<span class="sy0">/</span> wordpress-hack<span class="sy0">/</span> <span class="re5">-x</span> wp-content</pre></div></div>
<p>Inoltre la maggior parte degli attacchi prolificano su server dove vengono concessi (volontariamente o meno) i permessi di scrittura sulle cartelle.</p>
<p>Di seguito un breve script per aiutare a capire i file .php presenti nelle cartelle con permessi 777:</p>
<div id="wpshdo_6" class="wp-synhighlighter-outer"><div id="wpshdt_6" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_6"></a><a id="wpshat_6" class="wp-synhighlighter-title" href="#codesyntax_6"  onClick="javascript:wpsh_toggleBlock(6)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_6" onClick="javascript:wpsh_code(6)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_6" onClick="javascript:wpsh_print(6)" title="Print code"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.linux360.it/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_6" class="wp-synhighlighter-inner" style="display: block;"><pre class="bash" style="font-family:monospace;"><span class="co0">#!/bin/bash</span>
&nbsp;
<span class="re2">search_dir</span>=$<span class="br0">&#40;</span><span class="kw3">pwd</span><span class="br0">&#41;</span>
<span class="re2">writable_dirs</span>=$<span class="br0">&#40;</span><span class="kw2">find</span> <span class="re1">$search_dir</span> <span class="re5">-type</span> d <span class="re5">-perm</span> 0777<span class="br0">&#41;</span>
&nbsp;
<span class="kw1">for</span> <span class="kw2">dir</span> <span class="kw1">in</span> <span class="re1">$writable_dirs</span>
<span class="kw1">do</span>
    <span class="co0">#echo $dir</span>
    <span class="kw2">find</span> <span class="re1">$dir</span> <span class="re5">-type</span> f <span class="re5">-name</span> <span class="st_h">'*.php'</span>
<span class="kw1">done</span></pre></div></div>
<p>Reso eseguibile lo script è possibile verificare i file in questo modo:</p>
<div id="wpshdo_7" class="wp-synhighlighter-outer"><div id="wpshdt_7" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_7"></a><a id="wpshat_7" class="wp-synhighlighter-title" href="#codesyntax_7"  onClick="javascript:wpsh_toggleBlock(7)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_7" onClick="javascript:wpsh_code(7)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_7" onClick="javascript:wpsh_print(7)" title="Print code"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.linux360.it/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_7" class="wp-synhighlighter-inner" style="display: block;"><pre class="bash" style="font-family:monospace;">.<span class="sy0">/</span>search_php777 <span class="sy0">&gt;</span> results.txt</pre></div></div>
<p>Questo script può essere variato nel seguente modo (in base a quanto abbiamo detto prima):</p>
<div id="wpshdo_8" class="wp-synhighlighter-outer"><div id="wpshdt_8" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_8"></a><a id="wpshat_8" class="wp-synhighlighter-title" href="#codesyntax_8"  onClick="javascript:wpsh_toggleBlock(8)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_8" onClick="javascript:wpsh_code(8)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_8" onClick="javascript:wpsh_print(8)" title="Print code"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.linux360.it/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_8" class="wp-synhighlighter-inner" style="display: block;"><pre class="bash" style="font-family:monospace;"><span class="co0">#!/bin/bash</span>
&nbsp;
<span class="re2">IFS</span>=$<span class="st_h">'n'</span>
&nbsp;
<span class="kw1">while</span> <span class="kw2">read</span> php_file
<span class="kw1">do</span>
    <span class="kw2">egrep</span> <span class="re5">-i</span> <span class="st0">&quot;(mail|eval|base64_decode|str_rot13|chmod|fwrite|exec|passthru|shell_exec|system|proc_open|popen|curl_exec|curl_multi_exec|show_source|fsockopen|pfsockopen|stream_socket_client) *(&quot;</span> <span class="st0">&quot;<span class="es2">$php_file</span>&quot;</span>
<span class="kw1">done</span> <span class="sy0">&lt;</span> php_in_writable.txt</pre></div></div>
<p>Da eseguire in questo modo:</p>
<div id="wpshdo_9" class="wp-synhighlighter-outer"><div id="wpshdt_9" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_9"></a><a id="wpshat_9" class="wp-synhighlighter-title" href="#codesyntax_9"  onClick="javascript:wpsh_toggleBlock(9)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_9" onClick="javascript:wpsh_code(9)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_9" onClick="javascript:wpsh_print(9)" title="Print code"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.linux360.it/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_9" class="wp-synhighlighter-inner" style="display: block;"><pre class="bash" style="font-family:monospace;">.<span class="sy0">/</span>find_malicious</pre></div></div>
</div>
<p>Ultima ma non meno importante delle cose da verificare, è la possibilità che del codice php sia &#8220;nascosto&#8221; dentro una immagine:</p>
<div id="wpshdo_10" class="wp-synhighlighter-outer"><div id="wpshdt_10" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_10"></a><a id="wpshat_10" class="wp-synhighlighter-title" href="#codesyntax_10"  onClick="javascript:wpsh_toggleBlock(10)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_10" onClick="javascript:wpsh_code(10)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_10" onClick="javascript:wpsh_print(10)" title="Print code"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.linux360.it/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_10" class="wp-synhighlighter-inner" style="display: block;"><pre class="bash" style="font-family:monospace;"><span class="kw2">find</span> wp-content<span class="sy0">/</span>uploads <span class="re5">-type</span> f <span class="re5">-iname</span> <span class="st_h">'*.jpg'</span> <span class="sy0">|</span> <span class="kw2">xargs</span> <span class="kw2">grep</span> <span class="re5">-i</span> php</pre></div></div>
<p>Per chi preferisce avere un unico script che fa tutto, può utilizzare <a href="https://github.com/neohapsis/neopi">NeoPI</a> che racchiunde gran parte delle analisi che vi ho mostrato solo scritte in Python!</p>
<p>Buona analisi a tutti.</p>
<p>Enjoy!</p>
</div>
</div>
</div>
<p>L'articolo <a rel="nofollow" href="http://www.linux360.it/2014/11/22/sito-web-attaccato-strategie-di-difesa/">Sito Web attaccato? Strategie di Difesa</a> sembra essere il primo su <a rel="nofollow" href="http://www.linux360.it">Linux 360° | Italia</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.linux360.it/2014/11/22/sito-web-attaccato-strategie-di-difesa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Asterisk CDR con SQLite3 e PHP</title>
		<link>http://www.linux360.it/2014/04/30/asterisk-cdr-con-sqlite3-e-php/</link>
		<comments>http://www.linux360.it/2014/04/30/asterisk-cdr-con-sqlite3-e-php/#comments</comments>
		<pubDate>Wed, 30 Apr 2014 10:24:36 +0000</pubDate>
		<dc:creator><![CDATA[Paolo Daniele]]></dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[Varie]]></category>
		<category><![CDATA[asterisk]]></category>
		<category><![CDATA[cdr]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.paolodaniele.it/?p=1718</guid>
		<description><![CDATA[<p>Oggi vi propongo una guida interessante. Sempre sviluppata con l&#8217;amico Frank al quale vengono le idee&#8230;e io poi le realizzo! La base è quella di voler realizzare un sistema minimale di CDR (Call Detail Recording) ossia uno strumento che permette di visualizzare i dettagli delle chiamate sui centralini Asterisk. Il sistema classico utilizza MySQL e ...</p>
<p>L'articolo <a rel="nofollow" href="http://www.linux360.it/2014/04/30/asterisk-cdr-con-sqlite3-e-php/">Asterisk CDR con SQLite3 e PHP</a> sembra essere il primo su <a rel="nofollow" href="http://www.linux360.it">Linux 360° | Italia</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Oggi vi propongo una guida interessante.</p>
<p>Sempre sviluppata con l&#8217;amico <a href="http://www.ubuntuserver.it">Frank</a> al quale vengono le idee&#8230;e io poi le realizzo!</p>
<p>La base è quella di voler realizzare un sistema minimale di CDR (Call Detail Recording) ossia uno strumento che permette di visualizzare i dettagli delle chiamate sui centralini Asterisk.</p>
<p>Il sistema classico utilizza MySQL e si trova molto materiale in giro per la rete.</p>
<p>Oggi vi spiego come realizzarlo con SQLite, che è una versione minimal di SQL, da utilizzare su quei dispositivi dove non ci sono molte risorse (vedi centralino asterisk su Raspberry)</p>
<p><strong>Requisiti:</strong></p>
<p>- Asterisk</p>
<p>- Debian (o qualunque altro SO)</p>
<p>- SQLite</p>
<p>- Apache (o un qualunque Web Server)</p>
<p>- Php5 con supporto per SQLite3</p>
<p><strong>Installazione Requisiti:</strong></p>
<p>Per installare SQLite3:</p>
<div id="wpshdo_11" class="wp-synhighlighter-outer"><div id="wpshdt_11" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_11"></a><a id="wpshat_11" class="wp-synhighlighter-title" href="#codesyntax_11"  onClick="javascript:wpsh_toggleBlock(11)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_11" onClick="javascript:wpsh_code(11)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_11" onClick="javascript:wpsh_print(11)" title="Print code"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.linux360.it/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_11" class="wp-synhighlighter-inner" style="display: block;"><pre class="bash" style="font-family:monospace;"><span class="kw2">sudo</span> <span class="kw2">apt-get</span> <span class="kw2">install</span> libxml2-dev ncurses-dev libsqlite3-dev sqlite3</pre></div></div>
<p>Per installare Apache:</p>
<div id="wpshdo_12" class="wp-synhighlighter-outer"><div id="wpshdt_12" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_12"></a><a id="wpshat_12" class="wp-synhighlighter-title" href="#codesyntax_12"  onClick="javascript:wpsh_toggleBlock(12)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_12" onClick="javascript:wpsh_code(12)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_12" onClick="javascript:wpsh_print(12)" title="Print code"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.linux360.it/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_12" class="wp-synhighlighter-inner" style="display: block;"><pre class="bash" style="font-family:monospace;"><span class="kw2">sudo</span> <span class="kw2">apt-get</span> <span class="kw2">install</span> apache2</pre></div></div>
<p>Per installare PHP5-SQLite:</p>
<div id="wpshdo_13" class="wp-synhighlighter-outer"><div id="wpshdt_13" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_13"></a><a id="wpshat_13" class="wp-synhighlighter-title" href="#codesyntax_13"  onClick="javascript:wpsh_toggleBlock(13)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_13" onClick="javascript:wpsh_code(13)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_13" onClick="javascript:wpsh_print(13)" title="Print code"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.linux360.it/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_13" class="wp-synhighlighter-inner" style="display: block;"><pre class="bash" style="font-family:monospace;"><span class="kw2">sudo</span> <span class="kw2">apt-get</span> <span class="kw2">install</span> php5-sqlite3</pre></div></div>
<p>&nbsp;</p>
<p><strong>Procedimento:</strong></p>
<p>Per prima cosa è necessario che asterisk sia compilato con SQLite.</p>
<p>Per fare questo bisogna controllare che nella cartella dove sono installati i noduli di asterisk generalmente <em>/usr/lib/asterisk/modules</em> sia presente il file <strong>cdr_sqlite3_custom.so.</strong></p>
<p>Se non è installato è necessario ricompilare asterisk aggiungendo il modulo indicato sopra facendo:</p>
<div id="wpshdo_14" class="wp-synhighlighter-outer"><div id="wpshdt_14" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_14"></a><a id="wpshat_14" class="wp-synhighlighter-title" href="#codesyntax_14"  onClick="javascript:wpsh_toggleBlock(14)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_14" onClick="javascript:wpsh_code(14)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_14" onClick="javascript:wpsh_print(14)" title="Print code"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.linux360.it/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_14" class="wp-synhighlighter-inner" style="display: block;"><pre class="bash" style="font-family:monospace;"><span class="kw2">make</span> menuselect</pre></div></div>
<p>(Non mi soffermo su questo perchè si trovano molte guide in giro)<br />
Fatto questo bisogna modificare il file <strong>cdr_sqlite3_custom.conf </strong>in <em>/etc/asterisk</em> come nel file in allegato.</p>
<p>Se è già installato SQLite e il <strong>master.db</strong> è già creato è necessario rimuoverlo per adattarlo alla mia conf.(se non volete basta modificare il file cdr_sqlite.php adattandolo alle vostre esigenze!)</p>
<p>Per verificare se il master.db è già creato bisogna vedere se nel percorso <em>/var/log/asterisk</em> è presente.</p>
<p>Una volta modificato il file cdt_sqlite3_custom.conf è necessario riavviare Asterisk (<em>sudo /etc/init.d/asterisk restart</em>)</p>
<p>Fatto questo basta scompattare i file che vi allego dentro una /var/www o comunque la directory principale del vostro web server.</p>
<p>Se tutto è ok potrete vedere i dettagli delle vostre chiamate digitando nel browser: http://localhost/cdr_sqlite.php</p>
<p>Enjoy!</p>
<p><a href="http://www.paolodaniele.it/wp-content/uploads/2014/04/cdr_sqlite.zip">Dowload Sorgenti</a></p>
<p>&nbsp;</p>
<p>L'articolo <a rel="nofollow" href="http://www.linux360.it/2014/04/30/asterisk-cdr-con-sqlite3-e-php/">Asterisk CDR con SQLite3 e PHP</a> sembra essere il primo su <a rel="nofollow" href="http://www.linux360.it">Linux 360° | Italia</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.linux360.it/2014/04/30/asterisk-cdr-con-sqlite3-e-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress: Gestire le variabili $_SESSION</title>
		<link>http://www.linux360.it/2014/01/10/wordpress-gestire-le-variabili-_session/</link>
		<comments>http://www.linux360.it/2014/01/10/wordpress-gestire-le-variabili-_session/#comments</comments>
		<pubDate>Fri, 10 Jan 2014 16:30:08 +0000</pubDate>
		<dc:creator><![CDATA[Paolo Daniele]]></dc:creator>
				<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[Varie]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[session]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tricks]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.paolodaniele.it/?p=1706</guid>
		<description><![CDATA[<p>Per gestire le variabili $_SESSION in WordPress si trova molto materiale in giro sulla rete. Non sempre però questo funziona realmente: plugin, guide, etc&#8230;.alla fine c&#8217;è sempre qualcosa che non torna. Ecco ho fatto tornare i conti! Per gestire le variabili $_SESSION[] all&#8217;interno di WordPress, la prima cosa da fare è aprire il file functions.php ...</p>
<p>L'articolo <a rel="nofollow" href="http://www.linux360.it/2014/01/10/wordpress-gestire-le-variabili-_session/">WordPress: Gestire le variabili $_SESSION</a> sembra essere il primo su <a rel="nofollow" href="http://www.linux360.it">Linux 360° | Italia</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Per gestire le variabili $_SESSION in WordPress si trova molto materiale in giro sulla rete.</p>
<p>Non sempre però questo funziona realmente: plugin, guide, etc&#8230;.alla fine c&#8217;è sempre qualcosa che non torna.</p>
<p>Ecco ho fatto tornare i conti!</p>
<p>Per gestire le variabili $_SESSION[] all&#8217;interno di WordPress, la prima cosa da fare è aprire il file <strong><em>functions.php</em></strong> del vostro tema e inserire subito dopo il tag  di apertura di php:</p>
<div id="wpshdo_15" class="wp-synhighlighter-outer"><div id="wpshdt_15" class="wp-synhighlighter-expanded"><table border="0" width="100%"><tr><td align="left" width="80%"><a name="#codesyntax_15"></a><a id="wpshat_15" class="wp-synhighlighter-title" href="#codesyntax_15"  onClick="javascript:wpsh_toggleBlock(15)" title="Click to show/hide code block">Source code</a></td><td align="right"><a href="#codesyntax_15" onClick="javascript:wpsh_code(15)" title="Show code only"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/code.png" /></a>&nbsp;<a href="#codesyntax_15" onClick="javascript:wpsh_print(15)" title="Print code"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/printer.png" /></a>&nbsp;<a href="http://www.linux360.it/wp-content/plugins/wp-synhighlight/About.html" target="_blank" title="Show plugin information"><img border="0" style="border: 0 none" src="http://www.linux360.it/wp-content/plugins/wp-synhighlight/themes/default/images/info.gif" /></a>&nbsp;</td></tr></table></div><div id="wpshdi_15" class="wp-synhighlighter-inner" style="display: block;"><pre class="php" style="font-family:monospace;"><span class="kw1">if</span><span class="br0">&#40;</span><span class="sy0">!</span><a href="http://www.php.net/session_id"><span class="kw3">session_id</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> add_action<span class="br0">&#40;</span><span class="st_h">'init'</span><span class="sy0">,</span> <span class="st_h">'session_start'</span><span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div><strong><br />
</strong></p>
<p>Il gioco è fatto!</p>
<p>Adesso potete usare le variabili $_SESSION nel vostro WordPress!</p>
<p>Enjoy!</p>
<p>L'articolo <a rel="nofollow" href="http://www.linux360.it/2014/01/10/wordpress-gestire-le-variabili-_session/">WordPress: Gestire le variabili $_SESSION</a> sembra essere il primo su <a rel="nofollow" href="http://www.linux360.it">Linux 360° | Italia</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.linux360.it/2014/01/10/wordpress-gestire-le-variabili-_session/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Postfix Admin update</title>
		<link>http://www.linux360.it/2013/06/25/postfix-admin-update/</link>
		<comments>http://www.linux360.it/2013/06/25/postfix-admin-update/#comments</comments>
		<pubDate>Tue, 25 Jun 2013 06:39:31 +0000</pubDate>
		<dc:creator><![CDATA[Paolo Daniele]]></dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[Programmazione]]></category>
		<category><![CDATA[Varie]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[imap]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[posta]]></category>
		<category><![CDATA[postifixadmin]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://www.paolodaniele.it/?p=1572</guid>
		<description><![CDATA[<p>A chi è del mestiere e lavora con server di posta sotto Linux, sicuramente utilizza Postfix Admin per la gestione degli account di posta elettronica! Sabato ho fatto l&#8217;update sui nostri server a TLCWEB ed è andato tutto ok&#8230;. Ieri apro una casella per modificarla e&#8230; magia! Spunta fuori un bel messaggio di errore: Invalid ...</p>
<p>L'articolo <a rel="nofollow" href="http://www.linux360.it/2013/06/25/postfix-admin-update/">Postfix Admin update</a> sembra essere il primo su <a rel="nofollow" href="http://www.linux360.it">Linux 360° | Italia</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>A chi è del mestiere e lavora con server di posta sotto Linux, sicuramente utilizza Postfix Admin per la gestione degli account di posta elettronica!</p>
<p>Sabato ho fatto l&#8217;update sui nostri server a <a href="http://www.tlcweb.com">TLCWEB</a> ed è andato tutto ok&#8230;.</p>
<p>Ieri apro una casella per modificarla e&#8230; magia! Spunta fuori un bel messaggio di errore:</p>
<p><em>Invalid query: Unknown column &#8216;local_part&#8217; in &#8216;field list&#8217;</em></p>
<p><em>Please check the documentation and website for more information.</em></p>
<p><em>Postfix Admin</em><br />
<em> Forums</em></p>
<p>Senza farsi prendere dal panico&#8230;</p>
<p>Basta aprire il file edit-mailbox.php, trovare la riga</p>
<blockquote><p>$formvars['local_part'] = $matches[1];</p></blockquote>
<p>E commentarla!</p>
<p>Il gioco è fatto&#8230;</p>
<p>Enjoy!</p>
<p>L'articolo <a rel="nofollow" href="http://www.linux360.it/2013/06/25/postfix-admin-update/">Postfix Admin update</a> sembra essere il primo su <a rel="nofollow" href="http://www.linux360.it">Linux 360° | Italia</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.linux360.it/2013/06/25/postfix-admin-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
