src/net/sourceforge/kolmafia/request/LoginRequest.java
/** Handles the challenge in order to send the password securely via KoL. */
Handles the challenge in order to send the password securely via KoL.
Handles the challenge in order to send the password securely via KoL .
private boolean detectChallenge() {
    GenericRequest.applySettings();
    if (true) {
      return false;
    }
    KoLmafia.updateDisplay("Validating login server (" + GenericRequest.KOL_HOST + ")...");
    GenericRequest.reset();
    this.clearDataFields();
    super.run();
    if (KoLmafia.refusesContinue()) {
      return false;
    }
    Matcher challengeMatcher = LoginRequest.CHALLENGE_PATTERN.matcher(this.responseText);
    if (!challengeMatcher.find()) {
      return false;
    }
    Matcher playersMatcher = LoginRequest.PLAYERS_PATTERN.matcher(this.responseText);
    if (playersMatcher.find()) {
      LoginRequest.playersOnline = StringUtilities.parseInt(playersMatcher.group(1));
      KoLmafia.updateDisplay(LoginRequest.playersOnline + " players online.");
    }
    if (Preferences.getBoolean("showAnnouncements")
        && !Preferences.getBoolean("_announcementShown")) {
      Matcher announceMatcher = LoginRequest.ANNOUNCE_PATTERN.matcher(this.responseText);
      if (announceMatcher.find()) {
        String announcement = announceMatcher.group(1);
        if (announcement.contains("<img")) {
          AnnouncementFrame.showRequest(announcement);
        }
      }
    }
    String challenge = challengeMatcher.group(1);
    String response;
    try {
      response = LoginRequest.digestPassword(password, challenge);
    } catch (Exception e) {
      return false;
    }
    this.constructURLString("login.php");
    this.addFormField("password", "");
    this.addFormField("challenge", challenge);
    this.addFormField("response", response);
    this.addFormField("secure", "1");
    return true;
  }
private boolean detectChallenge ( ) { GenericRequest . applySettings ( ) ; if ( true ) { return false ; } KoLmafia . updateDisplay ( "Validating login server (" + GenericRequest . KOL_HOST + ")..." ) ; GenericRequest . reset ( ) ; this . clearDataFields ( ) ; super . run ( ) ; if ( KoLmafia . refusesContinue ( ) ) { return false ; } Matcher challengeMatcher = LoginRequest . CHALLENGE_PATTERN . matcher ( this . responseText ) ; if ( ! challengeMatcher . find ( ) ) { return false ; } Matcher playersMatcher = LoginRequest . PLAYERS_PATTERN . matcher ( this . responseText ) ; if ( playersMatcher . find ( ) ) { LoginRequest . playersOnline = StringUtilities . parseInt ( playersMatcher . group ( 1 ) ) ; KoLmafia . updateDisplay ( LoginRequest . playersOnline + " players online." ) ; } if ( Preferences . getBoolean ( "showAnnouncements" ) && ! Preferences . getBoolean ( "_announcementShown" ) ) { Matcher announceMatcher = LoginRequest . ANNOUNCE_PATTERN . matcher ( this . responseText ) ; if ( announceMatcher . find ( ) ) { String announcement = announceMatcher . group ( 1 ) ; if ( announcement . contains ( "<img" ) ) { AnnouncementFrame . showRequest ( announcement ) ; } } } String challenge = challengeMatcher . group ( 1 ) ; String response ; try { response = LoginRequest . digestPassword ( password , challenge ) ; } catch ( Exception e ) { return false ; } this . constructURLString ( "login.php" ) ; this . addFormField ( "password" , "" ) ; this . addFormField ( "challenge" , challenge ) ; this . addFormField ( "response" , response ) ; this . addFormField ( "secure" , "1" ) ; return true ; }
Handles the challenge in order to send the password securely via KoL.
Handles the challenge in order to send the password securely via KoL .
// Setup the login server in order to ensure that // the initial try is randomized.  Or, in the case // of a devster, the developer server. // if ( Preferences.getBoolean( "useSecureLogin" ) ) // If the pattern is not found, then do not submit // the challenge version. // We got this far, so that means we now have a challenge // pattern. // An exception means bad things, so make sure to send the // original plaintext password.