CovenantSQL/CookieScanner

error: call DHT.Ping failed

whyhankee opened this issue · 2 comments

I have a problem running CookieScanner:

OS: Mac OS - Big Sur
Docker: Docker Desktop 2.5.0.1 (49550), Engine 19.0.3.13
Go version go1.15.4 darwin/amd64

Installed Headless chrome

➜ docker container run -d -p 9222:9222 zenika/alpine-chrome --no-sandbox
--remote-debugging-address=0.0.0.0 --remote-debugging-port=9222
Unable to find image 'zenika/alpine-chrome:latest' locally
latest: Pulling from zenika/alpine-chrome
188c0c94c7c5: Pull complete
b378c7cd8c6f: Pull complete
0fb885ce313b: Pull complete
8eda225b284d: Pull complete
Digest: sha256:5ee20821b79269f7352d97ab007a397658e69dc8bd61e6cfde8092ad8eaa92ba
Status: Downloaded newer image for zenika/alpine-chrome:latest
bed706e445a03298cf0f431243602f92fbba30dc587d08928f433937f54346b5
Ran example command:

➜ ~/go/bin/CookieScanner cli
--headless
--classifier "covenantsql://050cdf3b860c699524bf6f6dce28c4f3e8282ac58b0e410eb340195c379adc3a?config=./config/config.yaml"
--html cql.html covenantsql.io
CookieScanner: error: call DHT.Ping failed: dial to node 00000000000589366268c274fdc11ec8bdb17e668d2f619555a2e9c1a2

I am also seeing this issue.

Well it seems the DNS is still registered to AWS in China, but the EC2 instances or the security group isn't accepting inbound TCP 7777, so my guess is someone decided to stop paying the EC2 bill.

You can remove the --classifier command-line argument and the tool works just fine, you just don't get the cookies classified as marketing and whatnot and some of the fields, like description is missing.

I looked at the code for --classifier and I see that sqlite3 is also a valid, so it seems you could use that for your lookups and it might be nice if the authors could share a copy of the database?

The relevant parts of the source, which suggest sqlite3 as well as some structure of the database is at https://github.com/CovenantSQL/CookieScanner/blob/master/parser/classification.go

Snippet below for convenience:

case "covenantsql", "cql":
		queries := u.Query()
		cfg := queries.Get("config")
		passwd := queries.Get("password")
		if cfg != "" {
			if err = client.Init(cfg, []byte(passwd)); err != nil {
				return
			}
		}
		c.db, err = sql.Open("covenantsql", dsn)
	case "sqlite3", "sqlite":
		c.db, err = sql.Open("sqlite3", "file:"+strings.TrimPrefix(dsn, u.Scheme+"://"))
	default:
		err = errors.New("invalid classifier database dsn")
	}

	return
}

func (c *Classifier) GetCookieDetail(name string) (cookieType string, cookieDesc string, err error) {
	err = c.db.QueryRow("SELECT cookie_type, cookie_desc FROM cookies WHERE cookie_name = ? LIMIT 1", name).
		Scan(&cookieType, &cookieDesc)
	if err == sql.ErrNoRows {
		err = nil
	}