Ven. Bhikku Bodhi writes about this type of meditation in his book "The Noble Eightfold Path", p. 77-78:
The next two sections on mindfulness of the body present analytical contemplations intended to expose the body’s real nature. One of these is the meditation on the body’s unattrac- tiveness, already touched on in connection with right effort; the other, the analysis of the body into the four primary elements.
The first, the meditation on unattractiveness, is designed to counter infatuation with the body, especially in its form of sex- ual desire. The Buddha teaches that the sexual drive is a mani- festation of craving, thus a cause of dukkha that has to be reduced and extricated as a precondition for bringing dukkha to an end. The meditation aims at weakening sexual desire by depriving the sexual urge of its cognitive underpinning, the perception of the body as sensually alluring. Sensual desire rises and falls together with this perception. It springs up because we view the body as attractive; it declines when this perception of beauty is removed.
The perception of bodily attractiveness in turn lasts only so long as the body is looked at superficially, grasped in terms of selected impressions. To counter that perception we have to refuse to stop with these impressions but proceed to inspect the body at a deeper level, with a probing scrutiny grounded in dispassion. Precisely this is what is undertaken in the meditation on unattractiveness, which turns back the tide of sensuality by pull- ing away its perceptual prop.
The meditation takes one’s own body as object, since for a neophyte to start off with the body of another, especially a member of the opposite sex, might fail to accomplish the desired result. Using visualization as an aid, one mentally dissects the body into its components and investi- gates them one by one, bringing their repulsive nature to light. The texts mention thirty-two parts: head-hairs, body-hairs, nails, teeth, skin, flesh, sinews, bones, marrow, kidneys, heart, liver, diaphragm, spleen, lungs, large intestines, small intestines, stomach contents, excrement, brain, bile, phlegm, pus, blood, sweat, fat, tears, grease, snot, spittle, sinovial fluid, and urine.
The repulsiveness of the parts implies the same for the whole: the body seen closeup is truly unattractive, its beautiful appear- ance a mirage. But the aim of this meditation must not be mis- apprehended. The aim is not to produce aversion and disgust but detachment, to extinguish the fire of lust by removing its fuel.
There is also a reference to The Visuddhimagga, chapter 8: "Mindfulness occupied with body", verses 42-144, p. 236-258. Here it gives in-depth instructions on how to perform the technique and it takes all body parts and describes each in detail.
Lastly, Pa Auk Sayadaw gives a description of this type of meditation in his book "Knowing and Seeing", p. 44-46:
The Thirty-Two Parts of the Body
If you want to develop meditation on the thirty-two parts of the body, you should first re-establish the fourth ànàpàna-jhàna. When the light of concentration is bright, brilliant, and radiant, you should use it to try to discern the thirty-two parts of the body, one at a time.
The thirty-two parts of the body are twenty parts with predominantly the earth-element, and twelve parts with predominantly the water-element. The twenty earth-element parts should be discerned in four sets of five:
1-5. Head hairs, body hairs, nails, teeth, skin. 6-10. Flesh, sinews, bones, bone marrow, kidneys.
11-15. Heart, liver, membrane, spleen, lungs.
16-20. Intestines, mesentery, undigested food, faeces, brain.
The twelve water-element parts should be discerned in two sets of six:
1-6. Bile, phlegm, pus, blood, sweat, fat.
7-12. Tears, grease, saliva, snot, synovial fluid, urine.
Discern the parts in the given order, but one at a time. Try to see each of the parts, as distinctly as you would
see your face in a clean mirror.
If, while doing this, the light of concentration
should fade, and the part of the body being discerned become unclear, you should re-establish the fourth ànàpàna-jhàna. When the light is again bright and strong, you should return to discerning the parts of the body. Do this whenever the light of concentration fades.
Practise so that you are, from head hairs down to urine, or from urine back to head hairs, able to see each one clearly and with penetrating knowledge; keep practising until you become skilful.
Then, again using the light of concentration and with your eyes still closed, you should try to discern another being close by. It is especially good to discern someone in front of you. Discern the thirty-two parts of the body in that person, or being, from head hairs down to urine, and from urine back to head hairs. Discern the thirty-two parts forwards and backwards many times.
When you have succeeded, discern the thirty-two parts once internally, that is in your own body, and once ex- ternally, that is in the other person’s body; do this many times, again and again.
When you are able to discern internally and externally like this, the power of meditation will in- crease. You should thus gradually extend your field of discernment bit by bit, from near to far. Do not worry that you cannot discern beings far away. Using the brilliant light of the fourth jhàna, you can easily see beings far away; not with the naked eye, but with the eye of wisdom (¤àõacakkhu). You should be able to extend your field of discernment in all ten directions: above, below, east, west, north, south, north east, south east, north west, south west. Take whomever you dis- cern, be they human, animal or other beings, in those ten directions, and discern the thirty-two parts, once internally and once externally, one person or other being at a time.
When you no longer see men, women, or buf- faloes, cows, and other animals, as such, but see only groups of thirty-two parts, whenever and wherever you look, internally or externally, then can you be said to be successful, skilful, and expert in discerning the thirty-two parts of the body.