Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > MapleStory
You last visited: Today at 16:34

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Release]AutoRegister for OdinMS v.75

Discussion on [Release]AutoRegister for OdinMS v.75 within the MapleStory forum part of the MMORPGs category.

Reply
 
Old   #1
 
elite*gold: 150
Join Date: Dec 2007
Posts: 1,860
Received Thanks: 567
Post [Release]AutoRegister for OdinMS v.75

Hey there i maked new TuT for Auto Register v.75

1)Open up LoginServer.java
2)Add in the file

Code:
private boolean AutoReg;
private byte AutoRegLimit;
above

Code:
private static LoginServer instance = new LoginServer();
and 2 times

Code:
AutoReg = Boolean.parseBoolean(prop.getProperty("net.sf.odinms.world.AutoRegister", "false"));
AutoRegLimit = Byte.parseByte(prop.getProperty("net.sf.odinms.login.AutoRegisterLimit", "5"));
above

Code:
try {
				fileReader = new FileReader("subnet.properties");
add:

Code:
        public boolean AutoRegister() {
            return AutoReg;
        }

        public byte AutoRegLimit() {
            return AutoRegLimit;
        }
under it:

Code:
public Map<Integer, Integer> getLoad() {
		return load;
	}
save now and open LoginPasswordHandler.java up

and replace your code with this one

Code:
/*
	This file is part of the OdinMS Maple Story Server
    Copyright (C) 2008 Patrick Huy <> 
                       Matthias Butz <>
                       Jan Christian Meyer <>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License version 3
    as published by the Free Software Foundation. You may not use, modify
    or distribute this program under any other version of the
    GNU Affero General Public License.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package net.sf.odinms.net.login.handler;

import net.sf.odinms.client.MapleCharacter;
import net.sf.odinms.client.MapleClient;
import net.sf.odinms.net.MaplePacketHandler;
import net.sf.odinms.net.login.LoginWorker;
import net.sf.odinms.server.AutoRegister;
import net.sf.odinms.tools.MaplePacketCreator;
import net.sf.odinms.tools.data.input.SeekableLittleEndianAccessor;
import net.sf.odinms.tools.KoreanDateUtil;
import java.util.Calendar;
import net.sf.odinms.net.login.LoginServer;

public class LoginPasswordHandler implements MaplePacketHandler {
    // private static Logger log = LoggerFactory.getLogger(LoginPasswordHandler.class);
    @Override
    public boolean validateState(MapleClient c) {
        return !c.isLoggedIn();
    }

    @Override
    public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
        String login = slea.readMapleAsciiString();
        String pwd = slea.readMapleAsciiString();
        c.setAccountName(login);
        int loginok = 0;
        boolean ipBan = c.hasBannedIP();
        boolean macBan = c.hasBannedMac();
        if (AutoRegister.getAccountExists(login)) {
            loginok = c.login(login, pwd, ipBan || macBan);
        } else if (LoginServer.getInstance().AutoRegister() && (!ipBan || !macBan)) {
            AutoRegister.createAccount(login, pwd, c.getSession().getRemoteAddress().toString());
            if (AutoRegister.success) {
                loginok = c.login(login, pwd, ipBan || macBan);
            }
        } else loginok = c.login(login, pwd, ipBan || macBan);
        Calendar tempbannedTill = c.getTempBanCalendar();
        if (loginok == 0 && (ipBan || macBan)) {
            loginok = 3;
            if (macBan) {
                String[] ipSplit = c.getSession().getRemoteAddress().toString().split(":");
                MapleCharacter.ban(ipSplit[0], "Enforcing account ban, account " + login, false);
            }
        }
        if (loginok == 3) {
            c.getSession().write(MaplePacketCreator.getPermBan(c.getBanReason()));
            return;
        } else if (loginok != 0) {
            c.getSession().write(MaplePacketCreator.getLoginFailed(loginok));
            return;
        } else if (tempbannedTill.getTimeInMillis() != 0) {
            long tempban = KoreanDateUtil.getTempBanTimestamp(tempbannedTill.getTimeInMillis());
            byte reason = c.getBanReason();
            c.getSession().write(MaplePacketCreator.getTempBan(tempban, reason));
            return;
        }
        if (c.isGm()) {
            LoginWorker.getInstance().registerGMClient(c);
        } else {
            LoginWorker.getInstance().registerClient(c);
        }
    }
}
save / Add AutoRegister.java

Code:
package net.sf.odinms.server;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import net.sf.odinms.client.LoginCrypto;
import net.sf.odinms.client.MapleClient;
import net.sf.odinms.net.login.LoginServer;
import net.sf.odinms.database.DatabaseConnection;

public class AutoRegister {

    public static boolean success;
    private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(MapleClient.class);

    public static boolean getAccountExists(String login) {
        boolean accountExists = false;
        try {
            Connection con = DatabaseConnection.getConnection();
            String sql = "SELECT name FROM accounts WHERE name = ?";
            PreparedStatement ps = con.prepareStatement(sql);
            ps.setString(1, login);
            ResultSet rs = ps.executeQuery();
            if (rs.first()) {
                accountExists = true;
            }
            rs.close();
            ps.close();
        } catch (Exception ex) {
            log.warn("OdinTeh: Error acquiring the account of (" + login + ") check AutoRegister.");
        }
        return accountExists;
    }

    public static void createAccount(String login, String pwd, String eip) {
        try {
            PreparedStatement ipq = DatabaseConnection.getConnection().prepareStatement("SELECT lastknownip FROM accounts WHERE lastknownip = ?");
            ipq.setString(1, eip.substring(1, eip.lastIndexOf(':')));
            ResultSet rs = ipq.executeQuery();
            if (!rs.first() || rs.last() && rs.getRow() < LoginServer.getInstance().AutoRegLimit()) {
                try {
                    PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("INSERT INTO accounts (name, password, email, birthday, macs, lastknownip) VALUES (?, ?, ?, ?, ?, ?)");
                    ps.setString(1, login);
                    ps.setString(2, LoginCrypto.hexShaOne(pwd));
                    ps.setString(3, "[email protected]");
                    ps.setString(4, "0000-00-00");
                    ps.setString(5, "00-00-00-00-00-00");
                    ps.setString(6, eip.substring(1, eip.lastIndexOf(':')));
                    ps.executeUpdate();
                    ps.close();
                    success = true;
                } catch (Exception ex) {
                    log.warn("OdinTeh: Error creating the account of (" + login + " | " + pwd + " | " + eip + ").");
                    ipq.close();
                    rs.close();
                    return;
                }
            }
            ipq.close();
            rs.close();
        } catch (Exception ex) {
            log.warn("OdinTeh: Error creating " + login + "'s account.");
        }
    }
}
save / then replace LoginCrypto.java

Code:
/*
 * This file is part of the OdinMS Maple Story Server Copyright (C) 2008 Patrick Huy <> Matthias Butz
 * <> Jan Christian Meyer <>
 * 
 * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
 * Public License version 3 as published by the Free Software Foundation. You may not use, modify or distribute this
 * program under any other version of the GNU Affero General Public License.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU Affero General Public License along with this program. If not, see
 * <http://www.gnu.org/licenses/>.
 */

package net.sf.odinms.client;

import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Random;
import net.sf.odinms.tools.HexTool;

public class LoginCrypto {

    private LoginCrypto() {
    }

    private static String toSimpleHexString(byte[] bytes) {
        return HexTool.toString(bytes).replace(" ", "").toLowerCase();
    }

    private static String hashWithDigest(String in, String digest) {
        try {
            MessageDigest Digester = MessageDigest.getInstance(digest);
            Digester.update(in.getBytes("UTF-8"), 0, in.length());
            byte[] sha1Hash = Digester.digest();
            return toSimpleHexString(sha1Hash);
        } catch (NoSuchAlgorithmException ex) {
            throw new RuntimeException("Hashing the password failed", ex);
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException("Encoding the string failed", e);
        }

    }

    public static String hexShaOne(String in) {
        return hashWithDigest(in, "SHA-1");
    }

    private static String hexSha1(String in) {
        return hashWithDigest(in, "SHA-1");
    }

    private static String hexSha512(String in) {
        return hashWithDigest(in, "SHA-512");
    }

    public static boolean checkSha1Hash(String hash, String password) {
        return hash.equals(hexSha1(password));
    }

    public static boolean checkSaltedSha512Hash(String hash, String password, String salt) {
        return hash.equals(makeSaltedSha512Hash(password, salt));
    }

    public static String makeSaltedSha512Hash(String password, String salt) {
        return hexSha512(password + salt);
    }

    public static String makeSalt() {
        byte[] salt = new byte[16];
        new Random().nextBytes(salt);
        return toSimpleHexString(salt);
    }
}
save / open world.properties
add some under

Code:
# AutoRegister.  [ True = On  OR  False = Off ]
# Default (false)
net.sf.odinms.world.AutoRegister=True

# AutoRegister Limit Per IP.
# Default (5)
net.sf.odinms.login.AutoRegisterLimit=5
Save it and you done

Have fun with it

Officially posted by aRc0n on RZ Forum.
Officially created by XiuzSu Source owner, XiuzSu.
And me for edit some
.SketchBear is offline  
Thanks
1 User
Old 01/03/2010, 10:56   #2
 
OmikronXL's Avatar
 
elite*gold: 0
Join Date: Jan 2009
Posts: 30
Received Thanks: 1
Here we go again
Officially posted by aRc0n on RZ Forum.
Officially created by XiuzSu Source owner, XiuzSu.
OmikronXL is offline  
Old 01/03/2010, 11:09   #3
 
elite*gold: 150
Join Date: Dec 2007
Posts: 1,860
Received Thanks: 567
lol i edited some so its my work too
.SketchBear is offline  
Old 01/03/2010, 11:14   #4
 
OmikronXL's Avatar
 
elite*gold: 0
Join Date: Jan 2009
Posts: 30
Received Thanks: 1
You edited nothing
Tell me one thing you edited?
And if it's your work "TOO" wich it obviously is not.
Than you should still give credits too the others.
If Steven Spielburg makes a movie do all the credits go to him? No the people who helped do too. Get it? Prolly not...
Anywho poitless arguement. You did nothing, Equals>Not your work. AT ALL.
OmikronXL is offline  
Old 03/30/2010, 00:38   #5
 
elite*gold: 0
Join Date: Mar 2010
Posts: 1
Received Thanks: 0
This program is free software: you can redistribute it and/or modify

class, interface, or enum expected
noamng is offline  
Reply


Similar Threads Similar Threads
How-To Compile OdinMS source [Netbeans]
05/04/2010 - MapleStory - 4 Replies
Assuming you cannot compile with the guide that Traitor posted. How-to compile OdinMS source - OdinMS I have made this thread to inform you that you can compile with NetBeans. http://download.netbeans.org/netbeans/6.1/final/ Download the one furthest to the right, which includes all the languages. You never know when you might need to use something rather than Java. After downloading and installing NetBeans ; open it up, depending on your computer processor speed/RAM.
OdinMS Source RELEASED!
05/15/2008 - MapleStory - 1 Replies
Good news, Odin has just released their source files.. Serpendiem (OdinMS developer) wrote: Hi as hinted in the release notes of r877 we have something exciting coming. This is it The OdinMS server including full Sourcecode is now available at our ( https://sourceforge.net/projects/odinms ) We have also created a new section for discussing the OdinMS server and for submitting source changes back to us. Please keep your posts in these sections civilized we don't want to ban...
OdinMS: The first and in my opinion the best
04/16/2008 - MapleStory - 12 Replies
This is an awsome server, that i found. It's called OdinMS this is the website OdinMS They have Ludbrium, Herb Town, and pretty much all the maps that are in normal Maple Story. The drop rates and exp is awsome! i got to level 30 in one day after 2 hours of playing! 3rd job is almost done. First you will need to sign up at the forums and wait 3 days (i hate that BUT it is worth the wait!!). After there days go on this link >> OdinMS Beta Account Creation and sign up download the client below...
T>odinms accoutn for localms account
03/26/2008 - MapleStory - 6 Replies
The tital is it just pm me and ill giev you user and pass and you give me local ms user and pass and trade is done! Why do i wanna play localms? Well becasue me and my friend used to share an account but now the account is level 73 and hese hogging it and i dont feel like makeing a new char and lvl it to 60+ so it can be fun! Just pm me and we trade



All times are GMT +2. The time now is 16:34.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.