Dec 12, 2012 03:47 AM
(This post was last modified: Dec 12, 2012 03:55 AM by Dowser.)
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.
Dec 12, 2012 04:36 AM
(This post was last modified: Dec 12, 2012 04:37 AM by Gauloises88.)
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:40 AM
(This post was last modified: Dec 12, 2012 06:41 AM by Dowser.)
(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.
cats
(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.
|