Coder Social home page Coder Social logo

gopcap's Introduction

PCAP

This is a simple wrapper around libpcap for Go. Originally written by Andreas Krennmair [email protected] and only minorly touched up by Mark Smith [email protected].

Please see the included pcaptest.go and tcpdump.go programs for instructions on how to use this library.

Miek Gieben [email protected] has created a more Go-like package and replaced functionality with standard functions from the standard library. The package has also been renamed to pcap.

gopcap's People

Contributors

akrennmair avatar anall avatar danielarndt avatar dustin avatar elimisteve avatar gconnell avatar jcuga avatar miekg avatar mikebell-org avatar monicasarbu avatar strohman avatar tsg avatar zorkian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gopcap's Issues

problem of cross compile gopacket in mips

I got a problem of cross compiling program based on gopacket :
the env of go is-------->
GOARCH="mips"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="mips-linux-gcc"
GOGCCFLAGS="-fPIC -mabi=32 -march=mips32 -pthread -fmessage-length=0"
CXX="mips-linux-g++"
CGO_ENABLED="1"
CGO_CFLAGS="-I/usr/include"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-L/root/Desktop/libpcap-1.9.0"
PKG_CONFIG="pkg-config"

the result of it is:

runtime/cgo

cc1: warnings being treated as errors
In file included from gcc_libinit.c:8:
/usr/include/pthread.h:675: Warning:‘regparm’ attribute directive ignored
/usr/include/pthread.h:687: Warning:‘regparm’ attribute directive ignored
/usr/include/pthread.h:732: Warning:‘regparm’ attribute directive ignored

I change the include path to "-I/root/Desktop/libpcap-1.9.0" ,the result is:
loading DWARF type: decoding dwarf section info at offset 0x157: unexpected opcode

I have no idea about that.Can u help me?: )

run pcaptest program crashed when using go1.5 windows,amd64

$ ./pcaptest.exe -r /e/1/pcap/a.pcap
Exception 0xc0000005 0x8 0x309400800 0x309400800
PC=0x309400800
signal arrived during external code execution

github.com/akrennmair/gopcap._Cfunc_pcap_findalldevs(0xc082022028, 0x3c7870, 0x0)
        ??:0 +0x3c
github.com/akrennmair/gopcap.Findalldevs(0x0, 0x0, 0x0, 0x0, 0x0)
        e:/goworkspace/go/src/github.com/akrennmair/gopcap/pcap.go:194 +0xf1
main.main()
        e:/goworkspace/go/src/github.com/akrennmair/gopcap/tools/pcaptest/pcaptest.go:28 +0x146

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
        c:/go/src/runtime/asm_amd64.s:1696 +0x1
rax     0xc082055fa0
rbx     0xc082055bc8
rcx     0xc082022028
rdi     0xc082055fa0
rsi     0x632120
rbp     0x0
rsp     0x22fd78
r8      0xc082018000
r9      0xc082055b60
r10     0x4fb210
r11     0x65
r12     0x8
r13     0x5a7f94
r14     0x3f
r15     0x8
rip     0x309400800
rflags  0x10202
cs      0x33
fs      0x53
gs      0x2b

But when I use go1.4.2 and the same platform (windows,amd64), it works OK.

Unable to inspect packets on loopback device (OSX)

I will come back with more info if this is not a known issue - Im running OSX with go 1.5.1, Im trying to do live packet inspection. I'm able to inspect packets on ethernet and wireless but when I try looping over packets on loopback, it doesnt iterate over any packets. However it will detect a count of "packets received" when I look at the session stats (on app SIGTERM).

Is this a know issue? Is anyone else experiencing the same?

Compilation Error

Doing go get github.com/akrennmair/gopcap

gives

.gvm/pkgsets/go1.2.1/global/src/github.com/akrennmair/gopcap/pcap.go:12:18: fatal error: pcap.h: No such file or directory
 #include <pcap.h>

pppoe decode packet

hi can be add pppoe decode packet code?
"code.google.com/p/gopacket/" see code is very difficult i can not understand
because i need to thank you very much.

Tests failure: identifier may conflict with identifiers generated by cgo

With Go 1.12.5 on Fedora Rawhide x86_64, commit 00e1103:

Testing    in: /builddir/build/BUILD/gopcap-00e11033259acb75598ba416495bb708d864a010/_build/src
         PATH: /builddir/build/BUILD/gopcap-00e11033259acb75598ba416495bb708d864a010/_build/bin:/builddir/.local/bin:/builddir/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin
       GOPATH: /builddir/build/BUILD/gopcap-00e11033259acb75598ba416495bb708d864a010/_build:/usr/share/gocode
  GO111MODULE: off
      command: go test -buildmode pie -compiler gc -ldflags "-X github.com/akrennmair/gopcap/version=0 -X github.com/akrennmair/gopcap/version.commit=00e11033259acb75598ba416495bb708d864a010 -extldflags '-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '"
      testing: github.com/akrennmair/gopcap
github.com/akrennmair/gopcap
# github.com/akrennmair/gopcap
./pcap.go:129:13: identifier "_Ctype_struct_pcap_stat" may conflict with identifiers generated by cgo
./pcap.go:142:10: identifier "_Ctype_struct_bpf_program" may conflict with identifiers generated by cgo
./pcap.go:216:34: identifier "_Ctype_struct_pcap_addr" may conflict with identifiers generated by cgo
./pcap.go:219:56: identifier "_Ctype_struct_pcap_addr" may conflict with identifiers generated by cgo
FAIL	github.com/akrennmair/gopcap [build failed]

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.