refact: renamed package net to network to avoid collision with golang net package.

This commit is contained in:
evilsocket 2018-02-15 21:34:46 +01:00
commit 48d27f274a
28 changed files with 298 additions and 298 deletions

View file

@ -6,7 +6,7 @@ import (
"time"
"github.com/evilsocket/bettercap-ng/log"
network "github.com/evilsocket/bettercap-ng/net"
network "github.com/evilsocket/bettercap-ng/network"
"github.com/evilsocket/bettercap-ng/packets"
"github.com/evilsocket/bettercap-ng/session"

View file

@ -6,7 +6,7 @@ import (
"strings"
"github.com/evilsocket/bettercap-ng/core"
"github.com/evilsocket/bettercap-ng/net"
"github.com/evilsocket/bettercap-ng/network"
"github.com/evilsocket/bettercap-ng/session"
)
@ -20,7 +20,7 @@ func (s EventsStream) viewLogEvent(e session.Event) {
}
func (s EventsStream) viewEndpointEvent(e session.Event) {
t := e.Data.(*net.Endpoint)
t := e.Data.(*network.Endpoint)
vend := ""
name := ""

View file

@ -8,7 +8,7 @@ import (
"github.com/evilsocket/bettercap-ng/core"
"github.com/evilsocket/bettercap-ng/log"
bnet "github.com/evilsocket/bettercap-ng/net"
bnet "github.com/evilsocket/bettercap-ng/network"
"github.com/evilsocket/bettercap-ng/session"
)

View file

@ -4,7 +4,7 @@ import (
"time"
"github.com/evilsocket/bettercap-ng/log"
"github.com/evilsocket/bettercap-ng/net"
"github.com/evilsocket/bettercap-ng/network"
"github.com/evilsocket/bettercap-ng/session"
)
@ -68,9 +68,9 @@ func (d Discovery) Author() string {
return "Simone Margaritelli <evilsocket@protonmail.com>"
}
func (d *Discovery) runDiff(cache net.ArpTable) {
func (d *Discovery) runDiff(cache network.ArpTable) {
// check for endpoints who disappeared
var rem net.ArpTable = make(net.ArpTable)
var rem network.ArpTable = make(network.ArpTable)
for mac, t := range d.Session.Targets.Targets {
if _, found := cache[mac]; found == false {
rem[mac] = t.IpAddress
@ -101,7 +101,7 @@ func (d *Discovery) Start() error {
iface := d.Session.Interface.Name()
for d.Running() {
if table, err := net.ArpUpdate(iface); err != nil {
if table, err := network.ArpUpdate(iface); err != nil {
log.Error("%s", err)
} else {
d.runDiff(table)

View file

@ -8,7 +8,7 @@ import (
"time"
"github.com/evilsocket/bettercap-ng/core"
"github.com/evilsocket/bettercap-ng/net"
"github.com/evilsocket/bettercap-ng/network"
"github.com/evilsocket/bettercap-ng/packets"
"github.com/dustin/go-humanize"
@ -47,7 +47,7 @@ func rankByProtoHits(protos map[string]uint64) (ProtoPairList, uint64) {
return pl, max
}
func (d *Discovery) getRow(e *net.Endpoint) []string {
func (d *Discovery) getRow(e *network.Endpoint) []string {
sinceStarted := time.Since(d.Session.StartedAt)
sinceFirstSeen := time.Since(e.FirstSeen)
@ -127,9 +127,9 @@ func (d *Discovery) Show(by string) error {
pad := 1
if d.Session.Interface.HwAddress == d.Session.Gateway.HwAddress {
pad = 0
targets = append([]*net.Endpoint{d.Session.Interface}, targets...)
targets = append([]*network.Endpoint{d.Session.Interface}, targets...)
} else {
targets = append([]*net.Endpoint{d.Session.Interface, d.Session.Gateway}, targets...)
targets = append([]*network.Endpoint{d.Session.Interface, d.Session.Gateway}, targets...)
}
rows := make([][]string, 0)

View file

@ -1,12 +1,12 @@
package modules
import (
"github.com/evilsocket/bettercap-ng/net"
"github.com/evilsocket/bettercap-ng/network"
"github.com/evilsocket/bettercap-ng/packets"
"github.com/evilsocket/bettercap-ng/session"
)
type ByAddressSorter []*net.Endpoint
type ByAddressSorter []*network.Endpoint
func (a ByAddressSorter) Len() int { return len(a) }
func (a ByAddressSorter) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
@ -17,13 +17,13 @@ func (a ByAddressSorter) Less(i, j int) bool {
return a[i].IpAddressUint32 < a[j].IpAddressUint32
}
type BySeenSorter []*net.Endpoint
type BySeenSorter []*network.Endpoint
func (a BySeenSorter) Len() int { return len(a) }
func (a BySeenSorter) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a BySeenSorter) Less(i, j int) bool { return a[i].LastSeen.After(a[j].LastSeen) }
type BySentSorter []*net.Endpoint
type BySentSorter []*network.Endpoint
func (a BySentSorter) Len() int { return len(a) }
func (a BySentSorter) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
@ -46,7 +46,7 @@ func (a BySentSorter) Less(i, j int) bool {
return bTraffic.Sent < aTraffic.Sent
}
type ByRcvdSorter []*net.Endpoint
type ByRcvdSorter []*network.Endpoint
func (a ByRcvdSorter) Len() int { return len(a) }
func (a ByRcvdSorter) Swap(i, j int) { a[i], a[j] = a[j], a[i] }