A Golang tool to whitelist ASN's based on organization name

Related tags

goAllowOrgs
Overview

goAllowOrgs

A Golang tool to whitelist ASN's based on organization name. This works by providing a list of ASN org names. This tool uses goPacket to monitor incoming traffic, capturing the IP's and checking the IP to see if it is a part of a whitelisted ASN. If it is not, it blocks that connection and future connections using iptables.

Uses

  • Whitelisting common ISP and target ASN's which in turn blocks connections from data centers.. think security tools..
  • Can be ran on any host, doesn't require a proxy or anything since its simply a packet sniffer

Disclaimers

  • This tool is fairly janky, since it blocks the traffic after the IP connects, the first few packets may get through. Not a problem if you have SSL since the SSL handshake takes enough time to drop the connections. If it is one web page with port 80, the page may be returned in cases where this tool does not kill the connection fast enough.
  • Must be run as root

Getting Started

Pull ASN data from db-ip, various libraries and add required headers

sudo apt-get install libpcap-dev
curl https://download.db-ip.com/free/dbip-asn-lite-2021-06.csv.gz -o asndata.csv.gz
gunzip asndata.csv.gz
sed -i '1 i\first,last,asn,org_name' asndata.csv
curl -fsSL https://github.com/banviktor/asnlookup/releases/download/v0.1.0/asnlookup-linux-amd64-v0.1.0.tar.gz | sudo tar -zx 
curl https://raw.githubusercontent.com/banviktor/asnlookup/main/hack/pull_rib.sh -o pull_rib.sh
chmod +x pull_rib.sh
./pull_rib.sh
bzcat rib.*.bz2 | ./asnlookup-utils convert --input - --output asn.db
touch allowed_orgs.txt

Now populate the allowed_orgs.txt file with line delimited strings of allowed orgs, example:

att
verizon
charter
spectrum

Now you should be ready to run the tool

[email protected]:/home/jordan/test# ./main -h
                  _  _
 __ _  ___  __ _ | || | ___ __ __ __ ___  _ _  __ _
/ _` |/ _ \/ _` || || |/ _ \\ V  V // _ \| '_|/ _` |
\__, |\___/\__,_||_||_|\___/ \_/\_/ \___/|_|  \__, |
|___/                                         |___/
Usage of ./main:
  -asn_csv string
        CSV file with org name to ASN number (default "asndata.csv")
  -asn_db string
        ASN database (default "asn.db")
  -interface string
        Interface name (default "ens5")
  -orgs string
        File with line delimited orgs to allow (default "allowed_orgs.txt")
  -output string
        Log file name (default "goFW.log")
  -port string
        Port to monitor (default "443")
Releases(0.1.3)
Helpfully Functional Go like underscore.js

/\ \ __ __ ___ \_\ \ __ _ __ ____ ___ ___ _ __ __ __ __

null 342 Jul 14, 2021
Go tool to modify struct field tags

Go tool to modify/update field tags in structs. gomodifytags makes it easy to update, add or delete the tags in a struct field. You can easily add new tags, update existing tags (such as appending a new key, i.e: db, xml, etc..) or remove existing tags

Fatih Arslan 1.5k Jul 16, 2021
Discover internet-wide misconfigurations while drinking coffee

netz ?? ?? The purpose of this project is to discover an internet-wide misconfiguration of network components like web-servers/databases/cache-service

null 259 Jun 24, 2021
A tool to check problems about meta files of Unity

A tool to check problems about meta files of Unity on Git repositories, and also the tool can do limited autofix for meta files of auto-generated files.

DeNA 38 Jul 14, 2021
A tool and library for using structural regular expressions.

Structural Regular Expressions sregx is a package and tool for using structural regular expressions as described by Rob Pike (link).

Zachary Yedidia 22 Jun 18, 2021
Jennifer is a code generator for Go

Jennifer Jennifer is a code generator for Go. package main import ( "fmt" . "github.com/dave/jennifer/jen" ) func main() { f := NewFile("m

Dave Brophy 2.1k Jul 23, 2021
Helpers for making the use of reflection easier

go-xray This is a Golang library with reflection related functions which I use in my different projects. KeyValue This type is used to construct a key

Pieter Claerhout 18 Jun 27, 2021
A super simple Lodash like utility library with essential functions that empowers the development in Go

A simple Utility library for Go Go does not provide many essential built in functions when it comes to the data structure such as slice and map. This

Rahul Baruri 81 Jul 17, 2021
A tool to filter URLs by parameter count or size

GoFilter A tool to filter URLs by parameter count or size. This tool requires unique sorted URL list. For example: cat hosts.txt | sort -u > sorted &&

Ayberk ESER 6 Jun 25, 2021
gProfiler combines multiple sampling profilers to produce unified visualization of what your CPU

gProfiler combines multiple sampling profilers to produce unified visualization of what your CPU is spending time on, displaying stack traces of your processes across native programs1 (includes Golang), Java and Python runtimes, and kernel routines.

Granulate 332 Jul 21, 2021
a decision & trigger framework backed by Google's Common Expression Language used in graphikDB

a decision & trigger framework backed by Google's Common Expression Language used in graphikDB

null 56 Feb 23, 2021
Perforator is a tool for recording performance metrics over subregions of a program using the Linux "perf" interface.

Perforator Perforator is a tool for recording performance metrics over subregions of a program (e.g., functions) using the Linux "perf" interface.

Zachary Yedidia 18 Jul 14, 2021
go-sundheit:A library built to provide support for defining service health for golang services

A library built to provide support for defining service health for golang services. It allows you to register async health checks for your dependencies and the service itself, and provides a health endpoint that exposes their status.

AppsFlyer 419 Jul 23, 2021
Go package to generate and manage color palettes & schemes 🎨

Go package to generate and manage color palettes & schemes

Christian Muehlhaeuser 437 Jul 19, 2021