That's one of the main jobs that Onmyōji perform, as well as dealing with restless spirits by performing exorcisms.
But some if it is kind of like magic, like the shikigami that Subaru uses. There are also a lot of barriers to protect people in addition to ones that can temporarily incapacitate others. Those are we've got to work on.