httpcap

package module
v0.0.0-...-ebee754 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2022 License: MIT Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

httpcap

Parse and display http traffic from network device or pcap file. This is a go version of origin pcap-parser, thanks to gopacket project, this tool has simpler code base and is more efficient.

Dependency

httpcap uses libpcap, a system-independent interface for user-level packet capture,Before use httpcap, you must first install libpcap

for ubuntu/debian:

sudo apt install libpcap-dev

for centos/redhat/fedora:

sudo yum install libpcap-devel

Installation

$ go install github.com/uole/httpcap@latest

Usage

Usage of httpcap:
  -assembly_debug_log
        If true, the github.com/google/gopacket/reassembly library will log verbose debugging information (at least one line per packet)
  -assembly_memuse_log
        If true, the github.com/google/gopacket/reassembly library will log information regarding its memory use every once in a while.
  -f string
        packet filter in libpcap filter syntax
  -host string
        filter http request host, using wildcard match(*)
  -i string
        name of interface (default "eth0")
  -ip string
        filter source or target ip
  -p int
        filter source or target port
  -l    list of interfaces and exit
  -v    display version info and exit

Example

list interfaces
root@localhost:~# httpcap -l
Name                                 Description
veth4917cfa
veth5fba3eb
veth93a23daf
vethf578bde
eth0
http capture
$ httpcap -i eth0 

httpcap

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

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

func NewApp

func NewApp(filter *Filter) *App

func (*App) Handle

func (app *App) Handle(req *http.Request, res *http.Response)

func (*App) Run

func (app *App) Run(ctx context.Context, iface string) (err error)

type AssemblerContext

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

func (*AssemblerContext) GetCaptureInfo

func (ctx *AssemblerContext) GetCaptureInfo() gopacket.CaptureInfo

type Capture

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

func NewCapture

func NewCapture(iface string, snaplen int, filter *Filter) *Capture

func (*Capture) Start

func (cap *Capture) Start(ctx context.Context) (err error)

func (*Capture) Stop

func (cap *Capture) Stop() (err error)

func (*Capture) WithHandle

func (cap *Capture) WithHandle(f factory.HandleFunc) *Capture

type Filter

type Filter struct {
	IP   string `json:"ip"`
	Port int    `json:"port"`
	Host string `json:"host"`
	BPF  string `json:"bpf"`
}

func (*Filter) Match

func (filter *Filter) Match(host string) bool

type State

type State struct {
	NumOfCapture int
	// contains filtered or unexported fields
}

Directories

Path Synopsis
internal
io

Jump to

Keyboard shortcuts

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