There are lots of reasons.
Something like ransomware is not too difficult to understand. You have files you don’t want to loose on your computer right? So if i keep you from accessing them and told you to pay you’d probably be inclined to pay.
The other bit reason is botnets. Someone wants more computing power than they could possibly access on their own. So they get into thousands of peoples computers and use them to get access to this power they cant use on their own.
Latest Answers