chrsep / Kingfish

Portal for Binusmaya v0.3 and up
http://goo.gl/oqjjUE
GNU General Public License v3.0
26 stars 10 forks source link

Remove captcha, causes failed login #16

Closed chrsep closed 7 years ago

chrsep commented 7 years ago

Due to the fact that Binusmaya requires captcha to login, Portal now introduces captcha on every update. The spawning of captcha can be minimized (by only showing it when user is not yet considered logged in) or removed entirely (by automatically reding the image, and filling the answer), although all of this will require quite a lot of work.

This will enable device testing using firebase, auto update, and various other stuff.

mstephen77 commented 7 years ago

Might as well leave it be... I've heard they're planning on implementing Google's reCAPTCHA.

chrsep commented 7 years ago

I see.... Well if that's the case, it's probably going to kill Portal for good. I guess we'll see.

felixlix45 commented 7 years ago

Captcha is already removed from Binusmaya and now portal error

chrsep commented 7 years ago

Curious.... Hopefully they didn't just implemented Google's invisible reCaptcha, that would be a big problem for us. I'll look into this later today.

mstephen77 commented 7 years ago

Binusmaya login changes summary:

  1. Get HTML source of https://binusmaya.binus.ac.id/login/index.php
  2. Use regex to search for something like src="../login/loader.php?serial=(serial here)" (should be under <head>)
  3. Do a GET request to the script source
  4. Build the request as follows:
    • Find the input for username and use the HTML element's name for username
    • Find the input for password and use the HTML element's name for password
    • 2 extra hidden input from loader.php
    • The Login button
    • For element's name, be careful of HTML's character encoding (%2F becomes '/', %3D becomes '=')

I didn't really have the time to check it out before, so sorry for my late info.

mstephen77 commented 7 years ago

Request example (and a successful login): image

chrsep commented 7 years ago

Thx @mstephen77 , that is an awful lot of randomized fields, at least it can still be bypassed though. Sorry for my delayed response, apparently i haven't got time to work on this on the last few days, I'll try to implement this today.

chrsep commented 7 years ago

It seems to be fixed on my end, i'll be publishing this to play store's alpha channel first to see if there is still any problem

chrsep commented 7 years ago

now published to alpha, together with a couple of other fixes.

mstephen77 commented 7 years ago

I've just noticed, but failing to login a few times would then have Google's reCaptcha

chrsep commented 7 years ago

Yes, i tried to prevent it from ever appearing by asking for a new cookie every time portal tries to login, it seems to work for now. I don't know if that can be a permanent solution though.

chrsep commented 7 years ago

There still seems to be a significant number of failed login attempt, i'm still gathering more data to understand why.

mstephen77 commented 7 years ago

Are you sure those failed attempts are the ones using Portal's alpha build? As far as I know, Portal has yet to be updated in Play Store. I'm using alpha channel and there's no problem whatsoever thus far.

chrsep commented 7 years ago

It probably exist in every build. Only half of the people signing in is successful. I'm releasing this update first on alpha just to make sure nothing bad happens from it. I'll release it to production soon.

These updates doesn't actually contains any fix yet by the way. It just added some more analytics to gather more data about any error or crashes that happens, using fabric and firebase. I have an idea about what might be the cause (something about accessing an empty list), but i am not really sure about the best way to fix it yet, since this works on mine and my friends's accounts.

chrsep commented 7 years ago

There are two causes of failed logins that i can see.

  1. Caused by Binusmaya giving out no term data, which is required for fetching pretty much everything other than the normal schedule. This causes IndexOutOfBoundException as seen here: http://crashes.to/s/d143134645c . I think this might be happening to new students only and might be resolved when next semester actually starts.

  2. The other one is a bit more problematic, 2017-08-13 1 http://crashes.to/s/dc23f10f228 The login is successful based on the logs, but one of the data that is returned by Binusmaya is not in it's usual format, this creates an IOException when Portal tries to turn that data (which is expected to be in JSON format) into the object that will be saved into the database. I'll probably need to refactor the data calls to figure out how to fix this, since i will need to figure out which call to the binusmaya server is making this problem. I can't track individual calls now because a lot of the calls are started and cancelled together. I'll try to work on this once i find some time.

chrsep commented 7 years ago

New update is being rolled out to alpha, most of Portal's code has been rewritten to follow the MVP-clean architecture. Course Resources is removed for now because i haven't got time to rewrite it, it currently cause some crashes. The problem with login should be fixed, and journal and finance should be working for everyone, not sure about grades though.

Been working on this for 2 weeks, there is a lot of changes to how portal works, it almost like a full rewrite, i think there might be some bug that i didn't catch.

chrsep commented 7 years ago

Login now seems to be successful. If there are any errors during data fetching, it's now handled in the MainActivity.