You're looking for the function
EffectModifyAttacks().
The link Cursed provides has some helpful info on how to remove those attacks if they were applied permanently. If you want to apply them temporarily (as with a modified haste spell), you don't need to worry about that.