mirror of
https://github.com/TotalFreedomMC/BukkitTelnet.git
synced 2025-08-05 12:02:55 +00:00
Renamed to BukkitTelnet
This commit is contained in:
parent
f631655873
commit
52db2ae4bd
13 changed files with 214 additions and 206 deletions
5
README
Normal file
5
README
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
BukkitTelnet is a Telnet server for Minecraft. It allows you to remotely administrate your server via any Telnet client.
|
||||||
|
|
||||||
|
BukkitTelnet is a fork of MCTelnet that is designed for servers with multiple administrators who all have the same full permissions. It allows for login under any username provided that the proper password is supplied.
|
||||||
|
|
||||||
|
MCTelnet was originally created by bekvon. I modified it heavily to be better suited to my TotalFreedomServer, and eventually renamed it.
|
|
@ -7,8 +7,8 @@
|
||||||
<!-- the Compile on Save feature is turned off for the project. -->
|
<!-- the Compile on Save feature is turned off for the project. -->
|
||||||
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
||||||
<!-- in the project's Project Properties dialog box.-->
|
<!-- in the project's Project Properties dialog box.-->
|
||||||
<project name="MCTelnet" default="default" basedir=".">
|
<project name="BukkitTelnet" default="default" basedir=".">
|
||||||
<description>Builds, tests, and runs the project MCTelnet.</description>
|
<description>Builds, tests, and runs the project BukkitTelnet.</description>
|
||||||
<import file="nbproject/build-impl.xml"/>
|
<import file="nbproject/build-impl.xml"/>
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@
|
||||||
|
|
||||||
An example of overriding the target for project execution could look like this:
|
An example of overriding the target for project execution could look like this:
|
||||||
|
|
||||||
<target name="run" depends="MCTelnet-impl.jar">
|
<target name="run" depends="BukkitTelnet-impl.jar">
|
||||||
<exec dir="bin" executable="launcher.exe">
|
<exec dir="bin" executable="launcher.exe">
|
||||||
<arg file="${dist.jar}"/>
|
<arg file="${dist.jar}"/>
|
||||||
</exec>
|
</exec>
|
||||||
|
|
|
@ -19,7 +19,7 @@ is divided into following sections:
|
||||||
- cleanup
|
- cleanup
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="MCTelnet-impl">
|
<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="BukkitTelnet-impl">
|
||||||
<fail message="Please build using Ant 1.8.0 or higher.">
|
<fail message="Please build using Ant 1.8.0 or higher.">
|
||||||
<condition>
|
<condition>
|
||||||
<not>
|
<not>
|
||||||
|
@ -568,7 +568,7 @@ is divided into following sections:
|
||||||
<delete file="${built-jar.properties}" quiet="true"/>
|
<delete file="${built-jar.properties}" quiet="true"/>
|
||||||
</target>
|
</target>
|
||||||
<target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
|
<target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
|
||||||
<echo level="warn" message="Cycle detected: MCTelnet was already built"/>
|
<echo level="warn" message="Cycle detected: BukkitTelnet was already built"/>
|
||||||
</target>
|
</target>
|
||||||
<target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
|
<target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
|
||||||
<mkdir dir="${build.dir}"/>
|
<mkdir dir="${build.dir}"/>
|
||||||
|
@ -1014,7 +1014,7 @@ is divided into following sections:
|
||||||
<delete file="${built-clean.properties}" quiet="true"/>
|
<delete file="${built-clean.properties}" quiet="true"/>
|
||||||
</target>
|
</target>
|
||||||
<target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
|
<target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
|
||||||
<echo level="warn" message="Cycle detected: MCTelnet was already built"/>
|
<echo level="warn" message="Cycle detected: BukkitTelnet was already built"/>
|
||||||
</target>
|
</target>
|
||||||
<target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
|
<target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
|
||||||
<mkdir dir="${build.dir}"/>
|
<mkdir dir="${build.dir}"/>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
build.xml.data.CRC32=fc2d0ea5
|
build.xml.data.CRC32=b69966a4
|
||||||
build.xml.script.CRC32=ea976fe1
|
build.xml.script.CRC32=a50ca8cc
|
||||||
build.xml.stylesheet.CRC32=28e38971@1.38.3.45
|
build.xml.stylesheet.CRC32=28e38971@1.50.2.46
|
||||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
|
||||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
|
||||||
nbproject/build-impl.xml.data.CRC32=fc2d0ea5
|
nbproject/build-impl.xml.data.CRC32=b69966a4
|
||||||
nbproject/build-impl.xml.script.CRC32=d2c78d70
|
nbproject/build-impl.xml.script.CRC32=bb8f2f93
|
||||||
nbproject/build-impl.xml.stylesheet.CRC32=fcddb364@1.50.2.46
|
nbproject/build-impl.xml.stylesheet.CRC32=fcddb364@1.50.2.46
|
||||||
|
|
|
@ -3,4 +3,4 @@ do.depend=false
|
||||||
do.jar=true
|
do.jar=true
|
||||||
javac.debug=true
|
javac.debug=true
|
||||||
javadoc.preview=true
|
javadoc.preview=true
|
||||||
user.properties.file=C:\\Users\\Steven\\.netbeans\\7.0\\build.properties
|
user.properties.file=C:\\Users\\Steven\\.netbeans\\7.1.1\\build.properties
|
||||||
|
|
|
@ -2,7 +2,7 @@ annotation.processing.enabled=true
|
||||||
annotation.processing.enabled.in.editor=false
|
annotation.processing.enabled.in.editor=false
|
||||||
annotation.processing.run.all.processors=true
|
annotation.processing.run.all.processors=true
|
||||||
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||||
application.title=MCTelnet
|
application.title=BukkitTelnet
|
||||||
application.vendor=Administrator
|
application.vendor=Administrator
|
||||||
build.classes.dir=${build.dir}/classes
|
build.classes.dir=${build.dir}/classes
|
||||||
build.classes.excludes=**/*.java,**/*.form
|
build.classes.excludes=**/*.java,**/*.form
|
||||||
|
@ -22,7 +22,7 @@ debug.test.classpath=\
|
||||||
${run.test.classpath}
|
${run.test.classpath}
|
||||||
# This directory is removed when the project is cleaned:
|
# This directory is removed when the project is cleaned:
|
||||||
dist.dir=dist
|
dist.dir=dist
|
||||||
dist.jar=${dist.dir}/MCTelnet.jar
|
dist.jar=${dist.dir}/BukkitTelnet.jar
|
||||||
dist.javadoc.dir=${dist.dir}/javadoc
|
dist.javadoc.dir=${dist.dir}/javadoc
|
||||||
endorsed.classpath=
|
endorsed.classpath=
|
||||||
excludes=
|
excludes=
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<type>org.netbeans.modules.java.j2seproject</type>
|
<type>org.netbeans.modules.java.j2seproject</type>
|
||||||
<configuration>
|
<configuration>
|
||||||
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
|
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
|
||||||
<name>MCTelnet</name>
|
<name>BukkitTelnet</name>
|
||||||
<source-roots>
|
<source-roots>
|
||||||
<root id="src.dir"/>
|
<root id="src.dir"/>
|
||||||
</source-roots>
|
</source-roots>
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# BukkitTelnet v2.0 Configuration File
|
||||||
|
|
||||||
# Port to bind to:
|
# Port to bind to:
|
||||||
port: 8765
|
port: 8765
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.bekvon.bukkit.mctelnet;
|
package me.StevenLawson.BukkitTelnet.BukkitTelnet;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
|
@ -15,7 +15,7 @@ import org.bukkit.permissions.PermissionAttachment;
|
||||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
public class TelnetListener extends Handler implements CommandSender
|
public class BT_TelnetListener extends Handler implements CommandSender
|
||||||
{
|
{
|
||||||
private static final Logger log = Logger.getLogger("Minecraft");
|
private static final Logger log = Logger.getLogger("Minecraft");
|
||||||
private boolean is_running = false;
|
private boolean is_running = false;
|
||||||
|
@ -26,13 +26,13 @@ public class TelnetListener extends Handler implements CommandSender
|
||||||
private Socket clientSocket;
|
private Socket clientSocket;
|
||||||
private BufferedReader instream;
|
private BufferedReader instream;
|
||||||
private BufferedWriter outstream;
|
private BufferedWriter outstream;
|
||||||
private MCTelnet plugin;
|
private BukkitTelnet plugin;
|
||||||
private String client_ip;
|
private String client_ip;
|
||||||
private boolean show_full_log = true;
|
private boolean show_full_log = true;
|
||||||
private static final String COMMAND_REGEX = "[^\\x20-\\x7E]";
|
private static final String COMMAND_REGEX = "[^\\x20-\\x7E]";
|
||||||
private static final String LOGIN_REGEX = "[^a-zA-Z0-9\\-\\.\\_]";
|
private static final String LOGIN_REGEX = "[^a-zA-Z0-9\\-\\.\\_]";
|
||||||
|
|
||||||
public TelnetListener(Socket socket, MCTelnet plugin)
|
public BT_TelnetListener(Socket socket, BukkitTelnet plugin)
|
||||||
{
|
{
|
||||||
this.is_running = true;
|
this.is_running = true;
|
||||||
this.clientSocket = socket;
|
this.clientSocket = socket;
|
||||||
|
@ -75,7 +75,7 @@ public class TelnetListener extends Handler implements CommandSender
|
||||||
//sendTelnetCommand(WONT, ECHO);
|
//sendTelnetCommand(WONT, ECHO);
|
||||||
//sendTelnetCommand(DO, ECHO);
|
//sendTelnetCommand(DO, ECHO);
|
||||||
|
|
||||||
writeOut("[MCTelnet] - Session Started!\r\n");
|
writeOut("[BukkitTelnet] - Session Started!\r\n");
|
||||||
|
|
||||||
authenticateLoop();
|
authenticateLoop();
|
||||||
commandLoop();
|
commandLoop();
|
||||||
|
@ -94,7 +94,7 @@ public class TelnetListener extends Handler implements CommandSender
|
||||||
writeOut("Username: ");
|
writeOut("Username: ");
|
||||||
String username = instream.readLine().replaceAll(LOGIN_REGEX, "").trim();
|
String username = instream.readLine().replaceAll(LOGIN_REGEX, "").trim();
|
||||||
|
|
||||||
if (TelnetUtil.canBypassPassword(client_ip, plugin))
|
if (BT_Util.canBypassPassword(client_ip, plugin))
|
||||||
{
|
{
|
||||||
writeOut("Skipping password, you are on an authorized IP address.\r\n");
|
writeOut("Skipping password, you are on an authorized IP address.\r\n");
|
||||||
is_authenticated = true;
|
is_authenticated = true;
|
||||||
|
@ -122,6 +122,7 @@ public class TelnetListener extends Handler implements CommandSender
|
||||||
{
|
{
|
||||||
telnet_username = username;
|
telnet_username = username;
|
||||||
writeOut("Logged In as " + getName() + ".\r\n:");
|
writeOut("Logged In as " + getName() + ".\r\n:");
|
||||||
|
log.log(Level.INFO, "[" + plugin.getDescription().getName() + "]: " + client_ip + " logged in as \"" + getName() + "\".");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
|
@ -1,4 +1,4 @@
|
||||||
package com.bekvon.bukkit.mctelnet;
|
package me.StevenLawson.BukkitTelnet.BukkitTelnet;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
|
@ -9,15 +9,15 @@ import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
|
|
||||||
public class TelnetUtil
|
public class BT_Util
|
||||||
{
|
{
|
||||||
private static final Logger log = Logger.getLogger("Minecraft");
|
private static final Logger log = Logger.getLogger("Minecraft");
|
||||||
|
|
||||||
private TelnetUtil()
|
protected BT_Util()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean canBypassPassword(String user_ip, MCTelnet plugin)
|
public static boolean canBypassPassword(String user_ip, BukkitTelnet plugin)
|
||||||
{
|
{
|
||||||
if (plugin.bypass_password_ips == null)
|
if (plugin.bypass_password_ips == null)
|
||||||
{
|
{
|
||||||
|
@ -51,7 +51,7 @@ public class TelnetUtil
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void createDefaultConfiguration(String name, MCTelnet plugin, File plugin_file)
|
public static void createDefaultConfiguration(String name, BukkitTelnet plugin, File plugin_file)
|
||||||
{
|
{
|
||||||
File actual = new File(plugin.getDataFolder(), name);
|
File actual = new File(plugin.getDataFolder(), name);
|
||||||
if (!actual.exists())
|
if (!actual.exists())
|
|
@ -1,4 +1,4 @@
|
||||||
package com.bekvon.bukkit.mctelnet;
|
package me.StevenLawson.BukkitTelnet.BukkitTelnet;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -15,7 +15,7 @@ import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
public class MCTelnet extends JavaPlugin
|
public class BukkitTelnet extends JavaPlugin
|
||||||
{
|
{
|
||||||
private static final String CONFIG_FILE = "config.yml";
|
private static final String CONFIG_FILE = "config.yml";
|
||||||
private static final Logger log = Logger.getLogger("Minecraft");
|
private static final Logger log = Logger.getLogger("Minecraft");
|
||||||
|
@ -23,7 +23,7 @@ public class MCTelnet extends JavaPlugin
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public void onEnable()
|
||||||
{
|
{
|
||||||
log.log(Level.INFO, "[" + getDescription().getName() + "]: Enabled - Version " + this.getDescription().getVersion() + " by bekvon, revamped by Madgeek1450.");
|
log.log(Level.INFO, "[" + getDescription().getName() + "]: Enabled - Version " + this.getDescription().getVersion() + " by bekvon / Madgeek1450.");
|
||||||
log.log(Level.INFO, "[" + getDescription().getName() + "]: Starting server.");
|
log.log(Level.INFO, "[" + getDescription().getName() + "]: Starting server.");
|
||||||
|
|
||||||
loadConfig();
|
loadConfig();
|
||||||
|
@ -45,7 +45,7 @@ public class MCTelnet extends JavaPlugin
|
||||||
|
|
||||||
private void loadConfig()
|
private void loadConfig()
|
||||||
{
|
{
|
||||||
TelnetUtil.createDefaultConfiguration(CONFIG_FILE, this, getFile());
|
BT_Util.createDefaultConfiguration(CONFIG_FILE, this, getFile());
|
||||||
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(getDataFolder(), CONFIG_FILE));
|
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(getDataFolder(), CONFIG_FILE));
|
||||||
|
|
||||||
port = config.getInt("port", port);
|
port = config.getInt("port", port);
|
||||||
|
@ -64,7 +64,7 @@ public class MCTelnet extends JavaPlugin
|
||||||
}
|
}
|
||||||
|
|
||||||
private ServerSocket listenerSocket = null;
|
private ServerSocket listenerSocket = null;
|
||||||
private ArrayList<TelnetListener> clientHolder;
|
private ArrayList<BT_TelnetListener> clientHolder;
|
||||||
private Thread listenerThread = null;
|
private Thread listenerThread = null;
|
||||||
private boolean is_running = false;
|
private boolean is_running = false;
|
||||||
private InetAddress listenAddress = null;
|
private InetAddress listenAddress = null;
|
||||||
|
@ -117,7 +117,7 @@ public class MCTelnet extends JavaPlugin
|
||||||
log.log(Level.SEVERE, "[" + getDescription().getName() + "]: Cant bind to " + (address == null ? "*" : address) + ":" + port);
|
log.log(Level.SEVERE, "[" + getDescription().getName() + "]: Cant bind to " + (address == null ? "*" : address) + ":" + port);
|
||||||
}
|
}
|
||||||
|
|
||||||
clientHolder = new ArrayList<TelnetListener>();
|
clientHolder = new ArrayList<BT_TelnetListener>();
|
||||||
|
|
||||||
is_running = true;
|
is_running = true;
|
||||||
|
|
||||||
|
@ -146,14 +146,14 @@ public class MCTelnet extends JavaPlugin
|
||||||
client = listenerSocket.accept();
|
client = listenerSocket.accept();
|
||||||
if (client != null)
|
if (client != null)
|
||||||
{
|
{
|
||||||
clientHolder.add(new TelnetListener(client, this));
|
clientHolder.add(new BT_TelnetListener(client, this));
|
||||||
|
|
||||||
log.info("[" + getDescription().getName() + "]: Client connected: " + client.getInetAddress().getHostAddress());
|
log.info("[" + getDescription().getName() + "]: Client connected: " + client.getInetAddress().getHostAddress());
|
||||||
|
|
||||||
Iterator<TelnetListener> listeners = clientHolder.iterator();
|
Iterator<BT_TelnetListener> listeners = clientHolder.iterator();
|
||||||
while (listeners.hasNext())
|
while (listeners.hasNext())
|
||||||
{
|
{
|
||||||
TelnetListener listener = listeners.next();
|
BT_TelnetListener listener = listeners.next();
|
||||||
if (!listener.isAlive())
|
if (!listener.isAlive())
|
||||||
{
|
{
|
||||||
listeners.remove();
|
listeners.remove();
|
||||||
|
@ -186,7 +186,7 @@ public class MCTelnet extends JavaPlugin
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
for (TelnetListener listener : clientHolder)
|
for (BT_TelnetListener listener : clientHolder)
|
||||||
{
|
{
|
||||||
listener.killClient();
|
listener.killClient();
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
name: MCTelnet
|
name: BukkitTelnet
|
||||||
main: com.bekvon.bukkit.mctelnet.MCTelnet
|
main: me.StevenLawson.BukkitTelnet.BukkitTelnet
|
||||||
version: 1.3
|
version: 2.0
|
||||||
description: Telnet console access plugin.
|
description: Telnet console access plugin.
|
||||||
author: bekvon
|
author: bekvon, Madgeek1450 / StevenLawson
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue