termshark icon indicating copy to clipboard operation
termshark copied to clipboard

MIPS support would be nice

Open joshhansen opened this issue 4 years ago • 6 comments

It would be nice to run termshark on my router which has visibility into my entire network in way my workstation doesn't. The router is a MIPS device so I tried using these instructions to build termshark for that architecture, but there seems to be a known issue with the termios dependency which doesn't build for MIPS.

I left a comment on that termios issue but there may be other dependencies with issues that just didn't show up since the termios error came up first. As my desire is to run termshark I figured I'd file a feature request here.

joshhansen avatar Apr 16 '20 01:04 joshhansen

Thanks for the request!

gcla avatar Apr 17 '20 21:04 gcla

Hi @joshhansen - I have termshark cross-compiled for MIPS and have it running under qemu. But termshark needs tshark to operate, and that piece I'm less sure about. Do you know if anyone has cross-compiled tshark for your router? If you can point me to it, I could keep hacking. There are some gloomy listserv messages about the high memory requirements of tshark, though they're a few years old: https://www.wireshark.org/lists/wireshark-dev/200905/msg00346.html

I'll post my steps for qemu. I'm a rookie with qemu so maybe there are simpler ways of accomplishing the same thing.

gcla avatar Apr 18 '20 02:04 gcla

My username is gcla, but of course substitute for your own :-)

  • clone https://github.com/gcla/term e.g. to /home/gcla/source/term
  • edit termshark's go.mod file and change
replace github.com/pkg/term => github.com/gcla/term v0.0.0-20191015020247-31cba2f9f402

to

replace github.com/pkg/term => /home/gcla/source/term
  • edit /home/gcla/source/termios/termios_linux.go and comment out Cfgetispeed and Cfgetospeed. Termshark will compile without them
  • in termshark's top-level dir, compile termshark something like this:
GOOS=linux GOARCH=mipsle GOMIPS=softfloat go install ./...
  • copy the binary in /home/gcla/go/bin/linux_mipsle to your router :-) Or:
  • download a qemu initramfs - I picked this one: https://archive.openwrt.org/chaos_calmer/15.05/malta/le/openwrt-15.05-malta-le-vmlinux-initramfs.elf
  • install qemu and run like this:
qemu-system-mipsel -kernel ~/Downloads/openwrt-15.05-malta-le-vmlinux-initramfs.elf -nographic -m 256 -net user,hostfwd=tcp::10022-:22 -net nic
  • set the root password at console; then scp termshark:
scp -v -P 10022 /home/gcla/go/bin/linux_mipsle/termshark root@localhost:./

If your router is big endian or then replace mipsle with mips above; or whatever the appropriate architecture is.

gcla avatar Apr 18 '20 02:04 gcla

Hi @joshhansen - could you tell me your router model?

gcla avatar Apr 21 '20 22:04 gcla

https://www.tp-link.com/us/home-networking/wifi-router/tl-wdr4300/

Apologies for not responding more thoroughly to your above messages. Hoping to make more time for this soon.

On Tue, Apr 21, 2020 at 3:16 PM Graham Clark [email protected] wrote:

Hi @joshhansen https://github.com/joshhansen - could you tell me your router model?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/gcla/termshark/issues/87#issuecomment-617442132, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFTFUU3XUJFCFGJH2CLMW3RNYLLZANCNFSM4MJAUGTQ .

joshhansen avatar Apr 22 '20 00:04 joshhansen

I ran into this as well on mips64 (big-endian) for Alpine Linux, but managed to get it to build.

The syscall package is marked as deprecated and the syscall.Termios struct lacks the Ispeed/Ospeed fields on mips(64).

To get it to build:

  • Use the original github.org/pkg/term module again
  • Update the github.org/pkg/term module to v1.1.0
  • Use golang.org/x/sys/unix.Termios in tty/tty.go

If this acceptable, I can create a pull request for this.

Ikke avatar Mar 17 '21 19:03 Ikke