I implement this in my current project.
As you can see the yellow boxes are the skeleton of the wall, where all collisions are checked. The crab's movement up and down the wall is controlled with sine movement. Every tick I check if a certain point on the crab (between the legs, just below the body) is touching the wall, if not move the crab left until it's touching. On the other hand, if it's overlapping the wall too far, push the crab out to the right.
Then, once the crab is along the surface, check the angle of the yellow box the crab is touching, and set the crab's angle to be the same.