Nanite

Nanite is a name sometimes given to nanorobots, a type of fictional microscopic technology which can perform complex tasks. In science fiction, the name is also applied to two different sapient microscopic races which evolved from this type of device. These Nanites are microscopic artificial lifeforms and a highly sophisticated form of nanotechnology. The Nanoforms, tiny robots from The Sarah Jane Adventures, are also described as being a species of nanites.

Star Trek
In Star Trek: The Next Generation, the Nanites are used by the United Federation of Planets for medical purposes. Created by atomic manipulation and containing several gigabytes of computer memory in their microscopic hardware, Nanites are small enough to enter the nuclei of living cells without causing harm. They are stored in non-functional state when not in use and can be destroyed by gamma radiation if necessary. A Nanite's body consists of the following parts: a forward propulsion block, an Oneamisu receiver, a Ranma ½ gyro block, a hex growth stack, Otomo calibration, two reverse flow paddles, one cell membrane sensor and manipulator each, a telemetry antenna, a forward motion sensor, a crystal articulator, logic circuits arranged from A-F and G-L, a T-cell anti-receptor and an emergency dissolve system. Until 2366, Nanites were considered non-intelligent. However in that year a scientific experiment on the Nanites of the starship USS Enterprise-D tried to enhance their capabilities by stimulating cooperative behavior among them. This eventually resulted in the Nanites developing a collective intelligence and escaping to the ship's systems, damaging them as the Nanites increased their numbers. Eventually, the Android Data was able to reach an agreement with the Nanites: they fixed the damage and left the ship's systems and in return the Enterprise transported them to the uninhabited planet Kavis Alpha IV, where the Nanites could build their own civilization.

Stargate
Ironically, the Nanites seen in Stargate Atlantis more closely resemble another type of nanotechnology from Star Trek, the Borg nanoprobes, used for assimilating other species into Borg drones.

Stargate Nanites are sapient and fully parasitic. They view biological bodies as mere machines and try to take control of them. These Nanites were created by an ancient species simply called the Ancients as a plague against their enemies, the Wraith. As such, Nanites instinctively head for Wraith tissue whenever it's available. That's how a team of researchers tried to cure Dr. Weir of a Nanite infection by injecting a sample of Wraith tissue in her body, causing all Nanites to clump in one place and making it much easier to kill them than when they were spread through her body. This worked, but it turned out a few Nanites had survived and these multiplied again, trying to take control of Weir's conscience until she was able to fight them back.