Skip to content

Commit

Permalink
Fix ps script; Increase send delay
Browse files Browse the repository at this point in the history
  • Loading branch information
jamilbk committed Aug 9, 2024
1 parent 2209140 commit d5ee535
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/probe/live/component/run.ex
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ defmodule Probe.Live.Component.Run do

defp windows_cmd(token) do
~s"""
powershell -command "& { $start_url='#{url(~p"/runs/#{token}")}'; iwr -useb #{url(~p"/scripts/windows.ps1")} | iex }"
powershell -command "& { $start_url='#{url(~p"/runs/#{token}")}'; iwr -useb '#{url(~p"/scripts/windows.ps1")}' | iex }"
"""
end

Expand Down
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"geolix": {:hex, :geolix, "2.0.0", "7e65764bedfc98d08a3ddb24c417657c9d438eff163280b45fbb7de289626acd", [:mix], [], "hexpm", "8742bf588ed0bb7def2c443204d09d355990846c6efdff96ded66aac24c301df"},
"geolix_adapter_mmdb2": {:hex, :geolix_adapter_mmdb2, "0.6.0", "6ab9dbf6ea395817aa1fd2597be25d0dda1853c7f664e62716e47728d18bc4f9", [:mix], [{:geolix, "~> 2.0", [hex: :geolix, repo: "hexpm", optional: false]}, {:mmdb2_decoder, "~> 3.0", [hex: :mmdb2_decoder, repo: "hexpm", optional: false]}], "hexpm", "06ff962feae8a310cffdf86b74bfcda6e2d0dccb439bb1f62df2b657b1c0269b"},
"hackney": {:hex, :hackney, "1.20.1", "8d97aec62ddddd757d128bfd1df6c5861093419f8f7a4223823537bad5d064e2", [:rebar3], [{:certifi, "~> 2.12.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~> 6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~> 1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~> 1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.4.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~> 1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "fe9094e5f1a2a2c0a7d10918fee36bfec0ec2a979994cff8cfe8058cd9af38e3"},
"heroicons": {:git, "https://github.com/tailwindlabs/heroicons.git", "88ab3a0d790e6a47404cba02800a6b25d2afae50", [tag: "v2.1.1", sparse: "optimized"]},
"heroicons": {:git, "https://github.com/tailwindlabs/heroicons.git", "88ab3a0d790e6a47404cba02800a6b25d2afae50", [tag: "v2.1.1", sparse: "optimized", depth: 1]},
"hpax": {:hex, :hpax, "0.2.0", "5a58219adcb75977b2edce5eb22051de9362f08236220c9e859a47111c194ff5", [:mix], [], "hexpm", "bea06558cdae85bed075e6c036993d43cd54d447f76d8190a8db0dc5893fa2f1"},
"idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"},
"jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"},
Expand Down
8 changes: 5 additions & 3 deletions priv/static/scripts/unix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

payload_interval=0.2
payload_interval=1.0

# Check for required commands
for cmd in base64 sleep curl; do
Expand Down Expand Up @@ -79,7 +79,7 @@ send_payload() {
payload="$1"

# Loop to send the payload
for i in 1 2 3; do
for i in 1 2 3 4 5; do
echo "$payload" | base64 "$base64_option" | $nc_cmd $nc_options "$host" "$port"
sleep $payload_interval
done
Expand Down Expand Up @@ -119,7 +119,7 @@ fi

echo "Running test against port $port..."

# Run the test, sending each payload 3 times. It's UDP, after all.
# Run the test, sending each payload 5 times. It's UDP, after all.
send_payload "$hs_init"
send_payload "$turn_hs_init"
send_payload "$hs_response"
Expand All @@ -130,6 +130,8 @@ send_payload "$data_message"
send_payload "$turn_data_message"

echo ""
echo "Waiting for test to complete..."
sleep 5
echo ""

curl -sL -H 'Accept: text/plain' -XPOST "$run_url/complete"
Expand Down
5 changes: 3 additions & 2 deletions priv/static/scripts/windows.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# This script is intended to run from https://probe.sh and requires a valid
# token to start. NOTE: Unfortunately only IPv4 is supported at this time.

$payload_interval = 200
# Separate packets by 1 second
$payload_interval = 1000

# Function to send payloads
function Send-Payload {
Expand All @@ -11,7 +12,7 @@ function Send-Payload {
[int]$port
)

for ($i = 0; $i -lt 3; $i++) {
for ($i = 0; $i -lt 5; $i++) {
$udpClient = New-Object System.Net.Sockets.UdpClient
$bytes = [System.Convert]::FromBase64String($payload)
try {
Expand Down

0 comments on commit d5ee535

Please sign in to comment.