views:

118

answers:

5

Please tell me is it possile to know when a program is trying to download a file ( like in Internet Download Manager ). I want to catch that event (hook it), get the download url, and then destroy the event.
Thanks in advance..

@Jerry Coffin:Sr, I forgot to tell you that this feature of IDM is not active by default. It is only turned on when you enable the "Use advance browser integration" option at "Download/Options" of IDM menu. Like here :
http://files.myopera.com/UenX/files/Detect.jpg
+ Check the (1) options, OK, then reboot.
+ After reboot, the (2) option will appear, check it, OK, and now run your software. You should see some thing likes (3) ( this appear when I run the msgr9us.exe ( Yahoo! Messenger setup file) ) Give it a try..

A: 

For a specific program such as Internet Explorer, doing this is quite reasonable (IE includes hooks to invoke your code under the right circumstances). For most programs it's not possible though -- they simply don't generate any "event" for you to hook and "destroy".

To make a long story short, to get anywhere with this, you'll almost certainly need to handle the situation on a case-by-base basis, writing code specific to each application you want to deal with -- and know that any other application and even newer versions of the applications you've dealt with will probably break what you're trying to do.

Jerry Coffin
@Jerry Coffin: Thanks. But Internet Download Manager (IDM) can do exactly what I say, when any program is trying to download a file from Internet , IDM will show an Dialog, and ask me if I want to download it using IDM ..
@user359278: assuming you mean this IDM, (http://www.internetdownloadmanager.com/) you're wrong. A quick check shows that it does *not* show a dialog when I use some software I've written.
Jerry Coffin
@ Thanks, please see the update of my question..
A: 

even i am trying to get the download information from IDM ie, i am developing an C# application which should show the download file name which user has downloaded from the internet and i want to know how the IDM will come to know as soon as i click download url and i see IDM popping up so i dont no what event is been raised Please can any one let me know abt it thank you so much in advance............

test
A: 

you could hook the network stream and filter for http download requests.


you'll need some library to capture network traffic (e.g. http://en.wikipedia.org/wiki/Pcap). Then you'll have to parse the network packets for the appropriate HTTP messages (sorry, I can't give them to you, I don't know them). I don't know if you can actually prevent packets from being sent though.


Another (easier) way would be to implement a proxy server (or modify an existing one) to do what you want. Then you just have to connect the IE to your proxy using the proxy server settings. Check for example Privoxy, which already does some kind of filtering.

Tobias Langner
Thanks, but could you give me more details..
Thank you......
A: 

thank you very much for your valuable answer can i know any ways to hook in to the network stream ...

test
A: 

Not really. Consider how a browser typically downloads a file: it opens a TCP socket connection to a remote server, either on port 23 or 80, and using the FTP protocol or HTTP protocol on that connection. These things you can detect, intercept and modify with high reliability. But there are other programs that use other mthods. for instance, P2P filesharing programs such as BitTorrent do not use HTTP or FTP, nor do they download a file from a single server.

So, while you don't need to understand every program, you must be able to detect and understand every file download protocol instead.

MSalters
Thanks, if I just want to detect the HTTP and FTP , then which method do I have to use..