You haven't mentioned the age or breed, which I suppose doesn't make that much difference. I'm
am an inexperienced trainer, don't have the background that Jeff and others have (maybe I shouldn't be writing anything [-X ) and don't offer this as anything other than my limited experience.
I've really only worked with one dog like yours - my current one, Nettie. Got her as 1-1/2-yr-old GSD from rescue with no known history and obviously little obedience. Iniitally, she was what I considered to be very fearful and acted aggressively toward most people and dogs. After I had her a few days, was at the vet's where she was fine for about 15 min. and then suddenly charged and barked at the doctor - scared the s#!t out of me
and him.

He suggested we reconsider keeping her.
It's now 8 mos later and she's 95% or more improved. She still doesn't like the next door neighbor mowing the lawn, barks at meter readers and door-to-door salesmen [that's o.k.!] and will get agitated with some people that come to close when she's in the car. Her obedience is progressing nicely and she has done very well socializing with people and other dogs, even surprising me on her 3 trips to the new local dog park (where I said I would NEVER go . . . but this one is different - yeah, right!)
From day one, I took the role as her undisputed leader. I expose her as much as possible to other people and to be around other dogs, but not with the goal of being "friends" with all of them. I just keep working her with the idea that she WILL say calm around people and dogs and this seems to result in a reciprocal response from most other dogs, at least initially. I've been consistent with appropriate levels of corrections when necessary and use a prong collar a lot when I think it'll help. And, yes, sufficient daily exercise is
absolutely critical.
I have no great inclination to "save" a rescue or shelter dog. I wouldn't hesitate to get rid of a dog that I felt was unstable, unpredicable or dangerous. After working with her, I don't think Nettie is. Trust her around my toddler grandkids? Nope, not for a moment. Someday? Maybe. I think it is and will always be an on-going process. It's something each dog owner needs to evaluate based on a reasonable assessment of the dog they have (maybe by someone else) and the knowledge, skills, attitude and committment they can bring to the training process.
JMO :|