Bloqueio de Bad User Agent via htaccess ou httpd.conf

Notei diversos atauqes a servidores usando os identificadores “Mozilla/3.0 (compatible; Indy Library)” , “HTTP Client“, “libwww” e “havij” entĂŁo decidĂ­ bloqueá-los permanetntemente, no meu caso useu a configuração diretamente no httpd.conf do servidor, mas tambĂ©m pode ser realizado via .htaccess

 

SetEnvIfNoCase User-Agent ^Mozilla.*Indy badUA
SetEnvIfNoCase User-Agent "HTTP Client" badUA
SetEnvIfNoCase User-Agent ^.*Havij badUA
SetEnvIfNoCase User-Agent "libwww-perl" badUA
Order Allow,Deny
Allow from all
Deny from env=badUA

Algumas informações que achei na net:

Indy Library – Normalmente essas requisições vem de suites de ferramentas da borland para delfi/c++
HTTP Client – Requisições genericas
libwww – Vem da lib Perl::LWP (Library for WorldWideWeb in Perl)
Havij – Ferramenta para testes de segurança em websites, usado normalmente para ataques via sql injection (em breve um post sobre a ferramenta)

———————————————-
Posted Listening: “Doctor Doctor – UFO”

Lista de Mobile User Agents

O site abaixo contém uma lista bem completa de user agent usado por dispositivos móveis, na maioria celulares.

http://www.zytrax.com/tech/web/mobile_ids.html

Se deseja parsear o site e obter uma lista limpa, pode usar o cĂłdigo abaixo que Ă© disponibilizado no prĂłprio site

$page = file_get_contents('http://www.zytrax.com/tech/web/mobile_ids.html');
preg_match_all('/<(p(?:re)?)[^>]*class="g-c-[ns]"[^>]*>(.*?)</1>/s', $page, $m);

$agents = array();
foreach($m[2] as $agent) {
  $split = explode("n", trim($agent));
  foreach($split as $item) {
    $agents[] = trim($item);
  }
}
// $agents now holds every user agent string, one per array index, trimmed
foreach($agents as $agent) {
 echo($agent."n");
}

———————————————-
Posted Listening: “Starbreaker – Judas Priest”