stardance has been extended another month! the new deadline is october 31 :)

You are browsing as a guest. Sign up (or log in) to start making projects!

AlternativeLink

  • 6 Devlogs
  • 31 Total hours

Implementation of the SharkLink protocol for PC and other devices. SharkLink was created by Hak5 to check if two Shark Jack Display can connect in a Network.

Ship #1 Pending review

AlternativeLink

This project implements the SharkLink Protocol making it compatible with the Shark Jack Display by Hak5.

This ship is for the underlying core lib in combination with the CLI.

CLI

The CLI tool provides a quick and easy way to use any pc in combination with the Shark Jack Display.

Using the -h/--help flags this help message is printed:

Rust implementation for SharkLink

Usage: alternative-link-cli.exe [OPTIONS] --interface <INTERFACE>

Options:
  -i, --interface <INTERFACE>
          Interface IP to bind to (skips interactive picker)
  -p, --port <PORT>
          UDP port to use [default: 1337]
  -c, --code <CODE>
          Shared room/pairing code [default: 1-3-3-7]
      --broadcast-interval <BROADCAST_INTERVAL>
          Broadcast interval in seconds [default: 5]
      --auto-test
          Run non-interactively: auto-test connection as soon as a peer is found. If this is not set after receiving a Ping and sending the Ack the program closes
      --no-stop
          Prevents the program from automatically stopping (you will need to manually kill the program if this is set)
  -v...
          Increase log verbosity (-v -vv)
      --json
          Emit machine-readable JSON status lines instead of prose
      --max-direct-tries <MAX_DIRECT_TRIES>
          Maximum retries for the direct connection test [default: 20]
  -h, --help
          Print help
  -V, --version
          Print version

Development

The first prototype was developed in python using package inspection with wireshark. After refining that prototype, I wrote a first all in one (file) interactive version of that prototype using rust.

Then I found out that the SharkLink tool on the Shark Jack Display a bash script is. (I never looked at it properly but just found out that I accidentally implemented a similar control flow using python and rust)

After that I split the project into the cargo workspace structure with one lib and cli crates.

Now I have started developing an interactive version but more close to original.

Trying it

The README on GitHub details how to run it on windows. This is because I have only tested it in these combinations.

But it should work everywhere because I haven’t used anything os specific and tested it on wsl.

  • 6 devlogs
  • 31h
Try project → See source code →
Open comments for this post

5h 42m 3s logged

Devlog 6:

Finaly finished the CLI. Over the past hours I have improved my code a lot. By making it automaticly terminate if it gets pinged and adding the --no_stop flag to prevent automatic closing.

Next up:

Shipping it and maybe after getting some feedback improving it.

0
0
30
Open comments for this post

9h 3m 35s logged

Devlog 5:

I finally did it! It’s now a cli tool!

What changed:

It’s a Cli. So, to use it just try the --help/-h flag to get the usage.

Also, I restructured the project into a core lib and the cli bin crates using a cargo workspace. This should allow me to more easily develop the Tui later.

I also set up two github workflows, one that audits my used packages using the actions-rust-lang/audit action. The other one builds me the cli for a lot of different targets using the dtolnay/rust-toolchain action.

I also started writing some instructions to try the project, but this is still an area of active development.

Next up

I defiantly need to document the protocol that I’m using.

Also, as I have mentioned I want to create a tui. Maybe later a gui would be a great addition but that’s something I’m not quite sure about.

1
0
43
Open comments for this post

3h 15m 49s logged

Devlog 4: (Now with logging)

What change

  • Rewrote a lot of the logic making it safer
  • Added a timeout for pinging
  • Added a Code struct which has TryFrom<&str> and std::fmt::Display implemented so it’s really easy to convert a code string to the code structure and back
  • added logging with tracing
  • Combined both sending sockets to one Arc<UdpSocket> so broadcaster and direct connection check share one socket reducing overhead
  • Changed how I handle Errors, no longer ignoring them

Next up:

  • Cli
  • Maybe a tui
0
0
14
Open comments for this post

7h 29m 35s logged

Devlog 2:

I started reimplementing everything in rust. Already have the discovery broadcast and listener working.
So the only things missing are the direct connection check from the program site and a better looking interface like a tui.

0
0
10
Open comments for this post

2h 44m 54s logged

Devlog 1:

So I reverse engineered the protocol hak5 uses for SharkLink using one SharkJack Display and my PC with Wireshark for package inspection.

I first needed to implement the device discovery which is a broadcast UDP package which in plan text says <PIN> <Sender_Ip>\n so for example 1-3-3-7 192.168.178.1\n

Then I reverse engineered the ping messages which are a direct connection with first PING <Sender_IP>\n and then the response which is ACK <Sender_IP>\n.

Nextup:

Reimplement the program in rust and after that create a tui.

0
0
5

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…