1. Shut down the computer.
2. Plug in the power adapter to a power source, connecting it to the Mac if its not already connected.
3. On the built-in keyboard, press the (left side) Shift-Control-Option keys and the power button at the same time, if it starts up you held the power button before the other keys, try again.
4. Release all the keys and the power button at the same time.
5. Press the power button to turn on the computer.
6. Press and hold the Command-Option-P-R keys before the gray screen appears.
7. Hold the keys down until the computer restarts again at least twice.
8. Release the keys and immediately
hold down the ‘Command’ + R’ keys on the keyboard during the start up process. If you can't get to that menu just hold the power button for 10 seconds until it shuts down. Then start it up again holding those keys. When you see the Apple Logo you can let go.
When the machine boots you may have to choose your language then you will see the OS X Utilities screen. Select the Disk Utility and then Continue. Then in Disk Utility select Macintosh HD in the left column (if there are two with that name or it is named something else choose the first indented item) and then on the right select the First Aid tab then select Run.
If that is ok restart
Go here and download Malwarebytes Anti-Malware for Mac, open it and select Scan:
It will scan for malware and then give you the option to remove it. Then restart and run it again until you get no malware detected.