Hello producer_man,
Yes, a factory reset would remove any persistence a hacker may have on your computer. However, you will lose all data. Brining any data over could risk reintroducing the hacker's persistence method. Before factory resetting your MacBook Pro, I'd suggest the following
It's a little more advance, but Activity Monitor can be used to track unknown and unwanted applications - Activity Monitor User Guide for Mac - Apple Support. It is advised to go through this. The Network tab is usually the most interesting. Kill any process you do not recognize.
Go through the sections of Privacy & Security within the Settings app and revoke access to apps that shouldn't have certain permissions. I would be careful with:
- Files and Folders
- Microphone
- Screen Recording
- Camera
- Full Disk Access
- Location
For your scenario, I would revoke all app access to ALL of these fields.
I would suggest looking at Privacy & Security within the Settings app and going through Safety Check. Revoke access to people and apps that are utilizing privileges you believe they shouldn't have. Changing your Apple ID password and device passcodes might also be smart.
To prevent future incidents:
- Do not interact with unknown senders.
- Do not click on unknown links or attachments.
- Do not travel to sketchy and unknown websites.