Advertisement
kpskps

Untitled

Oct 13th, 2018
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. from selenium import webdriver
  2. from selenium.webdriver.chrome.options import Options
  3. import zipfile
  4.  
  5. server = "162.219.176.20"
  6. manifest_json = """
  7. {
  8. "version": "1.0.0",
  9. "manifest_version": 2,
  10. "name": "Chrome Proxy",
  11. "permissions": [
  12. "proxy",
  13. "tabs",
  14. "unlimitedStorage",
  15. "storage",
  16. "<all_urls>",
  17. "webRequest",
  18. "webRequestBlocking"
  19. ],
  20. "background": {
  21. "scripts": ["background.js"]
  22. },
  23. "minimum_chrome_version":"22.0.0"
  24. }
  25. """
  26.  
  27. background_js = """
  28. var config = {
  29. mode: "fixed_servers",
  30. rules: {
  31. singleProxy: {
  32. scheme: "http",
  33. host: "162.219.176.20",
  34. port: parseInt(80)
  35. },
  36. bypassList: ["foobar.com"]
  37. }
  38. };
  39.  
  40. chrome.proxy.settings.set({value: config, scope: "regular"}, function() {});
  41.  
  42. function callbackFn(details) {
  43. return {
  44. authCredentials: {
  45. username: "xxx",
  46. password: "xxx"
  47. }
  48. };
  49. }
  50.  
  51. chrome.webRequest.onAuthRequired.addListener(
  52. callbackFn,
  53. {urls: ["<all_urls>"]},
  54. ['blocking']
  55. );
  56. """
  57.  
  58.  
  59. pluginfile = 'proxy_auth_plugin.zip'
  60.  
  61. with zipfile.ZipFile(pluginfile, 'w') as zp:
  62. zp.writestr("manifest.json", manifest_json)
  63. zp.writestr("background.js", background_js)
  64.  
  65. co = Options()
  66. # co.add_argument("--start-maximized")
  67. co.add_extension(pluginfile)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement