Skip to content

Instantly share code, notes, and snippets.

@SomajitDey
Last active April 17, 2021 07:14
Show Gist options
  • Save SomajitDey/871007c4f0d840bb2d94605a0b1f66b7 to your computer and use it in GitHub Desktop.
Save SomajitDey/871007c4f0d840bb2d94605a0b1f66b7 to your computer and use it in GitHub Desktop.
exploit streambin.pbedat.de with cURL for instant messaging to remote-access

How to use streambin for event-based workflow : pubsub (publish/subscribe) model

Push based workflow is more efficient than repeated pulls (polling). Thankfully, there is currently a free service for the same which is easy to use : https://streambin.pbedat.de/. There is also emitter.io and free, public MQTT brokers such as broker.hivemq.com (list).

  1. Create a unique channel-key - it may be the hash of your email id or the hash of your MAC address, or may even be the fingerprint of freshly generated private-public keypair.

  2. url="https://streambin.pbedat.de/streams/${channel_key}"
  3. Create the channel

    curl -N "${url}" &>/dev/null &
  4. Subscribe to it and filter the stream

    curl -N -sf "${url}/out" | grep --line-buffered ^data: | stdbuf -oL cut -d ' ' -f 2- | grep --line-buffered -v ^hello$
  5. Publish:

    curl --header "Content-Type: application/json" --request POST \
    --data '{ "type": "my-event", "data": "your_message"}' "${url}/in"

Or, use a file to store the payload:

message=<your_message>
file=<path_to_payload_file>
echo "{\"data\":\"${message}\"}" > ${file}

Then POST:

curl --header "Content-Type: application/json" --request POST \
--data @"${file}" "${url}/in"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment