@GNiklasch's answer shows what is probably the first image and quantitative measurement of X-rays from the Moon;
The primary source of X-rays in this energy range are described in 1:
Figure 3 shows the sunlit crescent of the Moon, thus demonstrating that the lunar X-ray luminosity arises from backscattering of solar coronal X-rays. A real surprise was the discovery of a low-level X-ray flux from the dark side of the Moon which may be due to bremsstrahlung from solar wind electrons striking the lunar surface (3).
However, as noted by , x-ray fluorescence studies could provide an excellent way to determine the elemental composition of the lunar surface by remote sensing, since the soft x-ray optical properties of the lunar surface should be dominated by elemental abundances (rather than mineral abundances, which determine the optical properties at visible and longer wavelengths). Although reflection of the strong solar lines likely dominates the soft x-ray spectrum of the Moon, the detection of weaker emissions due to L- and M-shell fluorescence would provide a direct measure of specific elemental abundances.
And that's exactly what Chandrayaan-1 set out to do, see below. But first: following ROSAT came Chandra:
above: from 2003: The Moon: Lunar Prospecting With Chandra
Chandra's observations have also solved a decade-long mystery about X-rays detected by ROSAT that were thought to be coming from the dark portion of the Moon. It turns out that these X-rays only appear to come from the Moon. Chandra shows that the X-rays from the dark moon can be explained by radiation from Earth's geocorona (extended outer atmosphere) through which orbiting spacecraft move.
The geocoronal X-rays are caused by collisions of heavy ions of carbon, oxygen and neon in the solar wind with hydrogen atoms located tens of thousands of miles above the surface of Earth. During the collisions, the solar ions capture electrons from hydrogen atoms. The solar ions then kick out X-rays as the captured electrons drop to lower energy states.
For more X-ray images of solar system bodies, see http://chandra.harvard.edu/xray_sources/solar_system.html For example, Venus and Mars:
This Chandra image, the first X-ray image ever made of Venus, shows a half crescent due to the relative orientation of the Sun, Earth and Venus. The X-rays from Venus are produced by fluorescent radiation from oxygen and other atoms in the atmosphere between 120 and 140 kilometers above the surface of the planet. In contrast, the optical light from Venus is caused by the reflection from clouds 50 to 70 kilometers above the surface.
Solar X-rays bombard the atmosphere of Venus, knock electrons out of the inner parts of atoms, and excite the atoms to a higher energy level. The atoms almost immediately return to their lower energy state with the emission of a fluorescent X-ray. A similar process involving ultraviolet light produces the visible light from fluorescent lamps.
This and future X-ray images will enable scientists to examine regions of the Venusian atmosphere that are difficult to investigate otherwise.
This remarkable Chandra image gave scientists their first look at X-rays from Mars. In the sparse upper atmosphere of Mars, about 120 (75 miles) kilometers above its surface, the observed X-rays are produced by fluorescent radiation from oxygen atoms.
X-radiation from the Sun impacts oxygen atoms, knock electrons out of the inner parts of their electron clouds, and excite the atoms to a higher energy level in the process. The atoms almost immediately return to their lower energy state and may emit a fluorescent X-ray in this process with an energy characteristic of the atom involved - oxygen in this case. A similar process involving ultraviolet light produces the visible light from fluorescent lamps.
The X-ray power detected from the Martian atmosphere is very small, amounting to only 4 megawatts, comparable to the X-ray power of about ten thousand medical X-ray machines. Chandra was scheduled to observe Mars when it was only 70 million kilometers from Earth, and also near the point in its orbit when it is closest to the Sun.
At the time of the Chandra observation, a huge dust storm developed on Mars that covered about one hemisphere, later to cover the entire planet. This hemisphere rotated out of view over the course of the 9-hour observation but no change was observed in the X-ray intensity, implying that the dust storm did not affect the upper atmosphere.
The astronomers also found evidence for a faint halo of X-rays that extends out to 7,000 kilometers above the surface of Mars. Scientists believe the X-rays are produced by collisions of ions racing away from the Sun (the solar wind) with oxygen and hydrogen atoms in the tenuous exosphere of Mars.
OK now to Chandrayaan-1's C1XS X-ray spectroscopy from lunar orbit:
From IRSO's Chandrayaan - 1 : Results
From Science Daily's Chandrayaan-1 X-ray Spectrometer Success To Provide New Understanding Of Lunar Surface
The miniature C1XS instrument investigated the lunar surface using an effect whereby X-ray illumination from the Sun causes rocks to fluoresce, emitting light at a different wavelength. This re-emitted light contains spectral peaks that are characteristic of elements contained in the rock, revealing its composition. Solar flares act like a flash bulb, giving added illumination and allowing C1XS to ‘see’ more elements.
During normal conditions, C1XS could detect magnesium, aluminium and silicon and collected data on the levels of these elements enabling detailed mapping of areas of the lunar surface during its operational period. During the 30 solar flares, C1XS detected calcium and iron (and sometimes titanium, sodium and potassium) in key areas in the southern hemisphere and on the far side of the Moon. The spectral resolution of 50 km was much better than previous missions.
“The C1XS team will be analysing the data collected during the Chandrayaan-1 mission over the next few months and the results will help us further our knowledge of the Moon and planetary formation. In addition, the design of the instrument has been proved very successful in that it withstood passage through the Earth’s radiation belts and went on to produce these wonderful high-resolution spectra. We were able to separate clear peaks for each of the target elements, allowing us not only to identify where they are present but give an accurate estimate for how much is there. The technology developed for C1XS opens up some exciting opportunities for future missions,” said Professor Grande.
From ISRO HQ: C1XS Catches First Glimpse of X-rays from the Moon
The Imaging X-ray Spectrometer, one of the 11 payloads onboard Chandrayaan-1 spacecraft, jointly developed by the Indian Space Research Organisation (ISRO) and UKs Rutherford Appleton Laboratory, has successfully detected the first X-ray signature from the Moon. This is the first step in its mission to reveal the origin and evolution of the Moon by mapping its surface composition. It may be recalled that Chandrayaan-1 spacecraft was launched from Satish Dhawan Space Centre, Sriharikota on October 22, 2008 and entered the lunar orbit on November 8, 2008.In orbit around the Moon, Chandrayaan-1 Imaging X ray Spectrometer (C1XS) detected the X-ray signal from a region near the Apollo landing sites on December 12, 2008 at 02:36 UT.
The solar flare that caused the X-ray fluorescence was exceedingly weak, approximately 20 times smaller than the minimum C1XS was designed to detect. .The X-ray camera collected 3 minutes of data from the Moon just as the flare started and the camera finished its observation. C1XS depends on radiation from the Sun to activate the detection of X rays. Though, the minimum in solar activity was expected to end in early 2008, however solar activity is yet to reach the anticipated increase. With the highly sensitive C1XS instrument, it has been possible to detect the X rays..The camera - C1XS (pronounced kicks) was designed and built at Space Science and Technology Department at the Rutherford Appleton Laboratory in collaboration with Indian Space Research Organisation (ISRO). It is an X-Ray Spectrometer that uses X-rays to map the surface composition of the Moon and will help scientists to understand its origin and evolution, as well as quantifying the mineral resources that exist there.
A thorough review of the topic can be found in the book (Bhardwaj et al.) in ArXiv X-rays from Solar System Object
Here is an energy-resolved X-ray spectrum from the Moon from Chandra:
And some comets:
And even moons of other planets!