Giter Club home page Giter Club logo

juniper-vpn-py's People

Contributors

ahoereth avatar arturoleaf avatar kriskwiatkowski avatar russdill avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

juniper-vpn-py's Issues

IndexError: list index out of range when executing

Hello I'm trying to execute the script to connect to my vpn and shows the following error:
------------>8------------------
Traceback (most recent call last):
File "./juniper-vpn.py", line 284, in
jvpn.run()
File "./juniper-vpn.py", line 123, in run
self.action_tncc()
File "./juniper-vpn.py", line 143, in action_tncc
self.cj.set_cookie(t.get_cookie(dspreauth_cookie, dssignin_cookie))
File "/home/usertest/Downloads/juniper-vpn-py-master/tncc.py", line 242, in get_cookie
data = self.get_msg_contents(response['msg'])
File "/home/usertest/Downloads/juniper-vpn-py-master/tncc.py", line 187, in get_msg_contents
compressed = msg_decoded[0x0ce4][0][0x0ce7][0]
IndexError: list index out of range
Terminated
--------------8<------------------------
I'm using Ubuntu 15 with python 2.7.10 any help with this?

add support for Juniper VPN profiles?

Our site uses Juniper VPN profiles to grant different levels of network access.

E.g., using this profile:

https://juniper-vpn.example.org/admins

…assigns me an address in a different subnet—one whose network ACLs grant access to more networks—than if I do not specify a profile name:

https://juniper-vpn.example.org/

juniper-vpn-py doesn't appear to have any support for profiles.

As a test, I attempted to simply insert the profile name into self.br.open() in the code. E.g.:

# Open landing page
self.r = self.br.open('https://' + self.args.host + '/admins')

…but this simplistic approach fails:

Password:Traceback (most recent call last):
  File "./juniper-vpn.py", line 370, in <module>
    jvpn.run()
  File "./juniper-vpn.py", line 177, in run
    self.action_login()
  File "./juniper-vpn.py", line 211, in action_login
    self.args.password = getpass.getpass('Password:')
  File "/usr/lib64/python2.7/getpass.py", line 71, in unix_getpass
    passwd = _raw_input(prompt, stream, input=input)
  File "/usr/lib64/python2.7/getpass.py", line 133, in _raw_input
    line = input.readline()
KeyboardInterrupt
Terminated

Am I missing something? Does juniper-vpn-py already have support for profiles, and I'm just not seeing it?

If not, if someone can point me in the direction of what needs to be done to support profiles, I will attempt to come up with a pull request to add profile support, as we need profile support for our VPN configuration.

Can't authenticate (but OpenConnect can)

Hi,
I'm trying to use this to pass host checker tests but not having much luck.
If I run, say..
./juniper-vpn.py --user-agent 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.75 Safari/537.36' --username username --host vpnhost connect tncc --stdin DSID=%DSID% openconnect --juniper %HOST% --cookie-on-stdin

It doesn't authenticate (the VPN host redirects to a url with "?p=failed" at the end), however I can run openconnect like so..
sudo openconnect -vv --dump-http-traffic --os=win --csd-wrapper=/tmp/testcsd --juniper https://vpnhost/dana-na/auth/url_16/welcome.cgi

and it DOES authenticate.. but I can't get past the host checker test with openconnect so I can't actually use the network.

Any suggestions?

Pending pull requests

There are a number of pull requests with useful features. Are they going to be merged and closed soon? Not to sound pushy ;)

Juniper + openconnect + tncc.py = stalled process

Hi,

I'm a bit stuck trying to connect to some Juniper VPN endpoint having the following setup : authentication with login/password and ssl client cert authentication. Hostchecker required.

Here is my launch command :

openconnect --juniper --debug -u <username> -c "pkcs11:model=eToken;id=%54%6f%6b%65%6e%5f%4b%65%79%5f%4e%6f%74%5f%56%69%73%69%62%6c%65%9e%50%44%c6%88%f8%ad%d8%cd%a2"   --useragent  'Mozilla/5.0 (Linux) Firefox' --csd-wrapper=./tncc.py  https://ive.host.com/myrealm

At this point, SSL authentication works perfectly, initial DSPREAUTH Cookie is received, tncc.py is launched in background then... nothing.

Stracing tncc.py shows that it is stalled in process_cmd function, awaiting command from openconnect

It seems that openconnect correctly launch csd-wrapper tncc.py but never talk to it.

