Jump to content

Pin Code For H5


Recommended Posts

I think it will need a small addaption to l2j or the pack that you use..I found that on a russian forum .

39794700.png

 

 

 


SecondaryPasswordAuth.java

package l2p.gameserver.network;

import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Calendar;
import java.util.logging.Level;
import java.util.logging.Logger;

import jonelo.sugar.util.Base64;
import l2p.commons.dbutils.DbUtils;
import l2p.gameserver.Config;
import l2p.gameserver.database.DatabaseFactory;
import l2p.gameserver.model.Player;
import l2p.gameserver.network.GameClient;
import l2p.gameserver.serverpackets.Ex2ndPasswordAck;
import l2p.gameserver.serverpackets.Ex2ndPasswordCheck;
import l2p.gameserver.serverpackets.Ex2ndPasswordVerify;
import l2p.gameserver.utils.Log;
import l2p.gameserver.utils.Util;

public class SecondaryPasswordAuth
{
private final Logger _log = Logger.getLogger(SecondaryPasswordAuth.class.getName());
private final GameClient _activeClient;

private String _password;
private int _wrongAttempts;
private boolean _authed;

private static final String VAR_PWD = "secauth_pwd";
private static final String VAR_WTE = "secauth_wte";

private static final String SELECT_PASSWORD = "SELECT var, value FROM character_secondary_password WHERE account_name=? AND var LIKE 'secauth_%'";
private static final String INSERT_PASSWORD = "INSERT INTO character_secondary_password VALUES (?, ?, ?)";
private static final String UPDATE_PASSWORD = "UPDATE character_secondary_password SET value=? WHERE account_name=? AND var=?";
private static final String INSERT_ATTEMPT = "INSERT INTO character_secondary_password VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE value=?";
// private static final String BAN_ACCOUNT = "UPDATE accounts SET banExpires=? WHERE login=?";

/**
* @param activeClient
*/
public SecondaryPasswordAuth(GameClient activeClient)
{
_activeClient = activeClient;
_password = null;
_wrongAttempts = 0;
_authed = false;
loadPassword();
}

private void loadPassword()
{
String var, value = null;

Connection con = null;
PreparedStatement statement = null;
ResultSet rset = null;
try
{
con = DatabaseFactory.getInstance().getConnection();
statement = con.prepareStatement(SELECT_PASSWORD);
statement.setString(1, _activeClient.getLogin());
ResultSet rs = statement.executeQuery();
while(rs.next())
{
var = rs.getString("var");
value = rs.getString("value");

if(var.equals(VAR_PWD))
_password = value;
else if(var.equals(VAR_WTE))
_wrongAttempts = Integer.parseInt(value);
}
statement.close();
}
catch(Exception e)
{
_log.log(Level.SEVERE, "Error while reading password.", e);
}
finally
{
DbUtils.closeQuietly(con, statement, rset);
}
}

public boolean savePassword(String password)
{
if(passwordExist())
{
_log.warning("[secondaryPasswordAuth]" + _activeClient.getLogin() + " forced savePassword");
_activeClient.closeNow(true);
return false;
}

if(!validatePassword(password))
{
_activeClient.sendPacket(new Ex2ndPasswordAck(Ex2ndPasswordAck.WRONG_PATTERN));
return false;
}

password = cryptPassword(password);

Connection con = null;
PreparedStatement statement = null;
ResultSet rset = null;
try
{
con = DatabaseFactory.getInstance().getConnection();
statement = con.prepareStatement(INSERT_PASSWORD);
statement.setString(1, _activeClient.getLogin());
statement.setString(2, VAR_PWD);
statement.setString(3, password);
statement.execute();
statement.close();
}
catch(Exception e)
{
_log.log(Level.SEVERE, "Error while writing password.", e);
return false;
}
finally
{
DbUtils.closeQuietly(con, statement, rset);
}
_password = password;
return true;
}

public boolean insertWrongAttempt(int attempts)
{
Connection con = null;
PreparedStatement statement = null;
ResultSet rset = null;
try
{
con = DatabaseFactory.getInstance().getConnection();
statement = con.prepareStatement(INSERT_ATTEMPT);
statement.setString(1, _activeClient.getLogin());
statement.setString(2, VAR_WTE);
statement.setString(3, Integer.toString(attempts));
statement.setString(4, Integer.toString(attempts));
statement.execute();
statement.close();
}
catch(Exception e)
{
_log.log(Level.SEVERE, "Error while writing wrong attempts.", e);
return false;
}
finally
{
DbUtils.closeQuietly(con, statement, rset);
}
return true;
}

public boolean changePassword(String oldPassword, String newPassword)
{
if(!passwordExist())
{
_log.warning("[secondaryPasswordAuth]" + _activeClient.getLogin() + " forced changePassword");
_activeClient.closeNow(true);
return false;
}

if(!checkPassword(oldPassword, true))
return false;

if(!validatePassword(newPassword))
{
_activeClient.sendPacket(new Ex2ndPasswordAck(Ex2ndPasswordAck.WRONG_PATTERN));
return false;
}

newPassword = cryptPassword(newPassword);

Connection con = null;
PreparedStatement statement = null;
ResultSet rset = null;
try
{
con = DatabaseFactory.getInstance().getConnection();
statement = con.prepareStatement(UPDATE_PASSWORD);
statement.setString(1, newPassword);
statement.setString(2, _activeClient.getLogin());
statement.setString(3, VAR_PWD);
statement.execute();
statement.close();
}
catch(Exception e)
{
_log.log(Level.SEVERE, "Error while reading password.", e);
return false;
}
finally
{
DbUtils.closeQuietly(con, statement, rset);
}
_password = newPassword;
_authed = false;
return true;
}

public boolean checkPassword(String password, boolean skipAuth)
{
password = cryptPassword(password);

if(!password.equals(_password))
{
_wrongAttempts++;
if(_wrongAttempts < Config.SECOND_AUTH_MAX_ATTEMPTS)
{
_activeClient.sendPacket(new Ex2ndPasswordVerify(Ex2ndPasswordVerify.PASSWORD_WRONG, _wrongAttempts));
insertWrongAttempt(_wrongAttempts);
}
else
{
if(Config.SECOND_AUTH_BAN_ACC)
banAccount(_activeClient.getActiveChar());
Log.add(_activeClient.getLogin() + " - (" + _activeClient.getIpAddr() + ") has inputted the wrong password " + _wrongAttempts + " times in row.", "banned_accounts");
insertWrongAttempt(0);
_activeClient.close(new Ex2ndPasswordVerify(Ex2ndPasswordVerify.PASSWORD_BAN, Config.SECOND_AUTH_MAX_ATTEMPTS));
}
return false;
}
if(!skipAuth)
{
_authed = true;
_activeClient.sendPacket(new Ex2ndPasswordVerify(Ex2ndPasswordVerify.PASSWORD_OK, _wrongAttempts));
}
insertWrongAttempt(0);
return true;
}

private void banAccount(Player plyr)
{
long banTime = Config.SECOND_AUTH_BAN_TIME;

try
{
plyr.setAccessLevel(-100);
ban(plyr, banTime);
plyr.kick();
}
catch(Exception e)
{
_log.log(Level.SEVERE, "Error while banning account.", e);
}
}

private void ban(Player actor, long time)
{
long date = Calendar.getInstance().getTimeInMillis();
long endban = date / 1000 + time * 60;
String msg = "Secondary Password Auth ban Player" + actor.getName() + " on " + time + " sec";

Connection con = null;
PreparedStatement statement = null;
try
{
con = DatabaseFactory.getInstance().getConnection();
statement = con.prepareStatement("INSERT INTO bans (account_name, obj_id, baned, unban, reason, GM, endban) VALUES(?,?,?,?,?,?,?)");
statement.setString(1, actor.getAccountName());
statement.setInt(2, actor.getObjectId());
statement.setString(3, "SU");
statement.setString(4, "SU");
statement.setString(5, msg);
statement.setString(6, "SU");
statement.setLong(7, endban);
statement.execute();
}
catch(Exception e)
{
_log.warning("could not store bans data:" + e);
}
finally
{
DbUtils.closeQuietly(con, statement);
}
}

public boolean passwordExist()
{
return _password == null ? false : true;
}

public void openDialog()
{
if(passwordExist())
_activeClient.sendPacket(new Ex2ndPasswordCheck(Ex2ndPasswordCheck.PASSWORD_PROMPT));
else
_activeClient.sendPacket(new Ex2ndPasswordCheck(Ex2ndPasswordCheck.PASSWORD_NEW));
}

public boolean isAuthed()
{
return _authed;
}

private String cryptPassword(String password)
{
try
{
MessageDigest md = MessageDigest.getInstance("SHA");
byte[] raw = password.getBytes("UTF-8");
byte[] hash = md.digest(raw);
return Base64.encodeBytes(hash);
}
catch(NoSuchAlgorithmException e)
{
_log.severe("[secondaryPasswordAuth]Unsupported Algorythm");
}
catch(UnsupportedEncodingException e)
{
_log.severe("[secondaryPasswordAuth]Unsupported Encoding");
}
return null;
}

private boolean validatePassword(String password)
{
if(!Util.isDigit(password))
return false;

if(password.length() < 6 || password.length() > 
return false;

if(Config.SECOND_AUTH_STRONG_PASS)
{
for(int i = 0; i < password.length() - 1; i++)
{
char curCh = password.charAt(i);
char nxtCh = password.charAt(i + 1);

if(curCh + 1 == nxtCh)
return false;
else if(curCh - 1 == nxtCh)
return false;
else if(curCh == nxtCh)
return false;
}
for(int i = 0; i < password.length() - 2; i++)
{
String toChk = password.substring(i + 1);
StringBuffer chkEr = new StringBuffer(password.substring(i, i + 2));

if(toChk.contains(chkEr))
return false;
else if(toChk.contains(chkEr.reverse()))
return false;
}
}
_wrongAttempts = 0;
return true;
}
}


 

Config.java

 

find that

 

HTM_CACHE_MODE

 

and add bellow

public static boolean SECOND_AUTH_ENABLED;
public static boolean SECOND_AUTH_BAN_ACC;
public static boolean SECOND_AUTH_STRONG_PASS;
public static int SECOND_AUTH_MAX_ATTEMPTS;
public static long SECOND_AUTH_BAN_TIME;
public static String SECOND_AUTH_REC_LINK;

 

after find that

 

HTM_CACHE_MODE = serverSettings.getProperty("HtmCacheMode", HtmCache.LAZY);

 

 

and add bellow

SECOND_AUTH_ENABLED = serverSettings.getProperty("SAEnabled", false);
SECOND_AUTH_BAN_ACC = serverSettings.getProperty("SABanAccEnabled", false);
SECOND_AUTH_STRONG_PASS = serverSettings.getProperty("SAStrongPass", false);
SECOND_AUTH_MAX_ATTEMPTS = serverSettings.getProperty("SAMaxAttemps", 5);
SECOND_AUTH_BAN_TIME = serverSettings.getProperty("SABanTime", 480);
SECOND_AUTH_REC_LINK = serverSettings.getProperty("SARecoveryLink", "http://www.my-domain...harPassRec.php");

 


 

open Util.java go to the bottom and insert

 

Public static Boolean isdigit (String text) 
{ 
if (text == null | | text.isEmpty ()) 
return false; 
for (char C: text.toCharArray ()) 
if (! Character.isDigit ©) 
return false; 
return true ; 
} 
}

 


 

