GijsTimmers / kotnetcli

An easy automated way to log in on Kotnet.
GNU General Public License v3.0
5 stars 4 forks source link

Fix kotnetcli logout on a device with a different IP address #45

Closed KevinMordijck closed 8 years ago

KevinMordijck commented 9 years ago

kotnetcli -o works fine when it is run on a computer who is logged in. BUT when I run it on another machine who wants to be online then the next error appears

$ ./kotnetcli -o
ik haal de credentials uit de keyring
ik wil vrolijke kleuren
ik wil uitloggen
Netlogin openen....... [ OK ]
Gegevens invoeren..... [ OK ]
Gegevens opsturen..... [ OK ]
$ ./kotnetcli
ik haal de credentials uit de keyring
ik wil vrolijke kleuren
ik wil inloggen
Netlogin openen....... [ OK ]
KU Leuven kiezen...... [ OK ]
Gegevens invoeren..... [ OK ]
Gegevens opsturen..... [ OK ]
Traceback (most recent call last):
  File "/kotnetcli/kotnetcli.py", line 220, in <module>
    aanstuurderObvArgumenten(argumentenParser())
  File "/kotnetcli/kotnetcli.py", line 206, in aanstuurderObvArgumenten
    main(co, gebruikersnaam, wachtwoord, actie="inloggen")
  File "/kotnetcli/kotnetcli.py", line 46, in main
    kl.tegoeden()
  File "/kotnetcli/worker.py", line 90, in tegoeden
    self.downloadpercentage = int(zoekresultaten[0]\
IndexError: list index out of range
GijsTimmers commented 9 years ago

KotNet allows only one IP address to be online per account.

What happens here?

kotnetcli tries to log you out on the computer you're using. That is, it says to KotNet: "Can you log user A out off IP B?" where B is the IP of the computer you're using.

This works, but you're still logged in on the other device. The only way to log yourself off the other device is by logging in; KotNet will show you a message that user A is logged in on IP C.

So to overcome this, we have to change the IP address in the KotnetLoguit() class. A way of doing this would be:

$ ./kotnetcli --force-login
ik haal de credentials uit de keyring
ik wil vrolijke kleuren
ik wil mijn tweede adres weten
Netlogin openen....... [ OK ]    ## Login procedure, to get your other IP address.
Gegevens invoeren..... [ OK ]     
Gegevens opsturen..... [ OK ]    
IP opzoeken............[ OK ]   
Netlogin openen....... [ OK ]    ## Logout procedure, to log yourself off the other 
Gegevens invoeren..... [ OK ]    ## IP address.
Gegevens opsturen..... [ OK ]
Uitloggen afronden.... [ OK ]
Netlogin openen....... [ OK ]    ## Conventional login procedure
Gegevens invoeren..... [ OK ]
Gegevens opsturen..... [ OK ]
Download:  [========= ][ 93%]
Upload:    [==========][100%]
GijsTimmers commented 9 years ago

OK, please git pull and test if it works now.

GijsTimmers commented 9 years ago

Does this bug still occur?