protocol

package
v0.0.0-...-939ffdc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2021 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const MAX_ADDR = 1000

Maximum number of addresses in addr packet

View Source
const MAX_PACKET_LENGTH = 1000*30 + 3

Maximum payload length of packet we expect to receive

View Source
const MAX_SUBVERSION_LENGTH = 256

Maximum length of user agent

View Source
const MSG_ADDR = "addr"
View Source
const MSG_FEEFILTER = "feefilter"
View Source
const MSG_GETADDR = "getaddr"
View Source
const MSG_PING = "ping"
View Source
const MSG_PONG = "pong"
View Source
const MSG_VERACK = "verack"
View Source
const MSG_VERSION = "version"

Message types

Variables

View Source
var AddrStartOnion = []byte{0xfd, 0x87, 0xd8, 0x7e, 0xeb, 0x43}

P2P-encoded onion addresses start with this prefix

Functions

func Checksum

func Checksum(payload []byte) []byte

Bitcoin P2P packet checksum

func DecodeOnion

func DecodeOnion(addr []byte) (string, error)

Extract .onion from 16-byte "IPv6" address used by Bitcoin P2P

func EncodeOnion

func EncodeOnion(onion string) ([]byte, error)

Encode .onion address into 16-byte "IPv6" address used by Bitcoin P2P

func Hash256

func Hash256(payload []byte) [32]byte

Bitcoin 256-bit hash

func ReadCompactSize

func ReadCompactSize(input []byte) (uint64, int)

Read "compact size" varint. Return value and size of value read. The latter will be 0 on error, which happens if there was not enough space to read it.

func SendPacket

func SendPacket(conn net.Conn, msgstart []byte, pkt *Packet) error

Send P2P packet to connection

Types

type BitcoinProtocolScanner

type BitcoinProtocolScanner struct {
	// contains filtered or unexported fields
}

func NewBitcoinProtocolScanner

func NewBitcoinProtocolScanner(protocolName string) *BitcoinProtocolScanner

func (*BitcoinProtocolScanner) HandleAddr

func (rps *BitcoinProtocolScanner) HandleAddr(conn net.Conn, osc *config.OnionScanConfig, report *report.BitcoinService, pkt *Packet) error

Handle incoming addr message, and parse message payload into report

func (*BitcoinProtocolScanner) HandlePing

func (rps *BitcoinProtocolScanner) HandlePing(conn net.Conn, osc *config.OnionScanConfig, report *report.BitcoinService, pkt *Packet) error

Handle incoming ping message

func (*BitcoinProtocolScanner) HandleVerAck

func (rps *BitcoinProtocolScanner) HandleVerAck(conn net.Conn, osc *config.OnionScanConfig, report *report.BitcoinService, pkt *Packet) error

Handle incoming verack message

func (*BitcoinProtocolScanner) HandleVersion

func (rps *BitcoinProtocolScanner) HandleVersion(conn net.Conn, osc *config.OnionScanConfig, report *report.BitcoinService, pkt *Packet) error

Handle incoming version message, and parse message payload into report

func (*BitcoinProtocolScanner) MessageLoop

func (rps *BitcoinProtocolScanner) MessageLoop(conn net.Conn, osc *config.OnionScanConfig, report *report.BitcoinService) error

Receive messages and handle them

func (*BitcoinProtocolScanner) ScanProtocol

func (rps *BitcoinProtocolScanner) ScanProtocol(hiddenService string, osc *config.OnionScanConfig, report *report.OnionScanReport)

func (*BitcoinProtocolScanner) SendVersion

func (rps *BitcoinProtocolScanner) SendVersion(conn net.Conn, osc *config.OnionScanConfig, hiddenService string) error

Build and send version message

type FTPProtocolScanner

type FTPProtocolScanner struct {
}

func (*FTPProtocolScanner) ScanProtocol

func (sps *FTPProtocolScanner) ScanProtocol(hiddenService string, osc *config.OnionScanConfig, report *report.OnionScanReport)

type HTTPProtocolScanner

type HTTPProtocolScanner struct {
	Client *http.Client
}

func (*HTTPProtocolScanner) ScanProtocol

func (hps *HTTPProtocolScanner) ScanProtocol(hiddenService string, osc *config.OnionScanConfig, report *report.OnionScanReport)

type IRCProtocolScanner

type IRCProtocolScanner struct {
}

func (*IRCProtocolScanner) ScanProtocol

func (rps *IRCProtocolScanner) ScanProtocol(hiddenService string, osc *config.OnionScanConfig, report *report.OnionScanReport)

type MongoDBProtocolScanner

type MongoDBProtocolScanner struct {
}

func (*MongoDBProtocolScanner) ScanProtocol

func (rps *MongoDBProtocolScanner) ScanProtocol(hiddenService string, osc *config.OnionScanConfig, report *report.OnionScanReport)

type Packet

type Packet struct {
	// contains filtered or unexported fields
}

func ReceivePacket

func ReceivePacket(conn net.Conn, msgstart []byte) (*Packet, error)

Receive P2P packet from connection

type RicochetProtocolScanner

type RicochetProtocolScanner struct {
}

func (*RicochetProtocolScanner) ScanProtocol

func (rps *RicochetProtocolScanner) ScanProtocol(hiddenService string, osc *config.OnionScanConfig, report *report.OnionScanReport)

type SMTPProtocolScanner

type SMTPProtocolScanner struct {
}

func (*SMTPProtocolScanner) ScanProtocol

func (sps *SMTPProtocolScanner) ScanProtocol(hiddenService string, osc *config.OnionScanConfig, report *report.OnionScanReport)

type SSHProtocolScanner

type SSHProtocolScanner struct {
}

func (*SSHProtocolScanner) ScanProtocol

func (sps *SSHProtocolScanner) ScanProtocol(hiddenService string, osc *config.OnionScanConfig, report *report.OnionScanReport)

type Scanner

type Scanner interface {
	ScanProtocol(hiddenService string, onionscanConfig *config.OnionScanConfig, report *report.OnionScanReport)
}

type TLSProtocolScanner

type TLSProtocolScanner struct {
}

func (*TLSProtocolScanner) ScanProtocol

func (sps *TLSProtocolScanner) ScanProtocol(hiddenService string, osc *config.OnionScanConfig, report *report.OnionScanReport)

type VNCProtocolScanner

type VNCProtocolScanner struct {
}

func (*VNCProtocolScanner) ScanProtocol

func (vncps *VNCProtocolScanner) ScanProtocol(hiddenService string, osc *config.OnionScanConfig, report *report.OnionScanReport)

type XMPPProtocolScanner

type XMPPProtocolScanner struct {
}

func (*XMPPProtocolScanner) ScanProtocol

func (rps *XMPPProtocolScanner) ScanProtocol(hiddenService string, osc *config.OnionScanConfig, report *report.OnionScanReport)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL