[INACTIVE][ADMIN/DEV] TCP interface for Bukkit - v1.2 [617]

Discussion in 'Inactive/Unsupported Plugins' started by DerpinLlama, Jan 16, 2011.

     
  1. Offline

    DerpinLlama

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    I AM NO LONGER DEVELOPING THIS PLUGIN.
    Anyone who wants to continue are obviously allowed to use my code and start a new thread. Don't forget to give me credit though. :p


    BukkitTcpServer:
    Version: v1.2

    Hai guis.

    I've been working on an interface to connect to Bukkit via things like PuTTY (http://www.chiark.greenend.org.uk/~sgtatham/putty/).
    As hey0 pointed out in another topic, this could theoretically allow any language with a socket API to be used for Bukkit.

    At the moment, clients that are authenticated with the server will receive messages about players chatting, players joining, and players quitting. (Post requests here if you want moar.)

    Place the BukkitTcpServer.jar file into your plugins folder and the properties file into your server's folder. (Remember to change the default password to something else!)
    Then you can download something like PuTTY, connect to your server (port is in the properties file), and type 'pass ' then your password. :)

    Current commands:
    • currenttime <world name>
    • eventtoggle <chat/join/quit>
    • getplayers
    • invadd <player name> <block type> <amount>
    • invprobe <player name>
    • invremove <player name> <slot> <type> <amount>
    • invset <player name> <slot>
    • json [on|off]
    • kick <playername>
    • maxplayers
    • msg <message>
    • pid
    • playercount
    • pm <player name> <message>
    • port
    • quit
    • time <world name> <time - as a string that can be converted to long>
    This plugin was compiled on CraftBukkit build 617 - be careful when using it on other versions.

    You can send donations via Bitcoin to 1CTKB67Cs9mZ6vpDJeanH5Dp8MnEkBrCNp. :)

    Feedback/comments would be nice. :)

    Remember that you're sending your password over plain text with no encryption please.

    Features:
    • My plugin makes cake
    • And eats it
    Jar

    Sauce

    Changelog:
    Version 1.2:
    • Some code for the invset and invadd commands cleaned up, thanks to cyberbobjr.
    • Added command event.
    • Compiled against CraftBukkit #449 (1.1 was against #297)
    • Edit: Now compiled again against #617.
    Version 1.1
    • Currenttime and time commands fixed so they take world name parameters.
    • GPL license applied.
    • Fixed PM command.
    • Updated support for drdanick's Remote Toolkit.
    • Probably some other stuff that I forgot about.
    Version 1.0
    • Now writing to the socket with writeBytes instead of writeUTF. Programs that remove the first two bytes will need to be fixed.
    • Added JSON functionality. The getplayers and invprobe commands will always output JSON info, while the others will need to be changed to JSON outputs using 'json on'.
    • Config file now has options for turning chat/join/quit events on/off.
    Version 0.9
    • Begun changelog because I finally got around to it.
    • Added option to bind to localhost.
    cyberbobjr and MonsieurApple like this.
  2.  
  3. Offline

    Nijikokun

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Not connecting for me, build 50 says it's listening shows me connecting but in putty nothing happens.
  4. Offline

    DerpinLlama

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    I compiled this with build 61. Can you try it with that please?
  5. Offline

    DerpinLlama

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Ok, I fail. When parsing the properties file, it was looking for 'pasword' instead of 'password'. Re-uploaded.
  6. Offline

    Joh

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    I suggest not using this plugin unless you have the latest build


    I used it on build 44 and the server had massive lagg, Everything in console was doubled. and there where invisible monsters. people took steps and randomly got damage ( No Mobs on server).


    Only use the latest build, For your sake and your users.

    Otherwise great plugin.
  7. Offline

    Danny

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    I'm wondering if there are any .Net programmers around that could give me a little advise, this is vb.net, everything works until i go to send data; I never receive the authenticated method, it works in putty, so i'm clearly not sending the data properly, heres the source.

    Code:
    Imports System.Net.Sockets
    Imports System.Text
     
    Public Class Form1
        Dim ClientSocket As New System.Net.Sockets.TcpClient
        Dim serverSteam As NetworkStream
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim serverStream As NetworkStream = ClientSocket.GetStream
            Dim buffSize As Integer
            Dim Message As String = ""
       
            Dim inStream(10024) As Byte
            buffSize = ClientSocket.ReceiveBufferSize
            serverStream.Read(inStream, 0, buffSize) 'This waits for an input so would have to be in it's own thread.
            Dim b As String = System.Text.Encoding.BigEndianUnicode.GetString(inStream)
     
            MsgBox("Data from server: " & (b)) 'This works, gets the responce "welcome to bukkit please autheticate"
    
            Dim outstream As [Byte]() = System.Text.Encoding.BigEndianUnicode.GetBytes("pass password")
            serverStream.Write(outstream, 0, outstream.Length)
            serverStream.Flush()
    
            ReDim inStream(10024)
            buffSize = ClientSocket.ReceiveBufferSize
            serverStream.Read(inStream, 0, buffSize) 'the code freezes here, which means the above isn't getting sent.. =[
            b = System.Text.Encoding.BigEndianUnicode.GetString(inStream)
    
            MsgBox(b)
    
        End Sub
    
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            ClientSocket.Connect("127.0.0.1", 6790) 'connect to the server
        End Sub
     
    End Class
    
  8. Offline

    EvilSeph Bukkit Team Member Administrator

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    If you're going to do something like this, security should be your highest priority. Currently, as far as I can see, this has none.

    Furthermore, though I like this plugin and the idea behind it, coding a Plugin Loader would be a better choice as it would be more robust.
  9. Offline

    DerpinLlama

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    It already has password protection. Maybe you can suggest another way to secure this?
  10. Offline

    Andred

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Gonna make a GUI in Visual Basic so you can track the killer's IP address?
  11. Offline

    Wolfy9247

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Tried it, if correct password = PuTTY exiting.
  12. Offline

    DerpinLlama

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    It only closes a connection under the following conditions:
    You use the quit command, duh.
    You get the password wrong.
    Bukkit loses connection to you.
  13. Offline

    ShivalWolf

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Is it possible to get access to the save-all and stop commands.
    Under a Linux server I have been finding that if I stop the server during a shutdown or its force killed the save activity does not happen. If there was a remote connection option for save and shutdown I can alter my init script to send the save then shutdown commands so everything saves and exits cleanly.
  14. Offline

    Danny

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Well I was hoping to use it to make a basic chat bot to test the possbilities of this tcp plugin (this was litterly something I threw together.) I've notcied, if i loop the receive part, it *does* work, but receives weird chracters, so probablly an encoding issue somewhere..
    will continue playing till i get it working.

    [edit]
    I've refined and tested, i'm now receiveing correctly, I'm just not sending. I'm not getting autheticated, if I try and send the password i get disconnected, because something isn't sending correctly. if i don't send the password, I can still receive the events, I just can't send any requests (bad bug btw, try connecting and not providing a password, you still get all the chats etc)
    I have a request, could I have a debug build where you post to the console exactly what data is being received by your plugin (from connected ports) during all phases including authentication, that way I can try and get this working, and maybe release something.

    [edit #2]
    Isolated your bug for you.
    If you authenticate once, all clients connecting afterwards are automatically authenticated to the server, which is why I could receive things without having to log in.

    still want that debug build though, because I'm still not sending packets to you right (or you're not dealing with them correctly, or something, but having a debug on the server would make it 1000 times easier)
    [IMG]
    [Edit #3]
    I figured out why it "wasn't" sending, it's because it required you to send the equiv of "\n" before it'll evaluate your line, which makes sense as It was designed for putty, but now it gives me "Wrong Password" even though the password is right.. Still waiting on that debug :p
  15. Offline

    EvilSeph Bukkit Team Member Administrator

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Password protection is kind of pointless if you don't encrypt traffic, for example.
  16. Offline

    pmx

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    I'm currently working on a project that needs multiple php process to be able to share a job queue, to do that I have a broker script that accepts tcp connections on the internal ip address to add/get jobs from the queue. For auth I have a challenge system. First the CLIENT asks the server to prove it is the server they want to talk to by sending a challenge, this challenge gets hashed with a mutually known key and passed back. If this matches the clients own idea of the hash then the client asks for a login key - this is a random hash that is created for that specific request and held in memory. To login the client now has to hash this login key with another mututally shared password key and send it back. this way the clients and server are sure of who they are talking to and the passwords never get sent over the socket. Traffic is not encrypted on mine because its only ever on the local interface but like EvilSeph said, you should think about doing that, too.
  17. Offline

    DerpinLlama

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    I'll have a go at adding encryption.
  18. Offline

    Danny

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    An alternative route is to only accept connections on a particular IP, that could be configured. E.g. 127.0.0.1
    If you do add encryption, could you make it optional maybe?
  19. Offline

    DerpinLlama

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Of course.
    --- merged: Jan 17, 2011 8:05 PM ---
    ShivalWolf, I do not think those commands can be called from within a plugin.

    Danny, the bug you reported in edit two should be fixed now. The second one is not a bug, that's deliberate. You must send a new line character before it'll read as a line.

    Edit: Sorry I messed that up. Uploading in a sec...
    Edit 2: Try now.
  20. Offline

    DerpinLlama

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    No encryption. Couldn't find an easy way to do it.
  21. Offline

    ShivalWolf

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    It is a shame that those commands can't be reached by a plugin. I may have to look myself.

    As for encryption unless you wanted to break basic access via putty yeah you would have alot of trouble. When you add encryption you would need a client that worked with that encryption. You could try using SSL but then you would need a way to talk SSL to the plugin.

    Hmmm this plugin has me thinking of actually trying to write a plugin. I will have to wait till after work though. tcp/udp socket bound to localhost and some form of web interface comes to mind.
  22. Offline

    DerpinLlama

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Obviously if I did get encryption working I'd supply a client to replace PuTTY that is compatible with my encryption.
  23. Offline

    ShivalWolf

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
  24. Offline

    DerpinLlama

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Added pm command, updated files.
  25. Offline

    DerpinLlama

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Added invprobe and invremove commands, commented unused code.
  26. Offline

    reexe

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Hi, i have a problem, whenever i disconnect it does not seem to close the session, cus when i loggin next time i get the outputs 2 times, so if some1 type a chat message i will se it twice.
    And now i see it 5 times, seems to get worse every time i reconnect, the quit command does not seem to help.
    What shoud i do? Can i restart the plugin whitout restarting my server?
  27. Offline

    faulpelz

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    this looks very promising. would be awesome if this plugin could add full remote console functionallity to bukkit.
    as far as encryption goes: i agree that sending a plain txt password is not the best idea, but that way it is fairly easy to build your own client and securing it is not really rocket science. just let it listen on localhost and for the outside world put up a ssl tunnel.
  28. Offline

    DerpinLlama

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    I think I know which bug you were talking about, and that was fixed already. Try re-downloading it.

    Either Bukkit itself or the General plugin allows you to enable/disable/reload plugins on-the-fly.
    --- merged: Jan 19, 2011 3:52 PM ---
    This is something I haven't been able to do yet - no Bukkit dev has talked to me on the subject.
    Yes, that's a good way around the plain text thing.

    On the subject of encryption, did you know that IRC clients send your commands (i.e. nickserv identify) via plain text unless you're using SSL? Most people aren't. Minecraft also seems to send your account password over plain HTTP to minecraft.net.
  29. Offline

    SteveMcGrath

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    May I make an observation here?

    Instead of a RAW TCP connection (and all the issues that come with that), why not consider a RESTful or XMLRPC interface? This would make handling requests a bit easier as well as handling encryption (via SSL) quite simple. The hardest part in this case would be to come up with a decent basic set of commands that can be sent to the interface that would be considered useful.
  30. Offline

    reexe

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    I still have problem whith the chat and other stuff in the console being presented to me twice and sometimes even more if i reconnect whitout using quit command. And yes i have updated.
    Also is it possible to be multiple users to be logged in on the thing? Cus i want my mods to use this to be able to kick greifers.
  31. Offline

    DerpinLlama

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Sorry, I have no experience with that.


    I think I've fixed it. Compiled against CraftBukkit snapshot #106 this time.
    Yes, more than one connection can be opened to the server.
    Edit: Wait... wut. I typed in a command in one connection and it came up in another. xD
    2nd edit: I see what's going wrong, but I don't know how to fix it.
    3rd edit: Oh, it involved using "this."... Lol. Anyway, new version going up.

Share This Page