The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 21, 2019, 12:22:28 PM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: Connection Timeout on purpose  (Read 4619 times)
bhcentral
Rookie
**
Offline Offline

Posts: 14



View Profile
« on: December 20, 2007, 10:58:41 AM »

There are certain scrapers and such that like to pillage my pages.

Rather then give them a page not found or something like that which doesn't seem to slow them down much, I would like to make the connection drag on and on and on and then eventually time out.

Anyone have any idea how you would do this programatically in .net?  Thread.sleep maybe?

Logged

No links in signatures please
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #1 on: December 20, 2007, 02:41:27 PM »

Very curious why you'd do that, but the simplest way would be to watch the inbound IP ($SERVER['REMOTE_HOST'] I think) and if it matches what you want to delay, simply say "sleep(30)" which will cause <this connection> to go to sleep for 30 seconds. That will put no workload on your server, yet delay things quite a bit. CAVEAT: if you are getting slammed by the spiders and many come all at once, and you have a limit to how many Apache instances can be running, then you just built a framework for a self-induced DDOS attack.

So wrapping up, I s'pose I wanna ask again - WTF do you want to do that?
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
emonk
Rookie
**
Offline Offline

Posts: 44


View Profile
« Reply #2 on: December 21, 2007, 07:21:25 AM »

 I second what perk said, with the added caveat that most unix-likes  (Linux) have a maximum open file descriptor limitation, that you can hit surprisingly fast. If they're scraping enough to be a real problem than by holding the port open you might even kill your whole box. It used to happen to me all the time when I hit Digg, or a major news site with my antics.
Logged
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« Reply #3 on: December 21, 2007, 08:08:42 AM »

another option is send them slot of irrelevant shit seeded with your links as many ways as you can, trying to get past their cleaner routines. Or to echo the comments, just response.end and move on.
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
bhcentral
Rookie
**
Offline Offline

Posts: 14



View Profile
« Reply #4 on: December 21, 2007, 08:57:39 AM »

Not using Apache...Using IIS.  thread.sleep works...but I'm not a big fan of that many threads sleeping.

Side note...once your connection times out a crawler it stops...almost immediately.  VERY effective.

As for the reason     

« Last Edit: December 21, 2007, 08:59:16 AM by bhcentral » Logged

No links in signatures please
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!