Here's what happened:
* Bathilda's death: Bathilda Bagshot, the well-known historian and author, was likely murdered by Voldemort, who used her body to house Nagini.
* Nagini's disguise: Nagini, disguised as Bathilda, lured Harry to her home.
* The attack: Nagini, still disguised as Bathilda, tried to attack Harry and take his blood.
* Harry's escape: Harry realized the truth and escaped with the help of a locket Horcrux, which contained a piece of Voldemort's soul.
The attack wasn't Bathilda's doing, but a result of Voldemort's cunning plan to weaken Harry by getting his blood and to use Nagini's snake venom to strengthen his own body.