All Projects → cretz → Bine

cretz / Bine

Licence: mit
Go library for accessing and embedding Tor clients and servers

Programming Languages

go
31211 projects - #10 most used programming language

Labels

Projects that are alternatives of or similar to Bine

Docker Onion Nmap
Scan .onion hidden services with nmap using Tor, proxychains and dnsmasq in a minimal alpine Docker container.
Stars: ✭ 345 (-29.45%)
Mutual labels:  tor
Dockerfiles
Discontinued. Fork at your will.
Stars: ✭ 384 (-21.47%)
Mutual labels:  tor
Onioff
🌰 An onion url inspector for inspecting deep web links.
Stars: ✭ 440 (-10.02%)
Mutual labels:  tor
Freshonions Torscraper
Fresh Onions is an open source TOR spider / hidden service onion crawler hosted at zlal32teyptf4tvi.onion
Stars: ✭ 348 (-28.83%)
Mutual labels:  tor
Kadence
⚠️ KADENCE HAS MOVED TO GITLAB ⚠️
Stars: ✭ 363 (-25.77%)
Mutual labels:  tor
Mkp224o
vanity address generator for tor onion v3 (ed25519) hidden services
Stars: ✭ 399 (-18.4%)
Mutual labels:  tor
Thgtoa
The Hitchhiker’s Guide to Online Anonymity
Stars: ✭ 326 (-33.33%)
Mutual labels:  tor
Onionshare
Securely and anonymously share files, host websites, and chat with friends using the Tor network
Stars: ✭ 4,961 (+914.52%)
Mutual labels:  tor
Go Libtor
Self-contained Tor from Go
Stars: ✭ 368 (-24.74%)
Mutual labels:  tor
Kirc
A tiny IRC client written in POSIX C99.
Stars: ✭ 416 (-14.93%)
Mutual labels:  tor
Ricochet
Anonymous peer-to-peer instant messaging
Stars: ✭ 3,570 (+630.06%)
Mutual labels:  tor
Tribler
Privacy enhanced BitTorrent client with P2P content discovery
Stars: ✭ 3,915 (+700.61%)
Mutual labels:  tor
Deeponion Legacy
Official Source Repo for DeepOnion - Anonymous Cryptocurrency on TOR Network (legacy)
Stars: ✭ 413 (-15.54%)
Mutual labels:  tor
Torwall
Tallow - Transparent Tor for Windows
Stars: ✭ 346 (-29.24%)
Mutual labels:  tor
Exitmap
A fast and modular scanner for Tor exit relays. The canonical repository (including issue tracker) is at https://gitlab.torproject.org/tpo/network-health/exitmap
Stars: ✭ 440 (-10.02%)
Mutual labels:  tor
Debian Privacy Server Guide
Guide to using a remote Debian server for security and privacy services
Stars: ✭ 338 (-30.88%)
Mutual labels:  tor
Warezz
It's illegal cuz they can't tax you!
Stars: ✭ 386 (-21.06%)
Mutual labels:  tor
Awesome Privacy
💡Limiting personal data leaks on the internet
Stars: ✭ 488 (-0.2%)
Mutual labels:  tor
Tor Controller
Run Tor onion services on Kubernetes
Stars: ✭ 476 (-2.66%)
Mutual labels:  tor
Torat
ToRat is a Remote Administation tool written in Go using Tor as a transport mechanism and RPC for communication
Stars: ✭ 415 (-15.13%)
Mutual labels:  tor

GoDoc

Bine is a Go API for using and controlling Tor. It is similar to Stem.

Features:

  • Full support for the Tor controller API
  • Support for net.Conn and net.Listen style APIs
  • Supports statically compiled Tor to embed Tor into the binary
  • Supports both v2 and v3 onion services
  • Support for embedded control socket in Tor >= 0.3.5 (non-Windows)

See info below, the API docs, and the examples. The project is MIT licensed. The Tor docs/specs and https://github.com/yawning/bulb were great helps when building this.

Example

It is really easy to create an onion service. For example, assuming tor is on the PATH, this bit of code will show a directory server of the current directory:

package main

import (
	"context"
	"fmt"
	"log"
	"net/http"
	"time"

	"github.com/cretz/bine/tor"
)

func main() {
	// Start tor with default config (can set start conf's DebugWriter to os.Stdout for debug logs)
	fmt.Println("Starting and registering onion service, please wait a couple of minutes...")
	t, err := tor.Start(nil, nil)
	if err != nil {
		log.Panicf("Unable to start Tor: %v", err)
	}
	defer t.Close()
	// Wait at most a few minutes to publish the service
	listenCtx, listenCancel := context.WithTimeout(context.Background(), 3*time.Minute)
	defer listenCancel()
	// Create a v3 onion service to listen on any port but show as 80
	onion, err := t.Listen(listenCtx, &tor.ListenConf{Version3: true, RemotePorts: []int{80}})
	if err != nil {
		log.Panicf("Unable to create onion service: %v", err)
	}
	defer onion.Close()
	fmt.Printf("Open Tor browser and navigate to http://%v.onion\n", onion.ID)
	fmt.Println("Press enter to exit")
	// Serve the current folder from HTTP
	errCh := make(chan error, 1)
	go func() { errCh <- http.Serve(onion, http.FileServer(http.Dir("."))) }()
	// End when enter is pressed
	go func() {
		fmt.Scanln()
		errCh <- nil
	}()
	if err = <-errCh; err != nil {
		log.Panicf("Failed serving: %v", err)
	}
}

If in main.go it can simply be run with go run main.go. Of course this uses a separate tor process. To embed Tor statically in the binary, follow the embedded package docs which will require building Tor statically. Then with github.com/cretz/bine/process/embedded imported, change the start line above to:

t, err := tor.Start(nil, &tor.StartConf{ProcessCreator: embedded.NewCreator()})

This defaults to Tor 0.3.5.x versions but others can be used from different packages. In non-Windows environments, the UseEmbeddedControlConn field in StartConf can be set to true to use an embedded socket that does not open a control port.

Tested on Windows, the original exe file is ~7MB. With Tor statically linked it comes to ~24MB, but Tor does not have to be distributed separately. Of course take notice of all licenses in accompanying projects.

Testing

To test, a simple go test ./... from the base of the repository will work (add in a -v in there to see the tests). The integration tests in tests however will be skipped. To execute those tests, -tor must be passed to the test. Also, tor must be on the PATH or -tor.path must be set to the path of the tor executable. Even with those flags, only the integration tests that do not connect to the Tor network are run. To also include the tests that use the Tor network, add the -tor.network flag. For details Tor logs during any of the integration tests, use the -tor.verbose flag.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].