Skip to content
Advertisement

Port Knocking UDP with Javascript in Browser

So I am trying to send a port knock sequence from javascript.

The TCP part is simple enough with websockets.

I’ve read that WebRTC is the closest thing the browser offers to sending a UDP packet… but WebRTC is a lot to digest just to attempt to send a UDP “knock”.

Is it even possible to “knock” via UDP using WebRTC? If so, please provide a simple example. I am just looking for a simplistic working example. I.e. to “knock” via TCP you can use the following:

JavaScript

Advertisement

Answer

It is in fact possible to send UDP packets with the browser.

You could either write a chrome extension (app) which would give you access to https://developer.chrome.com/apps/sockets_udp ("sockets": {...} in your manifest.json).

Or, as far as WebRTC goes:

JavaScript

And a quick ruby-script

require ‘socket’

JavaScript

[“x00x01x00x00!x12xA4B0PgJcgcqalrO”, [“AF_INET”, 51881, “192.168.0.27”, “192.168.0.27”]] 4 [“x00x01x00x00!x12xA4Bbmfxf2ABsZws”, [“AF_INET”, 53092, “192.168.0.27”, “192.168.0.27”]] 4 [“x00x01x00x00!x12xA4B0PgJcgcqalrO”, [“AF_INET”, 51881, “192.168.0.27”, “192.168.0.27”]] 4 [“x00x01x00x00!x12xA4Bbmfxf2ABsZws”, [“AF_INET”, 53092, “192.168.0.27”, “192.168.0.27”]]

I’m not sure though if that qualifies as “port knock sequence.”

Ref: https://www.webrtc-experiment.com/docs/webrtc-for-beginners.html

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement