Skip to content

Instantly share code, notes, and snippets.

@Erotemic
Created May 7, 2024 01:34
Show Gist options
  • Save Erotemic/948ec634c2de011b22e5b0d30af3d957 to your computer and use it in GitHub Desktop.
Save Erotemic/948ec634c2de011b22e5b0d30af3d957 to your computer and use it in GitHub Desktop.
pac-file-reproduce.sh
exact_steps_taken(){
DOMAIN=mlb.com
echo "DOMAIN = $DOMAIN"
nslookup "$DOMAIN"
DOMAIN_ADDRESS=34.102.169.19
echo "DOMAIN_ADDRESS = $DOMAIN_ADDRESS"
echo '
function FindProxyForURL(url, host)
{
var socks_proxy = "SOCKS 127.0.0.1:8080";
if (shExpMatch(host, "*.$DOMAIN")) {
return socks_proxy;
}
return "DIRECT";
}
' > "$HOME"/proxy.pac
cat "$HOME"/proxy.pac
echo "
file://$HOME/proxy.pac
"
# Set in the network manager point at the PAC file
gsettings set org.gnome.system.proxy autoconfig-url "file://$HOME/proxy.pac"
# In firefox do the same thing
# <requires manaual interaction>
# restart firefox
echo "
# Run these instructions on the proxy server
sudo tcpdump -n net $DOMAIN_ADDRESS
"
# Map our local port 8080 to the proxy
# set the proxy-ssh-id to the name of a machine to serve as the proxy in your ssh-config
PROXY_SSH_ID=ooo
ssh -D 8080 $PROXY_SSH_ID
# Navigating to the domain in firefox *should* trigger the PAC file to
# forward to the proxy, but that doesn't seem to be happening.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment