Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalid memory address or nil pointer dereference #562

Closed
jackassplus opened this issue May 1, 2019 · 2 comments
Closed

invalid memory address or nil pointer dereference #562

jackassplus opened this issue May 1, 2019 · 2 comments

Comments

@jackassplus
Copy link

Prerequisites

Crashes when I try to do a wifi.show on en0

Environment

bettercap binary:
bettercap v2.23 (built for darwin amd64 with go1.11.1)
MacOS 10.14.4
sudo ./bettercap -iface en0

Debug output:

sudo ./bettercap -iface en0 -debug
bettercap v2.23 (built for darwin amd64 with go1.11.1) [type 'help' for a list of commands]

10.0.1.0/24 > 10.0.1.3  » [18:50:23] [sys.log] [dbg] FindGateway(en0) [cmd=netstat opts=[-n -r] parser=^([a-z]+)+\s+(\d+\.+\d+.\d.+\d)+\s+([a-zA-z]+)+\s+(\d+)+\s+(\d+)+\s+([a-zA-Z]+\d+)$]
10.0.1.0/24 > 10.0.1.3  » [18:50:23] [sys.log] [dbg] FindGateway(en0) output:
Routing tables

Internet:
Destination        Gateway            Flags        Refs      Use   Netif Expire
default            10.0.1.1           UGSc          124        0     en0
10.0.1/24          link#8             UCS             4        0     en0      !
10.0.1.1/32        link#8             UCS             1        0     en0      !
10.0.1.1           c:51:1:e2:e2:5     UHLWIir        35       73     en0   1093
10.0.1.3/32        link#8             UCS             0        0     en0      !
10.0.1.29          8:66:98:a9:d2:f9   UHLWI           0        6     en0    997
10.0.1.30          d8:9d:67:e6:ba:2e  UHLWI           0        0     en0    986
10.0.1.47          54:13:79:9a:b4:2a  UHLWI           0        0     en0   1179
10.0.1.230         8c:89:a5:c6:e7:fd  UHLWIi          1       19     en0   1093
127                127.0.0.1          UCS             0        0     lo0
127.0.0.1          127.0.0.1          UH             11   413659     lo0
169.254            link#8             UCS             1        0     en0      !
192.168.39         link#20            UC              1        0  vmnet1      !
192.168.159        link#21            UC              1        0  vmnet8      !
224.0.0/4          link#8             UmCS            2        0     en0      !
224.0.0.251        1:0:5e:0:0:fb      UHmLWI          0       11     en0
239.255.255.250    1:0:5e:7f:ff:fa    UHmLWI          0        8     en0
255.255.255.255/32 link#8             UCS             0        0     en0      !

Internet6:
Destination                             Gateway                         Flags         Netif Expire
default                                 fe80::%utun0                    UGcI          utun0
::1                                     ::1                             UHL             lo0
fe80::%lo0/64                           fe80::1%lo0                     UcI             lo0
fe80::1%lo0                             link#1                          UHLI            lo0
fe80::%en6/64                           link#7                          UCI             en6
fe80::aede:48ff:fe00:1122%en6           ac:de:48:0:11:22                UHLI            lo0
fe80::aede:48ff:fe33:4455%en6           ac:de:48:33:44:55               UHLWIi          en6
fe80::%en0/64                           link#8                          UCI             en0
fe80::1450:1e9e:b76e:e3df%en0           8c:85:90:5:7b:7                 UHLI            lo0
fe80::%awdl0/64                         link#14                         UCI           awdl0
fe80::7842:61ff:fefe:f9f6%awdl0         7a:42:61:fe:f9:f6               UHLI            lo0
fe80::%utun0/64                         fe80::9613:d5d5:8570:a6ef%utun0 UcI           utun0
fe80::9613:d5d5:8570:a6ef%utun0         link#17                         UHLI            lo0
ff01::%lo0/32                           ::1                             UmCI            lo0
ff01::%en6/32                           link#7                          UmCI            en6
ff01::%en0/32                           link#8                          UmCI            en0
ff01::%awdl0/32                         link#14                         UmCI          awdl0
ff01::%utun0/32                         fe80::9613:d5d5:8570:a6ef%utun0 UmCI          utun0
ff02::%lo0/32                           ::1                             UmCI            lo0
ff02::%en6/32                           link#7                          UmCI            en6
ff02::%en0/32                           link#8                          UmCI            en0
ff02::%awdl0/32                         link#14                         UmCI          awdl0
ff02::%utun0/32                         fe80::9613:d5d5:8570:a6ef%utun0 UmCI          utun0
10.0.1.0/24 > 10.0.1.3  » [18:50:23] [sys.log] [dbg] FindGateway(en0) line 'default            10.0.1.1           UGSc          124        0     en0' matched with [default            10.0.1.1           UGSc          124        0     en0 default 10.0.1.1 UGSc 124 0 en0]
10.0.1.0/24 > 10.0.1.3  » [18:50:23] [sys.log] [dbg] gateway is 10.0.1.1[c:51:1:e2:e2:5]
10.0.1.0/24 > 10.0.1.3  » [18:50:23] [session.started] {session.started 2019-04-30 18:50:23.793558 -0700 PDT m=+0.035166453 <nil>}
10.0.1.0/24 > 10.0.1.3  » [18:50:23] [mod.started] events.stream
10.0.1.0/24 > 10.0.1.3  » wifi.show

