Giter VIP home page Giter VIP logo

libnetgo's People

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

libnetgo's Issues

编译成功后,运行软件获取不到数据,流量进出一直显示是零

编译安装时候的命令记录

cd ~
sudo apt install libpcap-dev gcc
wget https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.14.2.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
go get github.com/gotoolkits/libnetgo 
cd ~/go/src/github.com/gotoolkits/libnetgo
go build libnet.go

运行

chmod +x libnet
./libnet -c -ip 192.168.168.165
⇨ http server started on [::]:18081
=======================================================================================================================
| PID | USER |                    IPLINK              |IN|OUT(k)|SENT|RECEIVED(kB/s)|            PROGRAM               |
=======================================================================================================================
 26700  root     192.168.168.165:22-192.168.168.2:50010   0     0     0     0      /usr/sbin/sshd
 26736  root     192.168.168.165:22-192.168.168.2:50012   0     0     0     0      /usr/sbin/sshd
 12212  root     127.0.0.1:36462-127.0.0.1:8024           0     0     0     0      /root/nps/npc
 12212  root     127.0.0.1:36464-127.0.0.1:8024           0     0     0     0      /root/nps/npc

PkgAcc = make(map[string]map[string]int64) 不是线程安全的,出现资源竞争。

go run -race libnet.go -ip 10.211.55.30
⇨ http server started on [::]:18081
==================
WARNING: DATA RACE
Write at 0x0000015293b0 by goroutine 12:
  github.com/gotoolkits/libnetgo/packet.StartNetSniff()
      /home/parallels/go/src/github.com/gotoolkits/libnetgo/packet/sniff.go:57 +0x80
  github.com/gotoolkits/libnetgo/api.FnSniffOn()
      /home/parallels/go/src/github.com/gotoolkits/libnetgo/api/api.go:119 +0xe0
  github.com/labstack/echo.(*Echo).add.func1()
      /home/parallels/go/src/github.com/labstack/echo/echo.go:505 +0xdd
  github.com/labstack/echo/middleware.CORSWithConfig.func1.1()
      /home/parallels/go/src/github.com/labstack/echo/middleware/cors.go:121 +0x67b
  github.com/labstack/echo.(*Echo).ServeHTTP()
      /home/parallels/go/src/github.com/labstack/echo/echo.go:616 +0x447
  net/http.serverHandler.ServeHTTP()
      /snap/go/4301/src/net/http/server.go:2774 +0xce
  net/http.(*conn).serve()
      /snap/go/4301/src/net/http/server.go:1878 +0x811

Previous read at 0x0000015293b0 by main goroutine:
  [failed to restore the stack]

Goroutine 12 (running) created at:
  net/http.(*Server).Serve()
      /snap/go/4301/src/net/http/server.go:2884 +0x4c4
  github.com/labstack/echo.(*Echo).StartServer()
      /home/parallels/go/src/github.com/labstack/echo/echo.go:707 +0x6fc
  github.com/gotoolkits/libnetgo/api.ServerRun()
      /home/parallels/go/src/github.com/labstack/echo/echo.go:627 +0x9bc
==================

安装时出现错误

root@ubuntu:~# go get github.com/gotoolkits/libnetgo

github.com/google/gopacket/pcap

/home/go/src/github.com/google/gopacket/pcap/pcap.go:30:22: undefined: pcapErrorNotActivated
/home/go/src/github.com/google/gopacket/pcap/pcap.go:52:17: undefined: pcapTPtr
/home/go/src/github.com/google/gopacket/pcap/pcap.go:64:10: undefined: pcapPkthdr

使用时出现broken pipe错误

打开sniff_on开关后,过一段时间,出现broken pipe错误

➜ libnetgo git:(master) ✗ ./libnet -ip 192.168.203.129
⇨ http server started on [::]:18081
ERRO[0032] write tcp 127.0.0.1:18081->127.0.0.1:51516: write: broken pipe

{"message":"Not Found"} on CentOS 7

lsb_release -a
LSB Version:	:core-4.1-amd64:core-4.1-noarch
Distributor ID:	CentOS
Description:	CentOS Linux release 7.5.1804 (Core) 
Release:	7.5.1804
Codename:	Core
rpm --import https://mirror.go-repo.io/centos/RPM-GPG-KEY-GO-REPO
curl -s https://mirror.go-repo.io/centos/go-repo.repo | tee /etc/yum.repos.d/go-repo.repo
yum install golang
go get github.com/gotoolkits/libnetgo 
cd $GOPATH/src/github.com/gotoolkits/libnetgo
go run libnet.go -ip 10.233.47.169

Screenshot from 2019-07-11 14-43-30

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.