Any hints ?

Add support to client certificates

Hi,

If after that line https://github.com/russdill/juniper-vpn-py/blob/master/juniper-vpn.py#L117 you add this code:

self.br.add_client_certificate('https://'
  + self.args.host,"/path/to/client/key.pem","/path/to/client/cert.pem")

Your python then add suppor to client certificates. Only need put pretty to set as options.

Note: Is important remove password in client key.

Furthermore, I think that do this:

while True:
  action = self.next_action()
  if action == 'tncc':
    self.action_tncc()
  elif action == 'login':
    self.action_login()
  elif action == 'key':
    self.action_key()
  elif action == 'continue':
    self.action_continue()
  elif action == 'connect':
    self.action_connect()

Is a problem because if your connection breaks in any moment after some hours connected, your cookie is invalid and cannot connect again, and the process is always trying reconnect. I add a break after self.action_connect() and use systemd to control process.

Unknown form type frm

I am getting the following error when running the script, any suggestions?

Traceback (most recent call last):
  File "./juniper-vpn.py", line 359, in <module>
    jvpn.run()
  File "./juniper-vpn.py", line 162, in run
    action = self.next_action()
  File "./juniper-vpn.py", line 155, in next_action
    raise Exception('Unknown form type:', form.name)
Exception: ('Unknown form type:', 'frm')

Python module

Hello Everyone,
When trying to run get this issue. Any help thank you.

[root@testvm ~]# python --version
Python 2.7.5
junos_connect.py --host vpn.myhost.com --user joeuser --stdin DSID=%DSID% openconnect --juniper %HOST% --cookie-on-stdin
Traceback (most recent call last):
  File "/bin/junos_connect.py", line 20, in <module>
    import tncc
  File "/usr/bin/tncc.py", line 14, in <module>
    ssl._create_default_https_context = ssl._create_unverified_context
AttributeError: 'module' object has no attribute '_create_unverified_context'

Support for 2FA via SMS/PIN

Hi There,

I can't seem to find a way to provide the PIN received via SMS when connecting to a Juniper Network 7.1--17-Build28099.

Could not find DSPREAUTH key for host checker

Hi.

I know this might not be a code issue, but I don know any other place to post it.

This is the output of what Iḿ running

./juniper-vpn.py --host vpn.company.net --username [email protected] --stdin DSID=%DSID% openconnect --juniper %HOST% --cookie-on-stdin

Traceback (most recent call last):
File "./juniper-vpn.py", line 362, in
jvpn.run()
File "./juniper-vpn.py", line 164, in run
self.action_tncc()
File "./juniper-vpn.py", line 180, in action_tncc
raise Exception('Could not find DSPREAUTH key for host checker')
Exception: Could not find DSPREAUTH key for host checker
Terminated

Can somebody guide me and how to get whatś missing here?

Thanks!

Fails to connect when there is a pre sign-in agreement

I was trying to connect to my school vpn but my school vpn has a page that loads that makes you agree to the usage agreement before the actual sign-in page loads. I tried connecting following instructions exactly but it raises an error. Here is the traceback:

Password:
Traceback (most recent call last):
File "./juniper-vpn.py", line 357, in
jvpn.run()
File "./juniper-vpn.py", line 165, in run
self.action_login()
File "./juniper-vpn.py", line 213, in action_login
self.br.form['username'] = self.args.username
File "/usr/lib/python2.7/dist-packages/mechanize/_form.py", line 2780, in setitem
control = self.find_control(name)
File "/usr/lib/python2.7/dist-packages/mechanize/_form.py", line 3101, in find_control
return self._find_control(name, type, kind, id, label, predicate, nr)
File "/usr/lib/python2.7/dist-packages/mechanize/_form.py", line 3185, in _find_control
raise ControlNotFoundError("no control matching "+description)
mechanize._form.ControlNotFoundError: no control matching name 'username'
Terminated

If there's anything else that needs to be provided for the issue to be resolved, I'd be happy to help. Thanks.

Periodic Host Checker

I have a problem with my VPN connection where I keep seeing it periodically disconnects (ESP detected dead peer) and automatically reconnects (at the level of openconnect, unrelated to the script). I'm wondering whether this could be because my VPN provider requires periodic Host Checker requests? (anyway to check if it does?) If so, then what should be the correct implementation to achieve this? I can code it myself if I understand the requirements.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.