Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

PHP 

Php WebDAV Scanner

What do you think about my new project ?

http://code.google.com/p/php-webdav-scanner/

WARNING! - I am not responsible for any use made with this script.
for educational purposes only!

Do you have any tips for improve it?
I tested it by scanning my own VPS and it worked for me.
Okay, had a quick look.
Some things to improve:
Follow a proper naming scheme. eg.: IPtoLIST -> ip_list / ip_to_list
Use " right.
PHP Code

<?php 
//bad
$this->log("\nStart scanning at ".date("F j, Y, g:i a")." - from ".$IP1." to ".$IP2."\n\nWebdavs Found:\n",$logfile);

//better
$this->log('\nStart scanning at '.date('F j, Y, g:i a').' - from '.$IP1.' to '.$IP2.'\n\nWebdavs Found:\n',$logfile); 

Fix the spacing:
PHP Code

<?php 
if($logfile !== "")
                {
        
$end = time();
        
$diff = $end - $start;
        
$time = date("H:i:s", $diff);
        
$this->log("\n\nEnd of scanning at ".date("F j, Y, g:i a")." - ".$workingc." webdavs found - It took ".$time,$logfile);
                } 

Simplify / shorten, if possbile:
PHP Code

<?php 
if(file_exists($logfile))
                {
        
$fh = fopen($logfile, 'a');
        
fwrite($fh, $data."\n");
        
fclose($fh);
                }else{
        
$fh = fopen($logfile, 'w') or die("Can't open ".$logfile." to write logs");
        
fwrite($fh, $data."\n");
        
fclose($fh);
                }

//Better
$fh = fopen($logfile, file_exists($logfile) ? 'a' : 'w') or die("Can't open ".$logfile." to write logs");;
fwrite($fh, $data."\n");
fclose($fh); 
(Dec 12, 2012 04:36 AM)Gauloises88 Wrote:  Okay, had a quick look.
Some things to improve:
Follow a proper naming scheme. eg.: IPtoLIST -> ip_list / ip_to_list
Use " right.
PHP Code

<?php 
//bad
$this->log("\nStart scanning at ".date("F j, Y, g:i a")." - from ".$IP1." to ".$IP2."\n\nWebdavs Found:\n",$logfile);

//better
$this->log('\nStart scanning at '.date('F j, Y, g:i a').' - from '.$IP1.' to '.$IP2.'\n\nWebdavs Found:\n',$logfile); 

Fix the spacing:
PHP Code

<?php 
if($logfile !== "")
                {
        
$end = time();
        
$diff = $end - $start;
        
$time = date("H:i:s", $diff);
        
$this->log("\n\nEnd of scanning at ".date("F j, Y, g:i a")." - ".$workingc." webdavs found - It took ".$time,$logfile);
                } 

Simplify / shorten, if possbile:
PHP Code

<?php 
if(file_exists($logfile))
                {
        
$fh = fopen($logfile, 'a');
        
fwrite($fh, $data."\n");
        
fclose($fh);
                }else{
        
$fh = fopen($logfile, 'w') or die("Can't open ".$logfile." to write logs");
        
fwrite($fh, $data."\n");
        
fclose($fh);
                }

//Better
$fh = fopen($logfile, file_exists($logfile) ? 'a' : 'w') or die("Can't open ".$logfile." to write logs");;
fwrite($fh, $data."\n");
fclose($fh); 

Thanks, just fixed that, even that they were not bugs or something.. just some small things but thanks anyway.

If you see something else please write a comment 🙂
If you claim that you're an expert in PHP. Please do comply with coding standards such as proper indentations. Just by looking at it, it's already a shitstorm no offense

.Mal
(Dec 12, 2012 06:19 AM)Malfoice Wrote:  If you claim that you're an expert in PHP. Please do comply with coding standards such as proper indentations. Just by looking at it, it's already a shitstorm no offense

.Mal

Dude I coded that shit for a friend in like 2 minutes.. don't judge my skills by this code.
(Dec 12, 2012 06:20 AM)Dowser Wrote:  Dude I coded that shit for a friend in like 2 minutes.. don't judge my skills by this code.

2 minutes with 139 lines, over exaggerating much? By the way I can already judge you through the work you've provided. Simply explains it, it's messy.
(Dec 12, 2012 06:27 AM)Malfoice Wrote:  2 minutes with 139 lines, over exaggerating much? By the way I can already judge you through the work you've provided. Simply explains it, it's messy.

Ok dude, whatever, I don't give a fuck what people think about my work, You like it? Take it.. dont like? dont comment.. Thanks.
(Dec 12, 2012 06:40 AM)Dowser Wrote:  Ok dude, whatever, I don't give a fuck what people think about my work, You like it? Take it.. dont like? dont comment.. Thanks.

Give a fuck? You should. It's professionalism. If you can indent properly also showing that attitude, why should others give the rightful amount of respect for you as a developer?

.Mal
(Dec 12, 2012 06:44 AM)Malfoice Wrote:  Give a fuck? You should. It's professionalism. If you can indent properly also showing that attitude, why should others give the rightful amount of respect for you as a developer?

.Mal

Again I don't care, and you should stop posting here, PM me if this is something personal.
(Dec 12, 2012 06:46 AM)Dowser Wrote:  Again I don't care, and you should stop posting here, PM me if this is something personal.

Arrogance will never be defeated due to pride. I have no grudges against you personally, I'm only giving my word as a developer also.

.Mal
(Dec 12, 2012 06:49 AM)Malfoice Wrote:  Arrogance will never be defeated due to pride. I have no grudges against you personally, I'm only giving my word as a developer also.

.Mal

And you're absolutly right.

Spoiler (Click to View)
The Alliance
(Dec 12, 2012 06:49 AM)Malfoice Wrote:  Arrogance will never be defeated due to pride. I have no grudges against you personally, I'm only giving my word as a developer also.

.Mal

Okay, you want to have the last word, I realized, so go ahead and respond after me another "ingenious" comment.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[PHP] by sm0key7Sep 13, 2014 01:12 PM 1 358 Sep 13, 2014 01:12 PM
Last Post: •-C¤Ň†®Â©Ť-K¿ĹĹ®-•
[PHP] by NastyCookieJan 13, 2014 02:00 AM 2 274 Jan 13, 2014 02:00 AM
Last Post: badbrains
[PHP] by radde94Feb 26, 2013 11:53 PM 27 1,421 Feb 26, 2013 11:53 PM
Last Post: radde94