Skip to content

abiko-search/garlic

Repository files navigation

Garlic

Pure Elixir Tor client implementation

Disclaimer

⚠️ This module was designed to crawl hidden services fast and doesn't provide the same level of anonymity as the reference Tor implementation!

Installation

def deps do
  [
    {:garlic, "~> 0.1.0-dev", github: "abiko-search/garlic"}
  ]
end

Usage

alias Garlic.{CircuitManager, Mint.Client}

domain = "abikoifawyrftqivkhfxiwdjcdzybumpqrbowtudtwhrhpnykfonyzid.onion"
port = 80

with {:ok, pid} <- CircuitManager.get_circuit(domain) do
  for {url, i} <- Enum.with_index(~w(/ /robots.txt /sitemap.xml)) do
    Task.async fn ->
      pid
      |> Client.request(i + 1, domain, port, "GET", url, [], "")
      |> Enum.join()
      |> IO.inspect(label: url)
    end
  end
  |> Task.await_many(:infinity)
end

License

Apache 2.0 © Danila Poyarkov

Releases

No releases published

Packages

No packages published

Languages