Two teenage boys, both aged 17, were arrested for the attempted murder of two men, Germiston police said on Tuesday.

Captain Steady Nawa said one of the teenagers was also linked to a rape from last September and a murder that took place in January this year.

He said police arrested the youths on Monday morning while they were sleeping with their girlfriends in a shack at the Ramaphosa informal settlement near Germiston.

"This follows a shooting incident that took place at Dukathole informal settlement on Sunday at 4pm where two people were shot, one in the stomach and the other in his private parts, allegedly by the same suspects," said Nawa.

The teenagers were apparently quarrelling with one of the victims in the street, when another man approached to see what was going on. Both of them were then attacked.

Nawa said investigations led police to the shack on Monday.

A Norinco firearm with an empty magazine was found hidden in the roof of the shack.

One of the teenagers also allegedly raped a 16-year-old girl at knife-point last September.

He also allegedly killed a 25-year-old man by stabbing him in the neck in January.

The motive for the murder was apparently revenge after the deceased's brother apparently assaulted the teenager. Both the teenagers arrested will appear in the Germiston Magistrate's Court on Wednesday, one facing charges of murder, rape and attempted murder.

The other will face a charge of attempted murder.