# How to interrupt network while client downloading content?



## FlorinMarian (Aug 26, 2019)

Hi guys!
I run a FreeBSD VPS where it's located a webserver with WHMCS inside. (Apache + Nginx)
I would like to do other kind of ad by running a prank on social media where people will get message like "X has been hacked. Click here to download database" or something similar.
What I need?
A method to randomly stop their download while they try to get a dump file called "database.sql".
So I would like them to try that download in many ways but never get full finished.
Thank you for being part of this prank.


----------



## shkhln (Aug 26, 2019)

Besides the whole premise being stupid, firewall doesn't know and doesn't care what applications are doing with packet contents. Whether someone is downloading something, writing an email or watching porn cat videos on Youtube, it all looks the same to ipfw/pf/ipf. If you insist on doing something like that, you'll have to patch the web application in question accordingly.


----------



## PMc (Aug 26, 2019)

A proxy loop to localhost. And a stateful firewall with rate limiter on the lo0<->lo0 traffic.


----------



## olli@ (Aug 27, 2019)

Another approach ... You could write a little program or script that watches network traffic (for example, in Python and other languages you can use pcap / libpcap, in a shell script you can call tcpdump(1) and parse its output). At the appropriate point, drop the TCP connection of the download. You can do that by calling tcpdrop(8), or by using the sysctl `net.inet.tcp.drop`.

Whatever approach you choose, you'll have to do a bit of coding. There is no ready-made solution for nonsense like that.


----------

