You are kind of right and kind of wrong. Defense lawyers defend clients whether they know they are guilty or not. They will never ask a client if they did the crime. What they do is defend from evidence. It is the prosecuter's job to prove beyond a reasonable doubt that the specific crime was committed by the defendant. What a defense lawyer cannot do is lie in court about something they know a client did do (ie. @Galt said I stabbed that dude and kicked his dog).