Can't this be achieved with the offset m_flNextAttack or something of the sort?
EDIT:
Also, you can force the knife to successfully attack with Ham_Weapon_PrimaryAttack.
I think you could make a plugin that controls the knife by disabling the default attacks and execute your own.