BASH   76

client

Guest on 25th April 2022 12:10:00 PM

  1. #!/bin/bash
  2. #Configure me
  3. cgi_server="www.mywebserver.com"
  4. cgi_server_port=80
  5. cgi_uri="/cgi-bin/ssh.cgi"
  6. cgi_max_content=1000000000
  7. proxy_host="squid.acme.com"
  8. proxy_port="3128"
  9. # Proxies sometimes virus scan content. this means they won't allow streaming
  10. # however they often exempt certain common mime-types from scanning in order
  11. # to allow streaming media to work. We need streaming in order for this to work
  12. # so set a mime type that works. Try them all.. try different ones.. try
  13. # making one up.
  14. pretend_content=video/avi
  15. pretend_content=video/x-ms-asf
  16. pretend_content=video/x-ms-wm
  17. pretend_content=video/x-ms-wmx
  18. pretend_content=video/msvideo
  19. pretend_content=video-x-msvideo
  20. pretend_content=video/xmpg2
  21. pretend_content=application/x-troff-msvideo
  22. pretend_content=audio/avi
  23. pretend_content=audio/asf
  24. pretend_content=audio/vnd.rn-realaudio
  25. # Set the User-Agent header
  26. ua_get="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
  27. ua_post="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
  28. # Padding to get things kicked off
  29. padding=4096
  30.  
  31. # Shouldn't need editing after here.
  32.  
  33. host=$1
  34.  
  35. cgi_url="http://${cgi_server}:${cgi_server_port}${cgi_uri}"
  36. # Are we using a proxy? Or just directly connecting to an http server?
  37. if [ ! -z "${proxy_host}" ];
  38. then
  39.         connect_url=${cgi_url}
  40.         connect_to=${proxy_host}
  41.         connect_port=${proxy_port}
  42.         proxyopts="-x ${proxy_host}:${proxy_port}"
  43. else
  44.         connect_url=${cgi_uri}
  45.         connect_to=${cgi_server}
  46.         connect_port=${cgi_server_port}
  47.         proxyopts=
  48. fi
  49.  
  50. sessionkey="/tmp/sessionkey.$$"
  51. if [ -f "${sessionkey}" ];
  52. then
  53.         echo "Session ${sessionkey} exists! stale?"
  54.         exit 1;
  55. fi
  56.  
  57. touch "${sessionkey}"     # create the sessionkey file
  58. chmod 600 "${sessionkey}" # secure the sessionkey file

Raw Paste


Login or Register to edit or fork this paste. It's free.