If you get a rat infestation in the attic of your home, it is a good bet that you are dealing with black rats because they are excellent climbers and tend to make their home in locations high above the ground.
The best way to get rid of the rats is to set a number of rat traps in the attic, and then give them time to do their work.
I do not recommend using rat poison to get rid of rats in the attic because you want to be able to collect the rats when they die so that you can dispose of them properly.
Otherwise, after the rats eat the poison they will retreat to their hiding places in order to die, and this can lead to an awful stench as their bodies decompose.
The most convenient type of trap to use is a rat zapper, which is the modern incarnation of the rat trap that uses an electric jolt to kill the rats rather than the conventional spring trap.
The rad zapper has the advantage of being easy to set and clean after a kill, and they can be reused over and over again until all the rats have been killed.
As you probably have already determined from the sounds coming from your attic, rats are nocturnal animals so they will be most active during the night.
You will need to check your traps daily for any kills, but this method should get your rat infestation under control fairly quickly.