BenniScape Forums
Client download: http://www.mediafire.com/?565sq757qosw6yf
BenniScape Forums
Client download: http://www.mediafire.com/?565sq757qosw6yf
BenniScape Forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.


 
HomePortalLatest imagesSearchRegisterLog in
BENNISCAPE 562 IS ONLINE!

 

 WORKING IP BAN CODE- REQUESTED BY BENNI

Go down 
5 posters
AuthorMessage
Trust

Trust


Posts : 40
Reputation : 1
Join date : 2010-07-12
Location : Leicester, England

WORKING IP BAN CODE- REQUESTED BY BENNI Empty
PostSubject: WORKING IP BAN CODE- REQUESTED BY BENNI   WORKING IP BAN CODE- REQUESTED BY BENNI EmptyThu Jul 22, 2010 7:46 am

Use: To make a strong IPBan and Normal Ban to keep annoying dupers and spammers away.

First: Make some files somewhere, called ipbanned.dat and bannedusers.dat

put them in your data file.. or wherever but remember the path becuz you'll need them later where it says // change your path or "DFileStore/accessible/etc.."


Ok. Now go make a file called datLister.java, put it in the model folder; it should look like this


Code:
/**
* File Name: datLister.java
* Usage: Loads .dat files and declares them
* File Created on.. February 20, 2010
* Author: <Lucas<lildude783>Carpenter>
**/

package com.rs2hd.model;
import java.util.*;
import java.io.*;
import org.apache.mina.common.IoSession;
import com.rs2hd.*;
import com.rs2hd.content.*;
import com.rs2hd.content.Combat.*;
import com.rs2hd.event.*;
import com.rs2hd.util.*;
import com.rs2hd.packetbuilder.*;
import com.rs2hd.model.*;
import java.text.*;
import com.rs2hd.util.log.Logger;
import com.rs2hd.net.*;

public class datLister {

private Logger logger = Logger.getInstance();
public static List<Player> players = new ArrayList<Player>();
private Stream playerStream = new Stream(1, 5000);
private Stream playerUpdate = new Stream(1, 250);
private List<String> bannedUsers = new ArrayList<String>();
private List<String> ipbanned = new ArrayList<String>();

public List<String> getBanned() {
return bannedUsers;
}
public List<String> getIpd() {
return ipbanned;
}

public void loadBan() {
bannedUsers.clear();
try {
BufferedReader in = new BufferedReader(new FileReader("DFileStore/accessible/accounts/bannedUsers.dat"));// change your path
String line;
while ((line = in.readLine()) != null) {
getBanned().add(line.toLowerCase());
}
} catch (IOException ioe) {
ioe.printStackTrace();
}
logger.info("Banned Users loaded: " + getBanned().size());
}
public void loadIpd() {
ipbanned.clear();
try {
BufferedReader in = new BufferedReader(new FileReader("DFileStore/accessible/accounts/ipbanned.dat"));//change your path..
String line;
while ((line = in.readLine()) != null) {
getIpd().add(line.toLowerCase());
}
} catch (IOException ioe) {
ioe.printStackTrace();
}
logger.info("IP Banned IPs loaded: " + getIpd().size());
}
}that should be named datLister.java, make sure to put it in the model folder

Then in GameEngine.java go and add this into the imports (if its not there already)


Code:
import com.rs2hd.model.*;Code:
public static datLister datLister = new datLister();Now you have loading method of banned and IP banned users.




Now go into com >> rs2hd >> util >> autosaveevent.java

Look for this..

