This should actually fix rmichela#10
This commit is contained in:
parent
1b4c7c2304
commit
0afba39d57
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>com.ryanmichela</groupId>
|
<groupId>com.ryanmichela</groupId>
|
||||||
<artifactId>sshd</artifactId>
|
<artifactId>sshd</artifactId>
|
||||||
<version>1.3.6</version>
|
<version>1.3.6.1</version>
|
||||||
<url>https://github.com/Justasic/Bukkit-SSHD/</url>
|
<url>https://github.com/Justasic/Bukkit-SSHD/</url>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -67,8 +67,7 @@ public class ConsoleLogFormatter extends Formatter {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public
|
public String format(LogRecord logrecord)
|
||||||
String format(LogRecord logrecord)
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -138,7 +138,7 @@ public class ConsoleShellFactory implements ShellFactory {
|
|||||||
this.ConsoleReader.clearScreen();
|
this.ConsoleReader.clearScreen();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Hide the mkpasswd command input.
|
// Hide the mkpasswd command input from other users.
|
||||||
Boolean mkpasswd = command.split(" ")[0].equals("mkpasswd");
|
Boolean mkpasswd = command.split(" ")[0].equals("mkpasswd");
|
||||||
|
|
||||||
Bukkit.getScheduler().runTask(
|
Bukkit.getScheduler().runTask(
|
||||||
@ -153,17 +153,12 @@ public class ConsoleShellFactory implements ShellFactory {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!mkpasswd)
|
if (!mkpasswd)
|
||||||
{
|
SshdPlugin.instance.getLogger().info("<" + this.Username + "> " + command);
|
||||||
SshdPlugin.instance.getLogger().info("<" + this.Username + "> <" + (mkpasswd ? "True": "False") + "> " + command);
|
|
||||||
|
|
||||||
}
|
|
||||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command);
|
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// This should help stop one of the bugs where bytes are waiting to be written
|
|
||||||
// but the client fucked off already so the plugin throws an exception.
|
|
||||||
((Logger)LogManager.getRootLogger()).removeAppender(this.streamHandlerAppender);
|
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
|
@ -1,49 +1,59 @@
|
|||||||
package com.ryanmichela.sshd;
|
package com.ryanmichela.sshd;
|
||||||
|
|
||||||
import org.apache.sshd.common.SshException;
|
import org.apache.sshd.common.SshException;
|
||||||
|
import org.apache.sshd.common.channel.exception.SshChannelClosedException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.math.BigInteger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright 2013 Ryan Michela
|
* Copyright 2013 Ryan Michela
|
||||||
*/
|
*/
|
||||||
public class FlushyOutputStream extends OutputStream {
|
public class FlushyOutputStream extends OutputStream
|
||||||
|
{
|
||||||
|
|
||||||
private OutputStream base;
|
private OutputStream base;
|
||||||
private boolean isClosed = false;
|
private boolean isClosed = false;
|
||||||
|
|
||||||
public FlushyOutputStream(OutputStream base) {
|
public FlushyOutputStream(OutputStream base)
|
||||||
|
{
|
||||||
this.base = base;
|
this.base = base;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(int b) throws IOException {
|
public void write(int b) throws IOException
|
||||||
if (isClosed) return;
|
{
|
||||||
base.write(b);
|
this.write(BigInteger.valueOf(b).toByteArray());
|
||||||
base.flush();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(byte[] b) throws IOException {
|
public void write(byte[] b) throws IOException
|
||||||
if (isClosed) return;
|
{
|
||||||
base.write(b);
|
this.write(b, 0, b.length);
|
||||||
base.flush();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(byte[] b, int off, int len) throws IOException {
|
public void write(byte[] b, int off, int len) throws IOException
|
||||||
if (isClosed) return;
|
{
|
||||||
try {
|
if (isClosed)
|
||||||
|
return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
base.write(b, off, len);
|
base.write(b, off, len);
|
||||||
base.flush();
|
base.flush();
|
||||||
} catch (SshException e) {
|
}
|
||||||
if (!e.getMessage().contains("channel already closed")) throw e;
|
catch (SshChannelClosedException e)
|
||||||
|
{
|
||||||
|
// ignored.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() throws IOException
|
||||||
|
{
|
||||||
isClosed = true;
|
isClosed = true;
|
||||||
|
base.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,6 @@ class MkpasswdCommand implements CommandExecutor
|
|||||||
// Dumb but whatever. Some people are really dense.
|
// Dumb but whatever. Some people are really dense.
|
||||||
if (algoritm.equalsIgnoreCase("PLAIN"))
|
if (algoritm.equalsIgnoreCase("PLAIN"))
|
||||||
{
|
{
|
||||||
sender.sendMessage("Your hash: " + password);
|
|
||||||
// I mean c'mon...
|
// I mean c'mon...
|
||||||
sender.sendMessage("Bro really? it's literally your unencrypted password...");
|
sender.sendMessage("Bro really? it's literally your unencrypted password...");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user