Skip to content

Instantly share code, notes, and snippets.

import subprocess
import os
import re
import requests
from bs4 import BeautifulSoup
def run_command(command):
result = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
return result.stdout, result.stderr, result.returncode
@jacobthebanana
jacobthebanana / curl_check_socks5.sh
Created May 18, 2021 09:36
HAProxy external-check script for load-balancing SOCKS5 backends
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
RealServerIP=$3
RealServerPort=$4
CHECK_URL="1.0.0.1/cdn-cgi/trace"
CHECK_STRING="warp=off"
curl -m 2 -k $CHECK_URL -x socks5://$RealServerIP:$RealServerPort 2>/dev/null | grep -q "${CHECK_STRING}"
exit $?