Stopping modules and cleaning session state ...
[18:50:37] [session.closing] {session.closing 2019-04-30 18:50:37.32506 -0700 PDT m=+13.566674193 <nil>}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x98 pc=0x45e7f5e]

goroutine 1 [running]:
github.com/bettercap/bettercap/network.(*Endpoint).Name(...)
	/Users/evilsocket/gocode/src/github.com/bettercap/bettercap/network/lan_endpoint.go:125
github.com/bettercap/bettercap/modules/wifi.(*WiFiModule).showStatusBar(0xc0001748c0)
	/Users/evilsocket/gocode/src/github.com/bettercap/bettercap/modules/wifi/wifi_show.go:300 +0x3e
github.com/bettercap/bettercap/modules/wifi.(*WiFiModule).Show(0xc0001748c0, 0xc0000c35f0, 0xc000199ad8)
	/Users/evilsocket/gocode/src/github.com/bettercap/bettercap/modules/wifi/wifi_show.go:338 +0x283
github.com/bettercap/bettercap/modules/wifi.NewWiFiModule.func10(0x0, 0x0, 0x0, 0x0, 0x0)
	/Users/evilsocket/gocode/src/github.com/bettercap/bettercap/modules/wifi/wifi.go:254 +0x2a
github.com/bettercap/bettercap/session.(*ModuleHandler).Exec(0xc0005fa500, 0x0, 0x0, 0x0, 0x0, 0x0)
	/Users/evilsocket/gocode/src/github.com/bettercap/bettercap/session/module_handler.go:71 +0x8a
github.com/bettercap/bettercap/session.(*Session).Run(0xc0000c64e0, 0xc0000c3610, 0x9, 0x1, 0x1)
	/Users/evilsocket/gocode/src/github.com/bettercap/bettercap/session/session.go:416 +0x68d
main.main()
	/Users/evilsocket/gocode/src/github.com/bettercap/bettercap/main.go:94 +0x8dd

Steps to Reproduce

  1. start bettercap
  2. wifi.show
  3. dead
@jackassplus
Copy link
Author

not sure if this is related, but I get errors building. (following the instructions at https://www.bettercap.org/installation/ exactly)

2019-05-01 07:02:39 [~]$ cd $GOPATH/src/github.com/bettercap/bettercap
 2019-05-01 07:02:41 [bettercap]$ make clean
 2019-05-01 07:02:46 [bettercap]$ make build
# github.com/bettercap/bettercap/vendor/github.com/google/gopacket/pcap
vendor/github.com/google/gopacket/pcap/pcap.go:189:7: identifier "_Ctype_struct_bpf_program" may conflict with identifiers generated by cgo
vendor/github.com/google/gopacket/pcap/pcap.go:445:13: identifier "_Ctype_struct_pcap_stat" may conflict with identifiers generated by cgo
vendor/github.com/google/gopacket/pcap/pcap.go:490:49: identifier "_Ctype_struct_bpf_program" may conflict with identifiers generated by cgo
vendor/github.com/google/gopacket/pcap/pcap.go:513:10: identifier "_Ctype_struct_bpf_program" may conflict with identifiers generated by cgo
vendor/github.com/google/gopacket/pcap/pcap.go:546:41: identifier "_Ctype_struct_bpf_insn" may conflict with identifiers generated by cgo
vendor/github.com/google/gopacket/pcap/pcap.go:618:66: identifier "_Ctype_struct_bpf_program" may conflict with identifiers generated by cgo
vendor/github.com/google/gopacket/pcap/pcap.go:631:19: identifier "_Ctype_struct_bpf_insn" may conflict with identifiers generated by cgo
vendor/github.com/google/gopacket/pcap/pcap.go:741:34: identifier "_Ctype_struct_pcap_addr" may conflict with identifiers generated by cgo
vendor/github.com/google/gopacket/pcap/pcap.go:744:56: identifier "_Ctype_struct_pcap_addr" may conflict with identifiers generated by cgo
make: *** [build] Error 2

go version go1.12.4 darwin/amd64 from homebrew

@KnightSec-Official
Copy link

same porblem with make

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants