Welcome and your pup is gorgeous! Thank you for adopting him
He's still a pup and although his living conditions not ideal by any means you can turn this pup around with strong leadership. I bet he's going to be a fabulous companion. German Shepherds are very smart, as you see. A blast to train. They bond very deeply with their owners.
Others will come by with some training advice. Good luck!