Take the 2-minute tour ×
Code Review Stack Exchange is a question and answer site for peer programmer code reviews. It's 100% free, no registration required.

I've made some unethical code giving HTML responses at random and masking what is there for fun. It targets mainly crawlers and scripts that run through your website that are looking for vulnerabilities AKA dem script kiddies.

Function TarPit() {
/* Send to Tarpit */
    $responce = array(200,204,300,301,302,303,304,404,410,409,406,418,500);
    $array_select = array_rand($responce,1);
    http_response_code($responce[$array_select]);
    Print(http_response_code());
    Exit(Require_once './CUSTERR/en.php');
}

/CUSTERR/en.php Make for different languages

<?php
if(isset($_SESSION['authenticated_user'])){exit(header('refresh:0; ../index.php', false));} //You do not want your Logged in users seeing this
$http_response_code = array(200,204,300,301,302,303,304,404,406,409,410,418,500);
$http_response_name = array('Accepted','No Content','Multiple Choices','Moved Permanently','Found','See Other','Not Modified','Not Found','Not Acceptable','Conflict','Gone','I am a Teapot','Internal Server Error');
$http_response_discription = array('Accepted your connection','','Just letting you know this is actually a questionnaire?','Moved permanently somewhere else. Definitely not here although','Don\'t Panic! The monkeys have found it','Go see the other guy.','This page is Definitely not modified in anyway.',' The requested URL ' . $_SERVER['REQUEST_URI'] . ' was not found by the monkeys on this server.','This is Unacceptable','Just couldn\'t decide on what to give you','It\'s Gone. Just Gone?','I am a Teapot','Internal Server Error');

$name = str_replace(http_response_code(),$http_response_code,$http_response_name);
$description = str_replace(http_response_code(),$http_response_code,$http_response_discription);

Print('<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
<title>' . http_response_code() . $name .'</title>
</head><body>
<h1>' . http_response_code() . $name .'</h1>
<p>' . $description . '</p>
</body></html>');
?>
share|improve this question
    
If you're going to add responses/etc, suggest you put the strings in a file instead of tweaking the code each time. –  Barry Carter Feb 5 at 22:25
    
Will do i noticed that i made a mistake in writing str_replace aswell i switched it to array_search –  Werezwolf Feb 6 at 5:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.