Current location: Hot Scripts Forums » Programming Languages » PHP » A new way to test your site's security


A new way to test your site's security

Reply
  #1 (permalink)  
Old 09-25-04, 08:42 AM
Eclipse's Avatar
Eclipse Eclipse is offline
Coding Addict
 
Join Date: May 2004
Location: Long Island, New York
Posts: 356
Thanks: 0
Thanked 0 Times in 0 Posts
A new way to test your site's security

I have been getting into security in php as are many people, but I wrote a script that will submit fake post data to a website to test for security flaws. This in not for hacking. Here it is hope it helps someone:
PHP Code:

<html>

<title>Fake Post Data Generator {writen by Eclipse}</title>
</head>
<body>
<?
/*
Writen by Eclipse 
Website: [url]http://www.eclipsethenet.us[/url]
E-mail: [email]admin@eclipsethenet.us[/email]
By using this script you have read the following:
1.) I am not responsible for damage you may cause with this script if any.
2.) This is open source so any changes are not only allowed but encouraged, please send them to my e-mail.
3.) This script is not for 'hacking' it is a way to test security in your own scripts.
*/
if(!isset($_GET["url"]) AND !isset($_GET["set"])){
    echo(
'<form meathod="POST" action="' $_SERVER["PHP_SELF"] . '">Target URL: <input type="text" name="url" size="60">{leave out protocal}<br>Number of POST data submited: <input type="text" name="set" maxlength="2" size="2"><br><input type="submit" value="Continue"><input type="reset"></form></body></html>');
}
elseif(isset(
$_GET["url"]) AND isset($_GET["set"]) AND !is_numeric($_GET["set"])){
    
$string "<a href=\""$_SERVER["PHP_SELF"] . "\">Please fill out form correctly.</a> <i>Error Code: 1</i><br>Please go <a href=\"javascript:history.back(-1);\">back</a>";
}
elseif(isset(
$_GET["url"]) AND isset($_GET["set"]) AND is_numeric($_GET["set"])){
    
$test fsockopen($_GET["url"], 80$errno$errstr30);
    if(
$test){
        
$set $_GET["set"];
        
$set_1 "0";
        
$self $_SERVER["PHP_SELF"];
        
$url_1 $_GET["url"];
        
$url $self '?url=' $url_1;
        echo(
'<form meathod="GET" action="' $_SERVER["PHP_SELF"] . '">');
        While(
$set_1 != $set){
            
$set_1 = ++$set_1;
            
$post 'post' $set_1;
            echo(
'Post Data number ' $set_1 ': ' '<input type="text" name="' $post '" value="Name"><br>');
            }
            echo(
'<input type="hidden" name="FAKE_POST_DATA"><input type="hidden" name="url" value="' $url_1 '"><input type="submit" value="Send Post"><form>');
        }
        elseif(!
$test == "FALSE"){
            
$string 'Please enter a valid url, go <a href="javascript:history.back(-1);">back.</a>';
        }
}
elseif(isset(
$_GET["FAKE_POST_DATA"]) AND isset($_GET["url"])){
    
$count count($_GET) - 2;
    
$count_1 "0";
    
$index "0";
    echo(
'<form meathod="GET" action="' $_SERVER["PHP_SELF"] . '">');
    while(
$count_1 != $count){
        
$count_1 = ++$count_1;
        
$url $_GET["url"];
        
$post_1 'post' $count_1;
        
$post $_GET[$post_1];
        
$post_n $post ': ';
        echo(
$post_n '<input type="text" name="' $post '" value="Enter a Value"><br>');
    }
    echo(
'<input type="hidden" name="FAKE_POST_DATA_2"><input type="hidden" name="url" value="' $_GET["url"] . '"><input type="submit" value="Send Data"></form>');
}
elseif(isset(
$_GET["FAKE_POST_DATA_2"]) AND isset($_GET["url"])){
    
$url $_GET["url"];
    unset(
$_GET["url"]);
    unset(
$_GET["FAKE_POST_DATA_2"]);
    echo(
'<form action="http://' $url '" meathod="post"><b><i>Sending:</i></b><br>');
    foreach(
$_GET as $i){
        while (
$name current($_GET)) {
            if (
$name == $i) {
                
$key =  key($_GET);
            }
                
next($_GET);
        }
        echo(
'<input type="hidden" name="' $key '" value="' $i '"><b>Name: </b><i>' $key '</i>     <b>Value: </b><i>' $i '</i><br>');
    }
    echo(
'<input type="submit" value="Send Data"></form>');
}

if(isset(
$string)){
echo(
$string);
}
?>
</body>
</html>
Reply With Quote
  #2 (permalink)  
Old 09-25-04, 09:44 AM
mikaelf mikaelf is offline
Wannabe Coder
 
Join Date: Jun 2004
Location: php[dot]net
Posts: 198
Thanks: 0
Thanked 0 Times in 0 Posts
hi, eclipse.
only single unusable character and your script won't work. please have a self test. nice try, though. fortunately, this script algorithm won't work for recent php version.
__________________
Useful PHP links:
bugs.php.net - for reporting PHP bugs
pear.php.net - PHP extension and application repository
pecl.php.net - get non standard PHP modules, submit yours
www.phpclasses.org - PHP classes repository
Reply With Quote
  #3 (permalink)  
Old 09-25-04, 09:46 AM
Eclipse's Avatar
Eclipse Eclipse is offline
Coding Addict
 
Join Date: May 2004
Location: Long Island, New York
Posts: 356
Thanks: 0
Thanked 0 Times in 0 Posts
Well it's working fine for me on both 4.3.1 and 5.0.1 so i don't know....
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
security concerns new purchased script Ron_Long_Beach PHP 3 09-23-04 01:45 AM
Link exchange offer – 5 sites. program-ace Traffic Exchange 0 09-05-04 06:58 AM
Run of Site link exchange with webmaster sites Philarmon Traffic Exchange 0 05-07-04 01:43 PM
Declared Functions skipper23 PHP 4 12-17-03 10:06 AM
index page not showing up skipper23 PHP 3 12-15-03 01:10 PM


All times are GMT -5. The time now is 04:31 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.