<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: servers code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Fri, 29 Aug 2008 02:46:45 GMT</pubDate>
    <description>DZone Snippets: servers code</description>
    <item>
      <title>Search for terms in Domlogs</title>
      <link>http://snippets.dzone.com/posts/show/1258</link>
      <description>How to search for certain terms in your Domlogs, using SSH.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;for files in /usr/local/apache/domlogs/*; do grep "wget" $files; done;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;-OR-&lt;br /&gt;&lt;br /&gt;&lt;code&gt;cd /usr/local/apache/domlogs&lt;br /&gt;grep wget *&lt;br /&gt;grep lynx *&lt;br /&gt;grep curl *&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Replace wget with other file names/terms you might want to search for.&lt;br /&gt;&lt;br /&gt;If that takes too long, try doing it one by one:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;grep wget a*&lt;br /&gt;grep wget b*&lt;br /&gt;grep wget c*&lt;br /&gt;grep wget d*&lt;br /&gt;grep wget e*&lt;br /&gt;grep wget f*&lt;br /&gt;grep wget g*&lt;br /&gt;grep wget h*&lt;br /&gt;grep wget i*&lt;br /&gt;grep wget j*&lt;br /&gt;grep wget k*&lt;br /&gt;grep wget l*&lt;br /&gt;grep wget m*&lt;br /&gt;grep wget n*&lt;br /&gt;grep wget o*&lt;br /&gt;grep wget p*&lt;br /&gt;grep wget q*&lt;br /&gt;grep wget r*&lt;br /&gt;grep wget s*&lt;br /&gt;grep wget t*&lt;br /&gt;grep wget v*&lt;br /&gt;grep wget w*&lt;br /&gt;grep wget x*&lt;br /&gt;grep wget y*&lt;br /&gt;grep wget z*&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Alternatively, if you get an error like "Argument list too long":&lt;br /&gt;&lt;br /&gt;&lt;code&gt;for i in `ls /usr/local/apache/domlogs|grep -v 'bytes_log'`; do echo "checking on $i" &amp;&amp; grep wget /usr/local/apache/domlogs/$i &amp;&amp; grep lynx /usr/local/apache/domlogs/$i &amp;&amp; grep curl /usr/local/apache/domlogs/$i; done &gt; /root/grep-domlogs-results.txt&lt;/code&gt;&lt;br /&gt;Then simply take a look at this file /root/grep-domlogs-results.txt&lt;br /&gt;</description>
      <pubDate>Sat, 21 Jan 2006 21:42:18 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1258</guid>
      <author>nothingless (Sasha)</author>
    </item>
    <item>
      <title>Looking up recent dictionary attacks</title>
      <link>http://snippets.dzone.com/posts/show/1254</link>
      <description>Use the code below to look up what words were used in recent dictionary attacks using SSH.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;grep "dictionary attack" /var/log/exim_mainlog&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sat, 21 Jan 2006 21:40:04 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1254</guid>
      <author>nothingless (Sasha)</author>
    </item>
    <item>
      <title>Looking into DOS and DDOS Attacks</title>
      <link>http://snippets.dzone.com/posts/show/1253</link>
      <description>&lt;a href="http://etechsupport.net/forum/showthread.php?t=434"&gt;A good guide to what to do when your server is attacked&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;top -d2&lt;br /&gt;netstat -nap | grep SYN | wc -l&lt;br /&gt;netstat -nap | less&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;If there are many httpd processes showing up after step 1, you might be under attack. If you get high numbers for the second one, you are almost definitely under attack. Use the third one to see the IP addresses, and then ban them from the server:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;iptables -A INPUT -s ip.address -j DROP&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Also try the following for fixing stuff:&lt;br /&gt;&lt;code&gt;cd /dev/shm&lt;br /&gt;ls&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;And delete anything that's not supposed to be there.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;locate bindz&lt;br /&gt;locate botnet.txt&lt;br /&gt;locate dc&lt;br /&gt;locate ex0.pl&lt;br /&gt;locate kaiten&lt;br /&gt;locate r0nin&lt;br /&gt;locate udp.pl&lt;br /&gt;locate ...&lt;br /&gt;lsof | grep .,&lt;br /&gt;locate mybot&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sat, 21 Jan 2006 21:39:44 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1253</guid>
      <author>nothingless (Sasha)</author>
    </item>
    <item>
      <title>Ban IPs from a server</title>
      <link>http://snippets.dzone.com/posts/show/1252</link>
      <description>Use the code below to permanently ban an IP address from accessing your server.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;iptables -A INPUT -s ip.address -j DROP&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sat, 21 Jan 2006 21:38:45 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1252</guid>
      <author>nothingless (Sasha)</author>
    </item>
    <item>
      <title>How to tail logs</title>
      <link>http://snippets.dzone.com/posts/show/1251</link>
      <description>&lt;code&gt;&lt;br /&gt;tail -200 /var/log/exim_mainlog&lt;br /&gt;tail -200 /usr/local/apache/logs/error_log&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;To watch the log get updated in real time:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;tail -f /var/log/messages &lt;/code&gt;</description>
      <pubDate>Sat, 21 Jan 2006 21:38:25 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1251</guid>
      <author>nothingless (Sasha)</author>
    </item>
    <item>
      <title>How To Manually Update Cpanel</title>
      <link>http://snippets.dzone.com/posts/show/1228</link>
      <description>&lt;code&gt;&lt;br /&gt;/scripts/upcp&lt;br /&gt;&lt;br /&gt;/scripts/upcp --force&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sat, 21 Jan 2006 21:27:20 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1228</guid>
      <author>nothingless (Sasha)</author>
    </item>
    <item>
      <title>How To Restart Services</title>
      <link>http://snippets.dzone.com/posts/show/1227</link>
      <description>Restart Apache:&lt;br /&gt;&lt;code&gt;service httpd restart&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Restart Services:&lt;br /&gt;&lt;code&gt;service chkservd restart&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Restart Cpanel:&lt;br /&gt;&lt;code&gt;/etc/init.d/cpanel restart&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Restart Bind:&lt;br /&gt;&lt;code&gt;service named start&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Run anything in /scripts:&lt;br /&gt;&lt;code&gt;./scriptname&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sat, 21 Jan 2006 21:26:58 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1227</guid>
      <author>nothingless (Sasha)</author>
    </item>
    <item>
      <title>How To Locate Files</title>
      <link>http://snippets.dzone.com/posts/show/1226</link>
      <description>&lt;code&gt;&lt;br /&gt;lsof | grep searchterm&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sat, 21 Jan 2006 21:26:07 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1226</guid>
      <author>nothingless (Sasha)</author>
    </item>
    <item>
      <title>How To Fix Bandwidth Updating</title>
      <link>http://snippets.dzone.com/posts/show/1225</link>
      <description>If bandwidth stats aren't updating:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;/scripts/runweblogs username&lt;br /&gt;/scripts/runlogsnow&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sat, 21 Jan 2006 21:25:49 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1225</guid>
      <author>nothingless (Sasha)</author>
    </item>
    <item>
      <title>How To Fix 403 Errors for public_html</title>
      <link>http://snippets.dzone.com/posts/show/1224</link>
      <description>If all the public_html folders got their permissions wrong:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;chmod 755 /home/*/public_html&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sat, 21 Jan 2006 21:25:28 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1224</guid>
      <author>nothingless (Sasha)</author>
    </item>
  </channel>
</rss>
