Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Adds --useragent parameter to send User-Agent http headers request.
In new web client somethink filter for User-Agent
  • Loading branch information
Cavva79 committed Apr 13, 2022
1 parent 39ddd00 commit 94ede80
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion snxconnect.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def open (self, filepart = None, data = None, do_soup = True) :
url = '/'.join (('%s:/' % self.args.protocol, self.args.host, filepart))
if data :
data = data.encode ('ascii')
rq = Request (url, data)
rq = Request (url, data, headers={'User-Agent': self.args.useragent})
self.f = f = self.opener.open (rq, timeout = 10)
if do_soup :
# Sometimes we get incomplete read. So we read everything
Expand Down Expand Up @@ -474,6 +474,11 @@ def main () :
' want a full path here'
, default = cfg.get ('snxpath', 'snx')
)
cmd.add_argument \
( '-u', '--useragent'
, help = 'User-Agent to be passed to Checkpoint Portal, default="%(default)s"'
, default = cfg.get ('useragent', 'Mozilla/5.0 (X11; Linux x86_64; rv:100.0) Gecko/20100101 Firefox/100.0')
)
cmd.add_argument \
( '-U', '--username'
, help = 'Login username, default="%(default)s"'
Expand Down

0 comments on commit 94ede80

Please sign in to comment.