Skip to content

Commit

Permalink
Proxy support in browserprtauth
Browse files Browse the repository at this point in the history
  • Loading branch information
wrauner committed Apr 14, 2023
1 parent be750d2 commit 32d5291
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion roadtx/roadtools/roadtx/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,9 @@ def main():
browserprtauth_parser.add_argument('--capture-code',
action='store_true',
help='Do not attempt to redeem any authentication code but print it instead')
browserprtauth_parser.add_argument('--proxy',
action='store',
help='Proxy to use with the browser (HTTP and HTTPS protocols), e.g. socks://proxy:port or http://proxy:port')

# Interactive auth using Selenium - inject PRT to other user
injauth_parser = subparsers.add_parser('browserprtinject', help='Selenium based auth with automatic PRT injection. Can be used with other users to add device state to session')
Expand Down Expand Up @@ -586,7 +589,7 @@ def main():
else:
print('You must either supply a PRT and session key on the command line or a file that contains them')
return
selauth = SeleniumAuthentication(auth, deviceauth, args.redirect_url)
selauth = SeleniumAuthentication(auth, deviceauth, args.redirect_url, proxy=args.proxy)
if args.auth_url:
url = args.auth_url
else:
Expand Down
4 changes: 2 additions & 2 deletions roadtx/roadtools/roadtx/selenium.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def get_webdriver(self, service, intercept=False):
if self.proxy:
options = {
'proxy': {
'http': f'http://{self.proxy}',
'https': f'https://{self.proxy}',
'http': self.proxy,
'https': self.proxy,
'no_proxy': 'localhost,127.0.0.1'
}
}
Expand Down

0 comments on commit 32d5291

Please sign in to comment.