packet.proxy-plugins icon indicating copy to clipboard operation
packet.proxy-plugins copied to clipboard

OnPacket conflict between gopacket.example.go and tls.downgrade.go

Open monyettenyom opened this issue 4 years ago • 13 comments

Hey all, so I did build two paket.proxy-plugins you had provided, which are gopacket.example.go and tls.downgrade.go.

tls.downgrade.go is fixed by @buffermet . Thanks, boss!

gopacket.example.go and tls.downgrad.go were built successfully.

But as I tried to build bettercap with this: make build

I got these: go build -o bettercap . ./tls.downgrade.go:74:6: OnPacket redeclared in this block previous declaration at ./gopacket.example.go:11:41 make: *** [Makefile:10: build] Error 2

What did I do wrong?

Environment: OS version and architecture you are using: Kali GNU/Linux Rolling 2019.4 Go version if building from sources: go version go1.13.4 linux/amd64

monyettenyom avatar Nov 28 '19 12:11 monyettenyom

In which directory did you place and build the tls.downgrade.go file?

buffermet avatar Nov 28 '19 12:11 buffermet

Go plugins for the packet.proxy module should be built in the $GOPATH/src/github.com/bettercap/bettercap directory.

buffermet avatar Nov 28 '19 12:11 buffermet

Also, if I didn't misunderstand, I have to pull the source code with: go get -u github.com/bettercap/bettercap The plugins should be downloaded directly in the folder, right? Or did I misunderstand? Please tell me step by step how to download and install bettercap with the plugins, I'm very confused because of too many steps I have to do.

monyettenyom avatar Nov 28 '19 12:11 monyettenyom

I did both sample steps I found on this: https://www.bettercap.org/installation/

I downloaded the source code and its dependencies, just like the steps "Compiling from sources"

Because I got problems with downloading the dependencies, I have done the steps "Linux deploy method" At the end of the step of Linux deploy method, I got problem with packet proxy plugins. I downloaded the plugins independently and changed the lines, just like you had suggested this morning west Europe time. And then I compiled the plugins independently. I had no problem with compiling the plugins.

Soon as I tried to compile bettercap, I got the error message.

I mixed up the steps, I know. How can I undo this?

monyettenyom avatar Nov 28 '19 13:11 monyettenyom

The plugins are in the bettercap/packet.proxy-plugins repository. You can clone it with git or go get.

To install a packet.proxy plugin, you have to build it yourself inside bettercap's source directory at $GOPATH/src/github.com/bettercap/bettercap.

Follow the build instructions from the documentation and you will find a new .so file in bettercap's source directory. Set this file's path as the value of bettercap's packet.proxy.plugin environment variable. Then you can start using the packet.proxy module.

buffermet avatar Nov 28 '19 13:11 buffermet

You still had the gopacket.example.go file in bettercap's source directory when you tried to build bettercap.

buffermet avatar Nov 28 '19 13:11 buffermet

Should I delete the gopacket.example.go?

monyettenyom avatar Nov 28 '19 13:11 monyettenyom

~~You should only have 1 packet.proxy .go plugin file in the source directory, otherwise compilation fails.~~ You shouldn't have any packet.proxy .go files in the source directory when you build bettercap in case of duplicate declarations.

buffermet avatar Nov 28 '19 13:11 buffermet

I can't find the bettercap folder.

locate bettercap /usr/lib/libettercap.so /usr/lib/libettercap.so.0 /usr/lib/libettercap.so.0.0.0 /usr/share/icons/hicolor/16x16/apps/kali-bettercap.png /usr/share/icons/hicolor/22x22/apps/kali-bettercap.png /usr/share/icons/hicolor/24x24/apps/kali-bettercap.png /usr/share/icons/hicolor/256x256/apps/kali-bettercap.png /usr/share/icons/hicolor/32x32/apps/kali-bettercap.png /usr/share/icons/hicolor/48x48/apps/kali-bettercap.png /usr/share/kali-menu/applications/kali-bettercap.desktop

monyettenyom avatar Nov 28 '19 13:11 monyettenyom

It's in your $GOPATH folder..

Can you please give us the output of which bettercap?

buffermet avatar Nov 28 '19 13:11 buffermet

root@lenovo:~# ls 1 capture-01.kismet.netxml ettercaplog Pictures bettercap.history capture-01.log.csv getmecamtool Public build Desktop go Templates capture-01.cap Documents hashcat Videos capture-01.csv Downloads intel wget-log capture-01.kismet.csv dsniff.services Music wget-log.1 root@lenovo:~# cd go root@lenovo:~/go# ls bin pkg src root@lenovo:~/go# cd bin root@lenovo:~/go/bin# ls bettercap root@lenovo:~/go/bin# which bettercap root@lenovo:~/go/bin#

monyettenyom avatar Nov 28 '19 14:11 monyettenyom

Your go path is in your home folder, so you can find bettercap's source folder at ~/go/src/github.com/bettercap/bettercap.

buffermet avatar Nov 28 '19 15:11 buffermet

I've installed successfully, thanks a lot. I've found the tls.downgrade.so, which I had compiled and I found bettercap folder in the github.com folder. I ran make build and make install in the folder and bettercap is installed.

output of which bettercap is now: root@lenovo:~# which bettercap /usr/local/bin/bettercap

monyettenyom avatar Dec 03 '19 10:12 monyettenyom