The possibilities of what could have been done with a sudo password are endless, the only safe answer is back up only inert user data and wipe the rest and reinstall.
Was this done over ssh? If so you should be locking down port 22 to only certain privileged IPs via firewall, I do so in two layers, once at my router and again on the OS firewall, white-listing allowed IP addresses that I control.
Never allow ssh via PW, disable ssh as root, and allow ED25519 keys only in sshd config.
You can change the ssh port, and you can deploy fail2ban but I far prefer just denying aptempts in the first place,
Changing the port is just "security via obscurity" and is actually neither. Port 2222 is not nearly as clever as you think it is.