I've been having the same problem for about two weeks. Here's what worked for me:
I stumbled upon this article http://applehelpwriter.com/2017/07/23/terminal-tricks-for-defeating-adware/ and while it was informative, I'm not super tech-savvy so I didn't understand half of it. However, at the very end, he offers a program called DetectX Swift Beta (https://sqwarq.com/detectx/detectx-swift-beta/). Sure enough, after downloading and running the program, there were multiple files in various locations under the Macintosh HD/Library system files. After I got those deleted/quarantined, I rebooted and all was well.
I also suggest checking under Macintosh HD/Users/Shared folder -- I found that each restart spawned 3 new install files from the malaware.
Hope this helps you!