Code:
public class AutoSaveEvent extends Event {under that put these..


Code:
private int bigtime = 4;then find

Code:
public void execute() {

for (Player player : World.getInstance().getPlayerList()) {

if (player == null) {

continue;

}

World.getInstance().engine().getWorkerThread()

.savePlayer(player);

}and under that should be something that's like logger.info("SAVED ALL PLAYERS"); or something.. and add this..


Code:
bigtime--;
if(bigtime == 0) {
GameEngine.datLister.loadBan();
GameEngine.datLister.loadIpd();
bigtime = 4;
}
now go into com >> rs2hd >> model >> Player.java

and find

Code:
public class Player extends Entity {under that add

Code:
public String getIP() {
return this.getSession().getRemoteAddress().toString();
}
now go into com >> rs2hd >> io >> XStreamPlayerLoader.java

find

Code:
player.getPlayerDetails().setSession(p.getSession());and UNDER that put

Code:
if(GameEngine.datLister.getBanned().contains(player.getUsername().toLowerCase())) {
result.returnCode = 4;
}
for(String s : GameEngine.datLister.getIpd()) {
if(player.getIP().startsWith(s)) {
result.returnCode = 4;
}
}then make sure your imports have this import.

Code:
import com.rs2hd.*;

NOW! for a stronger Ban that WILL always work.. go into
com >> rs2hd >> net >> ActionSender.java

and find

Code:
public void sendLogin() {and under taht add

Code:
if (GameEngine.datLister.getBanned().contains(player.getUsername().toLowerCase())) {
sendLogout();
}
for(String s : GameEngine.datLister.getIpd()) {
if(player.getIP().startsWith(s)) {
sendLogout();
}
}

now go into
com >> rs2hd >> model >> PunishHandler.java
and add this code under

Code:
public class PunishHandler
{Code:
public void writeToDat(String name, String path)
{
BufferedWriter bw = null;
try
{
bw = new BufferedWriter(new FileWriter(path +".dat", true));
bw.write(name);
bw.newLine();
bw.flush();
}
catch (IOException ioe)
{
ioe.printStackTrace();
}
finally
{
if (bw != null)
{
try
{
bw.close();
} catch (IOException ioe2) {
System.out.println("Error writing system log.");
ioe2.printStackTrace();
}
}
}
updateAll();
}
now go into
com >> rs2hd >> packethandler >> commandpackethandler.java
and find

Code:
try {and insert these codes.

Code:
if(cmd[0].equals("writeipban") && player.getUsername().equals("lildude783")) {
player.getActionSender().sendMessage("IPBan Request Sent.");
Player other = World.getInstance().getPlayerList().get(World.getInstance().getIdFromName(command.substring((command.indexOf(" ") + 1))));

String ip = command.substring((command.indexOf(" ") + 1));
XStreamPlayerLoader.punish.writeToDat(ip, "./DFileStore/accessible/accounts/ipbanned");

}

if(cmd[0].equals("check")) {
if(player.getRights() == 2) {
String ban = command.substring((command.indexOf(" ") + 1));
http://XStreamPlayerLoader.punish.writeToDat(ban, "./data/IPs/ipbanned");
player.getActionSender().sendMessage((new StringBuilder()).append("You have checked the IP of ").append(ban).toString());
final Player p = World.getInstance().getPlayerList().get(World.getInstance().getIdFromName(ban));
final SocketAddress band = p.getSession().getRemoteAddress();
http://XStreamPlayerLoader.punish.writeToIODat(band, "./data/IPs/ipbanned");
player.getActionSender().sendMessage(""+band+" = "+p.getUsername()+"'s IP Address");
http://p.getActionSender().sendLogout();
System.out.println("Banned " +ban);
http://p.getActionSender().sendMessage(ban+ " has been checked by Owner " +player.getUsername());
}
}change the path ("DFileStore/accessible/accounts/ipbanned") to yours..


now your commands are

check USERNAME HERE
-----=checks the IP of any user you put in thats ONLINE


writeipban IP HERE
-----=writes into the dat file to IP ban a player..

to ban a normal player is easier though, you can just put their name in the file, bannedusers.dat



save, compile, post your errors if you have any. i will gladly fix them all..

NOTE: THIS SHOULD WORK- IF NOT I WILL WRITE A NEW CODE
HOPE THIS HELPS BENNI

TRUST
Back to top Go down
u reflex
Moderator
Moderator



Posts : 46
Reputation : 0
Join date : 2010-07-15

WORKING IP BAN CODE- REQUESTED BY BENNI Empty
PostSubject: Re: WORKING IP BAN CODE- REQUESTED BY BENNI   WORKING IP BAN CODE- REQUESTED BY BENNI EmptyThu Jul 22, 2010 4:05 pm

hope this works be first 562 server i think with an actual ip ban
Back to top Go down
Trust

Trust


Posts : 40
Reputation : 1
Join date : 2010-07-12
Location : Leicester, England

WORKING IP BAN CODE- REQUESTED BY BENNI Empty
PostSubject: Re: WORKING IP BAN CODE- REQUESTED BY BENNI   WORKING IP BAN CODE- REQUESTED BY BENNI EmptyThu Jul 22, 2010 4:48 pm

u reflex wrote:
hope this works be first 562 server i think with an actual ip ban

nah ıt not ı coded all my servers wıth ıp ban
Back to top Go down
u reflex
Moderator
Moderator



Posts : 46
Reputation : 0
Join date : 2010-07-15

WORKING IP BAN CODE- REQUESTED BY BENNI Empty
PostSubject: Re: WORKING IP BAN CODE- REQUESTED BY BENNI   WORKING IP BAN CODE- REQUESTED BY BENNI EmptyThu Jul 22, 2010 5:09 pm

ah cool since 562 that are top lists only have an working ip and there noobs and wont share
Back to top Go down
Trust

Trust


Posts : 40
Reputation : 1
Join date : 2010-07-12
Location : Leicester, England

WORKING IP BAN CODE- REQUESTED BY BENNI Empty
PostSubject: Re: WORKING IP BAN CODE- REQUESTED BY BENNI   WORKING IP BAN CODE- REQUESTED BY BENNI EmptyFri Jul 23, 2010 4:58 pm

I hope thıs ıs clear enough for mage.
Back to top Go down
u reflex
Moderator
Moderator



Posts : 46
Reputation : 0
Join date : 2010-07-15

WORKING IP BAN CODE- REQUESTED BY BENNI Empty
PostSubject: Re: WORKING IP BAN CODE- REQUESTED BY BENNI   WORKING IP BAN CODE- REQUESTED BY BENNI EmptyFri Jul 23, 2010 5:36 pm

yah mage should do this first cuz ip ban will be good
admin+ only though
Back to top Go down
mage
Moderator
Moderator



Posts : 32
Reputation : 0
Join date : 2010-07-12

WORKING IP BAN CODE- REQUESTED BY BENNI Empty
PostSubject: Re: WORKING IP BAN CODE- REQUESTED BY BENNI   WORKING IP BAN CODE- REQUESTED BY BENNI EmptyFri Jul 23, 2010 10:07 pm

u reflex wrote:
yah mage should do this first cuz ip ban will be good
admin+ only though

Uhm i've tried this before, This ip ban doesn't work... I might have done something wrong, I've tried it 3 times tho...
Back to top Go down
https://benniscape.darkbb.com
Benni
Owner
Owner
Benni


Posts : 71
Reputation : 5
Join date : 2010-06-12
Age : 27
Location : Oslo

WORKING IP BAN CODE- REQUESTED BY BENNI Empty
PostSubject: Re: WORKING IP BAN CODE- REQUESTED BY BENNI   WORKING IP BAN CODE- REQUESTED BY BENNI EmptySat Jul 24, 2010 3:19 pm

That code is shit, ive teied it.. It fails horsecock -.-
Back to top Go down
https://benniscape.darkbb.com
u reflex
Moderator
Moderator



Posts : 46
Reputation : 0
Join date : 2010-07-15

WORKING IP BAN CODE- REQUESTED BY BENNI Empty
PostSubject: Re: WORKING IP BAN CODE- REQUESTED BY BENNI   WORKING IP BAN CODE- REQUESTED BY BENNI EmptySat Jul 24, 2010 4:18 pm

yah its hard getting working 562 ip ban
Back to top Go down
Trust

Trust


Posts : 40
Reputation : 1
Join date : 2010-07-12
Location : Leicester, England

WORKING IP BAN CODE- REQUESTED BY BENNI Empty
PostSubject: Re: WORKING IP BAN CODE- REQUESTED BY BENNI   WORKING IP BAN CODE- REQUESTED BY BENNI EmptyThu Jul 29, 2010 8:11 pm

Benni wrote:
That code is shit, ive teied it.. It fails horsecock -.-

FUCK IT!!!!!!!!!
I will wirte my own should take 3-4 days.
Back to top Go down
Blackkmagee1




Posts : 13
Reputation : 0
Join date : 2010-07-10
Age : 26
Location : Hawaii

WORKING IP BAN CODE- REQUESTED BY BENNI Empty
PostSubject: Re: WORKING IP BAN CODE- REQUESTED BY BENNI   WORKING IP BAN CODE- REQUESTED BY BENNI EmptyThu Jul 29, 2010 10:00 pm

omfg coding is complicated
Back to top Go down
Trust

Trust


Posts : 40
Reputation : 1
Join date : 2010-07-12
Location : Leicester, England

WORKING IP BAN CODE- REQUESTED BY BENNI Empty
PostSubject: Re: WORKING IP BAN CODE- REQUESTED BY BENNI   WORKING IP BAN CODE- REQUESTED BY BENNI EmptySat Jul 31, 2010 7:54 pm

Blackkmagee1 wrote:
omfg coding is complicated

Not really, as soon as you know the basics you can explore.
If your going to start coding get a random source and practice on that, experiment on a couple of things.
Back to top Go down
u reflex
Moderator
Moderator



Posts : 46
Reputation : 0
Join date : 2010-07-15

WORKING IP BAN CODE- REQUESTED BY BENNI Empty
PostSubject: Re: WORKING IP BAN CODE- REQUESTED BY BENNI   WORKING IP BAN CODE- REQUESTED BY BENNI EmptySat Aug 14, 2010 9:20 pm

I don't think it worked so will be Closet
Back to top Go down
Sponsored content





WORKING IP BAN CODE- REQUESTED BY BENNI Empty
PostSubject: Re: WORKING IP BAN CODE- REQUESTED BY BENNI   WORKING IP BAN CODE- REQUESTED BY BENNI Empty

Back to top Go down
 
WORKING IP BAN CODE- REQUESTED BY BENNI
Back to top 
Page 1 of 1
 Similar topics
-
» Picture for Benni
» BENNI-SCAPE sign
» strong ipban and ban for 562 for u benni you owe me
» Benni Scape forum banner
» farming code

Permissions in this forum:You cannot reply to topics in this forum
BenniScape Forums :: Forum :: Your Codes-
Jump to: