steps for taking a foreclosure vs preforeclosure

Can someone list the basic steps in taking over a pre foreclosure and the basic steps of taking over a foreclosure after auction ? (im planning on flipping the property if it makes any difference) Thank you