Git Product home page Git Product logo

go-knn's Introduction

go-kNN

This is a a golang implementation of the kNN website fingerprinting attack and feature extractor by Wang et al..

There are three versions:

  • knn.orig which produces identical output as Wang's implementation in the attacks collection.
  • knn.fixed that fixes some bugs in feature extraction, removes unnecessary features for Tor, and fixes a bug in the weight learning algorithm. The feature extraction is (to the best of my knowledge) identical to Table 3.1 in Wang's PhD thesis.
  • go-knn that provides an optmized go-knn version with multi-core and sub-folder support for work.

Initial tests show no meaningful differences between the three versions beyond speed due to removing unnecessary features for Tor from the feature extraction. The port and bugfixes were a way for me to better understand the attack.

Example

Download Wang et al.'s cell traces for their USENIX 2014 paper with 100x90 + 900 traces. Extract the traces, creating the batch folder.

Extract the original features:

$ go run cmd/feat.orig/fextractor.go -sites 100 -instances 90 -open 9000
2016/04/12 11:31:15 starting parsing...
2016/04/12 11:32:27 done parsing (100 sites, 90 instances, 9000 open world, folder "batch/", suffix "f")

Extract the fixed features:

$ go runcmd/feat.fixed/fextractor.go -sites 100 -instances 90 -open 9000
2016/04/12 11:30:29 starting parsing...
2016/04/12 11:30:46 done parsing (100 sites, 90 instances, 9000 open world, folder "batch/", suffix "s")

Run the original attack:

$ go run cmd/knn.orig/knn.orig.go
2016/04/12 11:32:49 loaded instances: main
2016/04/12 11:32:50 loaded instances: training
2016/04/12 11:32:52 loaded instances: testing
2016/04/12 11:32:55 loaded instances: open
2016/04/12 11:32:55 starting to learn distance...
	distance... 8999 (0-9000)
2016/04/12 11:47:18 finished
2016/04/12 11:47:18 started computing accuracy...
	accuracy... 17999 (0-18000)
2016/04/12 12:43:11 finished
2016/04/12 12:43:11 Accuracy: 0.870667 0.989889

Run the fixed attack:

$ go run cmd/knn.fixed/knn.fixed.go
2016/04/12 11:32:45 loaded instances: main
2016/04/12 11:32:46 loaded instances: training
2016/04/12 11:32:46 loaded instances: testing
2016/04/12 11:32:46 loaded instances: open
2016/04/12 11:32:46 starting to learn distance...
	distance... 8999 (0-9000)
2016/04/12 11:36:50 finished
2016/04/12 11:36:50 started computing accuracy...
	accuracy... 17999 (0-18000)
2016/04/12 11:54:32 finished
2016/04/12 11:54:32 Accuracy: 0.872556 0.989889

License and funding

As far as a straight port from source code can be licensed by me (probably not at all), the code is licensed under GPLv3.

This work is part of the HOT research project, funded by the Swedish Internet Fund.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.