[ADMIN][RCON] mcrcon, remote connection client for minecraft servers

Discussion in 'Bukkit Tools' started by Tiiffi, Apr 16, 2012.

Thread Status:
Not open for further replies.
  1. Offline


    I'll send the pcap files and the steps I took to reproduce the things to you in a PM, if I can find out how to do it.. :)
    Tiiffi likes this.
  2. Offline


    Thank you for this. I made a little game with it called the Random Item Game or RIG for short. It's become quite popular on my server. Here is the code:

  3. Offline


    is there any way to toggle players chat in the Rcon?
    sorry im new at this and trying to set up a co_owner of my server
  4. Offline


    I used this to create some Nagios 3.x plugins to monitor CraftBukkit servers. Great work!
  5. Offline


    I can't seem to get this working on OS X.

    ./mcrcon -t -p 'password' -H '' -P '25576'
    Just to make sure I'm not doing anything stupid - the port argument is supposed to be the rcon port and not the server port, right?

    22:45:58 [INFO] Starting Minecraft server on *:25565
    22:45:58 [INFO] This server is running CraftBukkit version git-Bukkit-1.3.1-R1.0-b2320jnks (MC: 1.3.1) (Implementing API version 1.3.1-R1.0)
    22:46:00 [INFO] Done (1.927s)! For help, type "help" or "?"
    22:46:00 [INFO] Starting remote control listener
    22:46:00 [INFO] RCON running on
    OS X 10.6.8
    [INFO] This server is running CraftBukkit version git-Bukkit-1.3.1-R1.0-b2320jnks (MC: 1.3.1) (Implementing API version 1.3.1-R1.0)
    Server.properties: http://pastebin.com/4Ask2c9r
    mcrcon 0.0.4

  6. Offline


    Where the hell you found v0.0.5? :D

    Cool job.

    Is it possible to get same stuff that server console get? I mean things like what players say, info when they die and other stuff? It would be really cool.
    If vanilla server doesn't support sending this data maybe you could do smoe java.class to put in jar so it start working?

    It would be cool. When i'm at office i can manage the server, but i don't see the response (also when i use say command, but you wrote that it will be fixed in v0.0.5 - hope so)
  7. Offline


    As far as I know the minecraft server does not support player chat in rcon yet. :(
    It might be doable with plugins but I am not good at Java programming.

    What version of mcrcon you are using?
    And what exactly happens when you try to connect?

    Correct. The port argument must be the rcon port defined in the minecraft configuration files.

    Binaries not yet available but fully working sources can be found here: http://sourceforge.net/p/mcrcon/code/

    Looks like minecraft server software does not send player chat into rcon channel. People should request this from minecraft dev-team. I think it should be possible with plugin wizardry too.
  8. Offline


    Confirmed: I am stupid. Thanks.
  9. Offline


    I have a problem with the rcon, everytime I try to connect on my ipv6, It just says "Unable to resolve hostname", do you know how I can fix that in rcon
  10. Offline


    No IPv6 support yet. Its under development.
    TnT likes this.
  11. Offline


    diff --git a/mcrcon.c b/mcrcon.c
    index a62009b..84c95f6 100644
    --- a/mcrcon.c
    +++ b/mcrcon.c
    @@ -171,7 +171,7 @@ void            print_color(int color);
    struct in_addr  net_resolve(char *host);
    void            net_close_socket(int sd);
    -int            net_open_socket(char *host, int port);
    +int            net_open_socket(char *host, char *port);
    int            net_send_packet(int sd, rc_packet *packet);
    rc_packet*      net_recv_packet(int sd);
    #ifdef _WIN32
    @@ -221,7 +221,7 @@ int main(int argc, char *argv[])
        char *host = NULL;
        char *pass = "";
    -    int port = 25575;
    +    char *port = "25575";
        if(argc < 2) usage();
    @@ -231,7 +231,7 @@ int main(int argc, char *argv[])
                case 'H': host = optarg;        break;
    -            case 'P': port = atoi(optarg);  break;
    +            case 'P': port = optarg;        break;
                case 'p': pass = optarg;        break;
                case 'C':
                case 'c': print_colors = 0;    break;
    @@ -262,7 +262,7 @@ int main(int argc, char *argv[])
    -    if(port <= 0) {
    +    if(strlen(port) == 0) {
            fputs("Invalid port. Check -P flag.\n\n", stdout);
    @@ -355,35 +355,6 @@ void net_init_WSA(void)
    -struct in_addr net_resolve(char *host)
    -    struct in_addr address;
    -    struct sockaddr_in *sockaddr_ipv4;
    -    struct addrinfo hints, *result;
    -    int ret;
    -    memset(&hints, 0, sizeof(hints));
    -    hints.ai_family = AF_INET;
    -    hints.ai_socktype = SOCK_STREAM;
    -    hints.ai_protocol = IPPROTO_TCP;
    -    ret = getaddrinfo(host, NULL, &hints, &result);
    -    if(ret != 0)
    -    {
    -        fprintf(stderr, "Error: Unable to resolve hostname (%s).\n", host);
    -        exit(-1);
    -    }
    -    sockaddr_ipv4 = (struct sockaddr_in *) result->ai_addr;
    -    address = sockaddr_ipv4->sin_addr;
    -    freeaddrinfo(result);
    -    return address;
    /* socket close and cleanup */
    void net_close_socket(int sd)
    @@ -396,31 +367,38 @@ void net_close_socket(int sd)
    /* Opens and connects socket */
    -int net_open_socket(char *host, int port)
    +int net_open_socket(char *host, char *port)
        int sd;
    -    struct sockaddr_in sa;
    +    struct addrinfo hints, *result, *r;
    +    memset(&hints, 0, sizeof(hints));
    +    hints.ai_socktype = SOCK_STREAM;
    +    hints.ai_protocol = IPPROTO_TCP;
    -    memset(&sa, 0, sizeof(sa));            /* Set structure full of zeros. */
    -    sa.sin_family = AF_INET;                /* Address Family Inet = Protocol Family Inet. */
    -    sa.sin_port = htons(port);              /* Port number. */
    -    sa.sin_addr = net_resolve(host);        /* resolve host. */
    +    if (getaddrinfo(host, port, &hints, &result))
    +    {
    +        fprintf(stderr, "Error: Unable to resolve connection details (%s, %s).\n", host, port);
    +        exit(-1);
    +    }
    -    if((sd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
    -    {
    +    if((sd = socket(result->ai_family, result->ai_socktype, result->ai_protocol)) < 0)
    +    {
            #ifdef _WIN32
            error("Error: cannot create socket.\n");
    -    }
    +    }
    -    if(connect(sd, (struct sockaddr *)&sa, sizeof(sa)) != 0)
    +    if(connect(sd, result->ai_addr, result->ai_addrlen) != 0)
            fprintf(stderr, "Error: connection failed (%s).\n", host);
    +    freeaddrinfo(result);
        return sd;
    (This is how you use getaddrinfo().)
  12. Offline


    Status update.

    Version 0.0.5 with IPv6 support and some bugfixes will be released soon.
    After that I will be rewriting and refactoring the whole code for better code readability and fuctionality. At the moment there are some very messy functions and solutions which needs some rethinking. This revamping is mostly directed for other developers who might want to read the code or create their own ports.

    Oh yeah, I just figured it out too. Oh and thanks for that!
    Getaddrinfo is quite handy. Unfortunately it doesnt work on older Windows (Earlier than Windows XP ??).
    Does anyone need legacy Windows support?
  13. Offline


    *UPDATE (Finally :p)*

    0.0.4 -> 0.0.5

    • IPv6 support! (Thanks to 'Tanja84dk' for addressing the real need of IPv6.)
    • Fixed bug causing crash / segmentation fault (invalid write) when receiving malformed rcon packet.
    • Program makes use of C99 feature (variable-length arrays) so "-std=gnu99" flag on GCC-compiler must be used to avoid unecessary warnings.
    • Rcon receive buffer is now bigger (2024 bytes -> 10240 bytes). Thanks to 'gman_ftw' @ Bukkit forums.
    • Fixed invalid error message when receiving empty rcon packet (10 bytes). Thanks to 'pkmnfrk' @ bukkit forums.
    • Terminal mode now closes automatically when rcon socket is closed by server or if packet size cannot be retrieved correctly.
    • Client now tries to clean the incoming socket data if last package was out of spec.
    Download here!
  14. Offline


    Um.. A little help please! I wrote the correct code. When I run it is saying the same message constantly:
    C:\Users\_\Desktop>mcrcon -t -H (My IP) -p (Password)
    This is coming up with this message about 10 a second!

  15. Offline



    Does it say anything after you execute the command?
    It sounds like its trying to resolve ip or make the connection but for some reason it timeouts. It should inform you if connections fails or if something weird happens.

    Here is some checks you can make.
    1. Make sure that your minecraft server has rcon enabled.
    2. Make sure you are connecting to right port (25575 by default but check your minecraft server properties anyway).
    3. Make sure that your host ip / address is correct.
    Note that you can also use the launch script included in the windows package! Just start the launch.bat and it should automatically prompt for connection information.
  16. Offline


    it was detected as a virus on my pc, and automatically deleted !
  17. Offline


    Your viruscanner is giving false positive results.

    There is no malware unless sourceforge servers has been hacked and I highly doubt that.
    Ofcourse everyone can check the sources and compile it themselves if they dont trust precompiled binaries. Thats exactly why I am providing sourcecodes too.

    Viruscan results:
    And this is what Softpedia thinks about it!

    Now I am interested:
    1. What operating system you are running?
    2. What viruscanner you are using?
    3. More specific information about the "detection". Screenshot? Name of the virus signature?
    Make sure you dont have virus or worm infecting files on your computer.
  18. Offline


    This is awesome! Much props on this man :D
    Tiiffi likes this.
  19. Offline


    Tiiffi and hawkfalcon like this.
  20. Offline


    Excellent job! Thumbs Up!

    And yeah its perfectly OK to include the binaries.
    My only "non-mandatory" request is to keep my nick and credits there. ;)

    Oh and stay tuned for more updates. Client will be rewritten (keepings the 100% backwards compatibility) and gamespy query protocol will be added.
  21. Offline


    Of course :). Can't wait to see the update :D
  22. Offline


    Some updates on this project.

    At the moment I am occupied with other network projects so the next release of mcrcon will be waiting for a while. Of course the client will be updated immediately if serious bug is found so report any weird behaviour to me.

    Here is what I am planning to do with mcrcon:
    • Refactoring (as in Rewriting the code) for cleaner more standard codebase.
    • Better more stricter compliance for valve rcon protocol so the client may be used with valve games too!
    • Gamespy query protocol will be implented in a way or another. Not sure if it will be separate program or integrated with mcrcon. Any thoughts on this?
    • Maybe curses based user interface (TUI = Textual User Interface) which means much better usability for Mac OSX and Linux & Unixes. Simple command line tool like usage will be preserved of course.
    • Maybe native GUI (Graphical User Interface) for Windows releases.
    • Maybe simple IRC capability. This means you can set the client to join to irc channel which acts as commanding channel. Any real need for this?
    phaed likes this.
  23. Offline


    I just noticed that Bukkit server rcon functionality may gave been altered which causes mcrcon -t (terminal mode) to not work as expected (disconnects after first command).

    Can anyone confirm this with different server versions?

    I will write a patch if necessary and if possible (depending on the changes they made).
    If there are changes, I really hope there is a support for player chat now. :D
  24. Offline


    Dumb question how do i actually open this on mac?

    lemme rephrase i open it but it loads and the process is instantly completed.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 25, 2016
  25. Offline


    To start in terminal mode on OSX us this command from terminal:

    ./mcrcon -t -H ip_here -P port_here -p password_here

    I've just started using this program. Well done! I have noticed that there is no carriage return in the returned text from a server (see picture bellow). Should there be?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 25, 2016
  26. Offline


    You got it right. It is actually a nasty bug in Vanilla minecraft server (and on many server & server mods derived from it).

    I am actually working on "hacky patch" which will add carriage returns in front of the '/' slash characters. That should at least help with command listings while the bug is present.

    It is command line tool so open console first and then run the command like Volition said.
    My future plan is to build console based user interface for more user friendly experience.

    I could also write shell script which prompts user for connection information. There is already one for Windows release.
  27. Offline


    id love that lol i cut figure out how to make it work for the life of me

    and my server also isn't vanilla :/

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 25, 2016
  28. Offline


    What server you are using?
    I need the information so I can test my software against different servers for maximal compatibility.
  29. Offline


    I'm using a dedicated host with bukkit 1.4.4 on it ip
  30. Offline


    How do you actually use this? Can you make a quick tutorial? I'm really dumb at this. Please reply.
Thread Status:
Not open for further replies.

Share This Page