Australia are facing defeat in the second Test against South Africa with careers on the line after their shambolic performance on day four.