def go(mode): client = login_from_env() blocker = ExaBgpBlocker() m = BlockManager(client, blocker) if mode == "backfill": m.block_all_expected() else: m.run()
def render_config(): c = login_from_env() t = Template(filename=os.getenv("BHR_TEMPLATE")) context = { "blocked": list(c.get_list()), 'ip': socket.gethostbyaddr(socket.gethostname())[2][0] } return t.render(**context)
def render_config(): c = login_from_env() t = Template(filename=os.getenv("BHR_TEMPLATE")) path_to_bhr_client_exabgp_loop = find_executable("bhr-client-exabgp-loop") if not path_to_bhr_client_exabgp_loop: raise RuntimeError("Can not find bhr-client-exabgp-loop in $PATH") ipv4, ipv6 = get_ips() context = { "blocked": [], 'ip': ipv4, 'ipv6': ipv6, "path_to_bhr_client_exabgp_loop": path_to_bhr_client_exabgp_loop, } return t.render(**context)
def main(): client = login_from_env() blocker = DummyStdoutBlocker() m = BlockManager(client, blocker) m.run()
def main(): client = login_from_env() blocker = ExaBgpBlocker() m = BlockManager(client, blocker) m.run()
def main(): client = login_from_env() #blocker = DummyStdoutBlocker() blocker = quaggablocker.QuaggaBlocker() m = BlockManager(client, blocker) m.run()
def block(ip, comment, duration): from bhr_client.rest import login_from_env client = login_from_env() duration = int(float(duration)) # Bro sends it as ##.0 block = client.block(cidr=ip, source='bro', why=comment, duration=duration, autoscale=1) return True
def main(): client = login_from_env() s = PeerBlocker(client) s.run()