• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

Siwft emu IP ban - Superban

Status
Not open for further replies.
Junior Spellweaver
Joined
Oct 13, 2008
Messages
104
Reaction score
7
Hello,

Does anyone know how I get ipban fixed when I'm using http proxy?

When I ip-ban someone all users get banned.


I've 2 columns in my users database,

ip_last and ip_reg. IP_last = users ip and ip_reg the server ip.


Ban code:
PHP:
internal class ModerationBanManager
    {
        private Hashtable bannedIPs = new Hashtable();
        private Hashtable bannedUsernames = new Hashtable();

        internal ModerationBanManager()
        {
        }

        internal void BanUser(GameClient Client, string Moderator, double LengthSeconds, string Reason, bool IpBan)
        {
            IQueryAdapter adapter;
            ModerationBanType uSERNAME = ModerationBanType.USERNAME;
            string username = Client.GetHabbo().Username;
            string query = "user";
            double expire = ButterflyEnvironment.GetUnixTimestamp() + LengthSeconds;
            if (IpBan)
            {
                uSERNAME = ModerationBanType.IP;
                username = Client.GetConnection().getIp();
                query = "ip";
            }


         
            ModerationBan ban = new ModerationBan(uSERNAME, username, Reason, expire);
            if (ban.Type == ModerationBanType.IP)
            {
                if (this.bannedIPs.ContainsKey(username))
                {
                    this.bannedIPs[username] = ban;
                }
                else
                {
                    this.bannedIPs.Add(username, ban);
                }
            }
            else if (this.bannedUsernames.ContainsKey(username))
            {
                this.bannedUsernames[username] = ban;
            }
            else
            {
                this.bannedUsernames.Add(username, ban);
            }
            using (adapter = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
            {
                adapter.setQuery(string.Concat(new object[] { "INSERT INTO bans (bantype,value,reason,expire,added_by,added_date) VALUES (@rawvar,@var,@reason,'", expire, "',@mod,'", DateTime.Now.ToLongDateString(), "')" }));
                adapter.addParameter("rawvar", query);
                adapter.addParameter("var", username);
                adapter.addParameter("reason", Reason);
                adapter.addParameter("mod", Moderator);
                adapter.runQuery();
            }

Is there a way to ban people with the ip_last column?
 
ส็็็็็็็
Loyal Member
Joined
Sep 21, 2009
Messages
2,005
Reaction score
594
Use the housekeeping, SwiftEmulator has the least organized commandHandler of every branch of the Butterfly "spectrum".

Take a look at Firewind, use some of its commands.
 
Upvote 0
ส็็็็็็็
Loyal Member
Joined
Sep 21, 2009
Messages
2,005
Reaction score
594
You're stupid, I barely touched the commandHandler.
If you hadn't renamed BCStorm to Swift there would be no confusion, Just because you didn't touch it doesn't mean it isn't messy, it is. Mainly because BcStorm has a messy CommandHandler. And I am stupid for stating that it is messy? I'm really hurt :(

Should still be called "UberEmulator".
 
Upvote 0
Joined
Feb 18, 2012
Messages
779
Reaction score
247
If you hadn't renamed BCStorm to Swift there would be no confusion, Just because you didn't touch it doesn't mean it isn't messy, it is. Mainly because BcStorm has a messy CommandHandler. And I am stupid for stating that it is messy? I'm really hurt :(

Should still be called "UberEmulator".

And what have you released? Do you even code bro? You're in no position to judge with your lone release holoCMS edit.

Also, you specifically said swiftemu had the messiest commandHandler of the whole BCStorm branch so you're suggesting that I made it messy myself. Witch I didn't, and if you actually looked at the code before making stupid assumptions you would know what you're talking about.

On-Topic:
The get IP function doesn't select it from the database, it takes it from the users incoming connection on the client. Check the IP that you are banning and make sure its not the IP that you use in your configuration. And FYI, proxies don't do poop for retros.

If you post the banned table for me I can give you a specific answer.
 
Upvote 0
ส็็็็็็็
Loyal Member
Joined
Sep 21, 2009
Messages
2,005
Reaction score
594
And what have you released? Do you even code bro? You're in no position to judge with your lone release holoCMS edit.

Also, you specifically said swiftemu had the messiest commandHandler of the whole BCStorm branch so you're suggesting that I made it messy myself. Witch I didn't, and if you actually looked at the code before making stupid assumptions you would know what you're talking about.

On-Topic:
The get IP function doesn't select it from the database, it takes it from the users incoming connection on the client. Check the IP that you are banning and make sure its not the IP that you use in your configuration. And FYI, proxies don't do poop for retros.

If you post the banned table for me I can give you a specific answer.
I don't want to release anything, and you really took the time to check, I'm touched :). And I tend to use what I learnt here on other things, developing useful things isn't really what I do here, I just mess around to improve my skills, which isn't even worth releasing.

And if you hadn't even touched commandHandler why are you even arguing about this? BcStorm > Swift, Swift is basically just an updated version of BcStorm. And I said it was the messiest out of the entire Butterfly branch, not just BcStorm, Anyway like I said BcStorm and Swift are very alike, Swift is just updated (off course you know that), so I was referring to both Swift and BcStorm.

BcStorm + Swift = equally messy commandhandler

And because I haven't contributed that means I do not have the ability to judge? Yeah releasing something instantly updates your skill set to be able to judge something! I will sure look into that!

Do I even code?
Well thats an easy one to answer, I do, I learnt from Holograph. (isn't the best resource to learn from)

Anyway not contributing does not mean I cannot develop, many developers are in fact good developers yet we haven't seen a single release from them. (I don't blame them, Sulake are lurking, less they know about someone the better, and I don't contribute because I would rather keep what I did for past hotels unique.)

Thank you :love:
 
Upvote 0
Joined
Feb 18, 2012
Messages
779
Reaction score
247
I don't want to release anything, and you really took the time to check, I'm touched :). And I tend to use what I learnt here on other things, developing useful things isn't really what I do here, I just mess around to improve my skills, which isn't even worth releasing.

And if you hadn't even touched commandHandler why are you even arguing about this? BcStorm > Swift, Swift is basically just an updated version of BcStorm. And I said it was the messiest out of the entire Butterfly branch, not just BcStorm, Anyway like I said BcStorm and Swift are very alike, Swift is just updated (off course you know that), so I was referring to both Swift and BcStorm.

BcStorm + Swift = equally messy commandhandler

And because I haven't contributed that means I do not have the ability to judge? Yeah releasing something instantly updates your skill set to be able to judge something! I will sure look into that!

Do I even code?
Well thats an easy one to answer, I do, I learnt from Holograph. (isn't the best resource to learn from)

Anyway not contributing does not mean I cannot develop, many developers are in fact good developers yet we haven't seen a single release from them. (I don't blame them)

Thank you :love:

I highly doubt you learned to code based off of looking at raw code. Holograph especially since most of the code is deprecated now anyways. When you're saying "every branch of the bcstorm spectrum" your implying that I did something to make it messy, which once again I didn't. Thats all i'm saying, next time be more clear when you try and make up facts.
 
Upvote 0
Junior Spellweaver
Joined
Oct 13, 2008
Messages
104
Reaction score
7
On-Topic:
The get IP function doesn't select it from the database, it takes it from the users incoming connection on the client. Check the IP that you are banning and make sure its not the IP that you use in your configuration. And FYI, proxies don't do poop for retros.

If you post the banned table for me I can give you a specific answer.

I figured out that too. But it always takes the incoming connection. So I need to code a mus command and take the ip_last?
 
Upvote 0
Junior Spellweaver
Joined
Oct 13, 2008
Messages
104
Reaction score
7
No I mean when I ban anyone, it takes always the server ip.
 
Upvote 0
Joined
Jun 25, 2009
Messages
831
Reaction score
475
HTTP proxy shouldn't cause an issue, the TCP proxy would.

What you are best off doing is either caching the users last IP via login (providing it is their actual IP and not the HTTP proxy/CloudFlare) or either running a query on BanUser() to get their IP from the database rather then the client connection IP.

I'd suggest caching the IP over running a query each time you ban a user and using that IP rather then the client connection IP.
 
Upvote 0
Junior Spellweaver
Joined
Oct 13, 2008
Messages
104
Reaction score
7
I've now another solution, Coded ipban in my own housekeeping with a muscommand. Insert ip in ban table and disconnect user with the mus command.

Thanks for helping guys
 
Upvote 0
Status
Not open for further replies.
Back
Top