To avoid or limit attacks on the internet, I advise you to first install an antivirus and a firewall that will filter incoming and outgoing connections. I also invite you not to open mails or sent files which appear fraudulent or to constrain you to browse only on secure sites. Click here for advice on secure browsing:
https://www.ssi.gouv.fr/entreprise/precautions-elementaires/bonnes-pratiques-de-navigation-sur-linternet/.