open server.properties and add

 

# ============================ ============ 
# Settings to set a password on your character SA (Secondary Auth) 
# Pre-include this option in the client (UseSecondaryAuth = true) 
# ============== ========================== 
# include whether the system SA 
SAEnabled = True 
# ban account after a user has exceeded the number of password attempts? 
SABanAccEnabled = True 
# Enhanced password system, combined with the odd even sure! 
SAStrongPass = False 
# The maximum number of password attempts 
SAMaxAttemps = 5 
# Banlength Chara for failure password (min) 
SABanTime = 480
# link to the password recovery page 
SARecoveryLink = http://www . My-Domain ... charPassRec.php
# ======================================= = 

 


 

SQL Part

 

DROP TABLE IF EXISTS `character_secondary_password`; 
CREATE TABLE `character_secondary_password` ( 
  `account_name` VARCHAR (45) NOT NULL DEFAULT'', 
  `var` VARCHAR (20) NOT NULL DEFAULT'', 
  `value` VARCHAR (255), 
  PRIMARY KEY (account_name ``, `var`) 
) ENGINE = MyISAM DEFAULT CHARSET = utf8;

 

credits : kick

Link to comment
Share on other sites

thats looks great i will test it right now man ! thanks for share

 

also fix this line in your config's

 

# Banlength Chara for failure password (min)

