Surface Green's functions and boundary modes using impurities: Weyl semimetals and topological insulators