huge scanning script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
57an
Forum Newbie
Posts: 4
Joined: Sat Jul 08, 2006 4:03 am

huge scanning script

Post by 57an »

hi,

I have a script that scans thousands of ips and puts the results in a database. I have tested it to scan up to 250 ips and it works well, but very slow. According to my calculations my script needs 2 - 3 days to finish scanning all ips I want it to scan. I can't keep my brouser open the whole time, so I decided to use "cron jobs". I'm using the comand "php -q /path_to_script/script.php", but 12 hours after the time it was assigned the database is still empty. Is it posiible, the reason for this to be in the cron job program on the server or in the php program?

I think this is an interesting question. :roll:
User avatar
hydroxide
Forum Commoner
Posts: 77
Joined: Mon Jun 05, 2006 9:53 am

Post by hydroxide »

It shouldn't take that long... post your code? Maybe some optimization would be helpful.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

I'm not sure what your doing is ethical.
User avatar
hydroxide
Forum Commoner
Posts: 77
Joined: Mon Jun 05, 2006 9:53 am

Post by hydroxide »

astions wrote:I'm not sure what your doing is ethical.
He...uh... could be working for the Ecuadorian government doing pen tests for its citizens... yeah... that's it...
57an
Forum Newbie
Posts: 4
Joined: Sat Jul 08, 2006 4:03 am

not sure what I'm doing

Post by 57an »

astions wrote:I'm not sure what your doing is ethical.
Well I'm not sure either. Personaly I would code this in C++ and run it from a payed shell account, but this is a task assigned to me by someone else. He wants it to be coded in php, so it can run on his server. He gave me a script that was scanning a couple of ips, and I have to 1)make it scan whole ranges and 2)set everything up on his server. I dont want to waste your time on improving my code. I think I did this already. I want to know only if it is possible the "cron job" or the "php" to have some kind of time limit. For example the kernel decides that php -q is not respondin because it is runnin for whole hour and stops it before it has added anything in the database.
Post Reply