= 480 SABanTime

 

i think this must be like

 

# Banlength Chara for failure password (min)

SABanTime = 480

Link to comment
Share on other sites

thats looks great i will test it right now man ! thanks for share

 

also fix this line in your config's

 

# Banlength Chara for failure password (min)

= 480 SABanTime

 

i think this must be like

 

# Banlength Chara for failure password (min)

SABanTime = 480

fixed topic updated
Link to comment
Share on other sites

  • 9 months later...

make it for interlude and send me from message :P

 

OKAY BOSS, NOW IM GONNA DECOMPILE INTERLUDE CLIENT AND CREATE THIS PACKET FOR YOU, GIMME A SEC PLZ

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.



  • Posts

    • We remind you that the opening will take place today, on September 28 at: 19:00 (UTC+3) - server time Check current server time(UTC +3) On 17:00 (UTC +3) We allow you login to create character! Dear friends, this topic important! So please take time to read it. First we want to thank all players who took part in the Open Beta testing, was good activity and nice Olympiad Event yesterday, we all get a lot of fun  Thanks to all who conducted tests with us and prepared this game world! You are amazing!  On 17:00 (UTC +3) We allow you to login for create character! To restrict your name and transfer ToDs/Season Pack to your character. Make it before start! On start, we can have problems with WEB! Everything you need to start on the server: It is IMPORTANT to prepare everything for starting the game RIGHT NOW, do not postpone for later, during the opening there may be problems with the web part of the project, and you simply can not register. - Registration and files Download archive unzip it, run launcher, choose SEASON x25 server and press FULL CHECK What you need to know at the start: Registration for 7 seals from Monday, September 30, full cycle 1 week. First Mammons on Friday October 4 All Epic Raid Bosses dead on start. First epic QA will appear on Monday, next day Core + Zaken + QA and so on by schedule All other RBs alive on server start (including Sub and Nobl RB) - Full RoadMap   About possible attacks on server start. We have prepared as good as we can. We will control the start of the server together with you. Want to ask you, in the case of a problem, don't panic, panic is the worst possible thing that could be, even worse than any attack. We have enough specialists to solve any problems, all that will need from you is patience and trust. Wish you all a smooth start and months of enjoyable play in new Season Interlude x25! Have a fun!
    • 🚨🇦🇷🇧🇷🇪🇸🇸🇰🇺🇳🇨🇱🚨 Devianne - Lineage 2 Interlude  Client - Classic. 🔷Rates 🔸Experience (EXP) - 10x 🔸Skill Points (SP) - 10x 🔸Adena - 6x 🔸Drop Items - 3x 🔸Spoil - 3x 🔸Quest Experience (EXP) - 1x 🔸Quest Skill Points (SP) - 1x 🔸Quest Adena - 1x 🔸Quest Items Drop - 1x 🔸Seal stone Drop - 1x 🔸Epic raid - 1x 🔸Raid Drop - 2.0x 🔸Manor - 5x 🔷Dynamic Rates XP/SP 🔸Lv. 1-52 EXP/SP X10 (x7 without VIP or vote reward) 🔸Lv. 52-61 EXP/SP X7(x5 without VIP or vote reward) 🔸Lv. 61-76 EXP-SP X5 (x3 without VIP or vote reward) 🔸Lv. 76-78 EXP/SP X3 (x2 without VIP or vote reward) 🔸Lv. 78-80 EXP/SP X2 (x1 without VIP or vote reward) ⚠️Extra Settings⚠️ 🔸Server time, site - GMT -3 🔸Buffs, Dances, and Songs duration - 1 hour 🔸Max Buffs Slots - 22 + 4 divine 🔸Maximum Slots Dances and Songs - 12 🔸GmShop Grade - C 🔸Global teleport 🔸Grade B-A-S - Craft 🔸Mana potion recharge 🔸1000 (9 seconds delay) 🔸Raid HP - x1.4 🔸Raid epic HP - x1 🔸Blacksmith Mammon - 24/7 🔸Champions System - Yes chance respawn 0.5% 🔸Offline mode Shop - Yes 🔸Auto Learn Skills - Yes 🔸Auto Learn Loot - Yes 🔸Auto Learn Raid & Grand 🔸Boss Loot - No 🔸Buffer offline - Yes 🔸Wedding System - Yes 🔸Max level diff distribution drop in party - 14 🔸Limit the number of active gaming clients on one PC - 2 🔸Limit the number of active gaming clients on one PC for Premium - 3 🔸The clan leader will be replaced after server restart ⚠️Class and Subclass Change⚠️ 🔸1st profession Quest - No 🔸2nd profession Quest - No 🔸3rd profession Quest - Yes 🔸Sub Class Quest- Yes 🔸Sub Class Raid - 8 hours +-30m random 🔸Nobility and Olympiads Nobility Quest - Yes 🔸Olympiads (duration) - 14 days 🔸Max enchant - +6 🔸Respawn Barakiel 6 hours - +-15 min random 🔸Olympiad schedule - 13:00 to 00:00 🔸Minimum players to start olympiad - 11 Clans and Sieges Penalty duration - 8 hours 🔸Sieges every - 15 days Max Ally - 2 🔸Max Members - 36 🔸Slots for academies in clan - 40 ⚠️Enchants Rate⚠️ 🔸Blessed Scroll chance 60% 1-10 11-16 40% 🔸Crystal Scroll chance 65% 1-10 11-16 40% 🔸Normal Scroll chance - 55% 🔸Safe Enchant - +4 ⚠️Premium Info⚠️ 🔅+20% xp sp drop spoil adena 🔅+5% additional enchant rate (premium 30 days)   Free autofarm ⚠️Starter Pack⚠️ 🔅Free Premium - 24 hours 🔅Free Autofarm - 24 hours ❇️Raid boss Info❇️ 🔸Anakim/Lilith respawn 18 hours +1:30min random 🔸Tyrannosaurus - respawn 8 min drop Tl 76 🔸Queen Ant (LVL 80) - Respawn Monday and Saturday 22:00 🔸CORE (LVL 80) - Respawn Tuesday-Friday 20:00 🔸ORFEN (LVL 80) - Respawn Tuesday-Friday 21:00 🔸BAIUM (LVL 80) - Respawn Saturday 21:00 🔸ZAKEN (LVL 80) - Respawn Wednesday-Thursday 22:00 🔸FRINTEZZA (LVL 85) - Sunday 19:45 ⚔️Quest Details⚔️ QUEST WEAPON RECIPES: - Relics of the Old Empire x1: - Gather the Flames x1 x1: QUEST ARMOR RECIPES: - Alliance with Varka Silenos x1 - Alliance with Ketra Orcs x1 - War with Ketra x1 - War with Varka x1 - Gather the Exploration of the Giants’ Cave Part 1 x3 - Exploration of the Giants’ Cave Part 2 x1 - Whispers of Dream part 2 x2 - Legacy of Insolence x1 QUEST RECIPES JEWERLY - The Finest Food x1 QUEST RESOURCES - The Zero Hour x2 - Golden Ram Mercenary x2 - An Ice Merchant dream x2 QUEST FOR FABRIC: - Whispers of Dream part 1 x1 BEAST FARM : - Delicious Top Choice Meat x2 👁️OTHER QUEST👁️ 👁️- Yoke of the Past x2 👁️- In Search of Fragments of Dimension x2 👁️- The finest Ingredients x3 👁️- Supplier of reagents x3 - 👁️3rd class Halisha Marks drop x3 - 👁️Into the flames x3 - 👁️Audience with the land dragon x3 - 👁️An Arrogant Search x3 - 👁️Last Imperial Prince x3 🚨Soul Crystal Details🚨 🔸- Level up crystals to 11, 12, 13 🔸- All epics can level up crystals for the whole party (Queen Ant, Core, Orfen, Zaken, Baium, Antharas, Valakas, Frintezza). - 🔸Bosses in PVP zone: Master Anays, High Priest Van Halter. 👁️🔸- Anakim/Lilith, Uruka. - You can level up crystals in Rift, but only 1 party can challenge Anakazel (10%)PARTY_RANDOM at the same time (if one party is in the boss, you need wait them to go out). 👁️🔸- You can level up crystals in Primeval Island by killing tyrannosaurus with 10% chance PARTY_ALL for the person who cast the crystal and makes last hit. ⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️ WEB: https://devianne-l2.com/ DISCORD: https://discord.gg/Q3HAMzasUk 🔥🔥SERVER TEST OPEN !!🔥🔥🔥
    • I am here for the plank jumps and the cookies any news about that?
    • the links are offiline, could you reupload them please, if you have other versions of h5 or c6 could you share them too, thanks!
    • Good afternoon everyone, we’ll get a couple of strong players in the CP, more details can be found here https://mw2.community/topic/211276-awr-team/  
  • Topics

×
×
  • Create New...