To protect yourself from Petya virus:
Create a file perfc.dll
At the time of attack, Petya looks for file C:\Windows\perfc.dll. If such a file on the computer already exists, then virus finishes work without infection.
To create such a file to protect against Petya, you can use the usual "Notepad". Experts also advise making the file read-only so that the virus can not make any changes to it.
Install security patches
The virus also spreads through the vulnerabilities of Windows CVE-2017-0199 and CVE-2017-0144. It is recommended to install security patches that close them:
We need to install security patches not only for Windows, but also for Microsoft Office.
It is also necessary to install patches that cover the previously exploited vulnerability for WannaCry:
Update antivirus signatures
Antivirus software signatures database should be updated from June 27, 2017 not earlier than 20:00.
The virus uses the following addresses, you should block access to them:
Important! The dots are set for security reason. Do not click on the links. These addresses are published to block them manually.
Disable TCP ports
If the network already has infected workstations or servers, you must disable TCP ports 1024-1035, 139 and 445.
Disable SMB protocol
If you can not install security updates, disable the SMB v1 / v2 / v3 protocol on workstations and servers.
Read more: https://support.microsoft.com/en-us/help/2696547/how-to-enable-and-disable-smbv1-smbv2-and-smbv3-in-windows-and-windows
Configure attack blocking
In the case of NGFW / NGTP / IPS security features, configure blocking of attacks exploiting EternalBlue (MS17-010).