92 Commits

Author SHA1 Message Date
8fdda295e2 Update mcrcon.1 2019-11-19 09:47:05 +02:00
0b1853dccc Update INSTALL.md 2019-11-19 09:17:20 +02:00
d338537e23 Update README.md 2019-11-19 09:16:11 +02:00
f4fb9e27ab updated CHANGELOG.md 2019-04-15 09:31:16 +03:00
a2b2117af5 Incrementing version number 2019-04-15 09:03:49 +03:00
1c5d807121 Merge pull request #20 from Hagb/develop
Fix UTF-8 and something about color code
2019-04-15 08:37:27 +03:00
42f06c89a8 Fix UTF-8 and something about color code 2017-08-17 23:36:04 +08:00
60f8dc946c Added travis-ci build status images. 2017-01-09 15:31:28 +02:00
10789a7c44 Force compiler on Windows. 2017-01-07 11:36:52 +02:00
6523e58d4a Merge pull request #16 from meatballhat/macos-touchup
Touchups for MacOS
2017-01-04 23:09:11 +02:00
02ae39747e Changes per feedback on #16 2017-01-03 15:40:43 -05:00
9ccea062c6 Merge pull request #15 from meatballhat/env-var-typo
Fix env var typo in man page
2016-12-28 01:17:12 +02:00
64c8c6ba16 Define EXTRAFLAGS to avoid issues with -fstack-protector-strong 2016-12-27 11:49:35 -05:00
f02e32793d More make and CI bits tweaks 2016-12-27 11:43:21 -05:00
b4a64d21cd More touchups to CI bits 2016-12-27 11:40:18 -05:00
afbed173aa Merge remote-tracking branch 'origin/macos-touchup' into travis-maybe 2016-12-27 11:37:15 -05:00
56389a8bec Add some Travis integration 2016-12-27 11:33:52 -05:00
0198ca77a7 Touchups for MacOS 2016-12-26 22:12:00 -05:00
598297b9c6 Fix env var typo in man page 2016-12-26 22:00:26 -05:00
1d559bd8ef Update INSTALL 2016-12-17 20:20:27 +02:00
3fdf9d570d Version history draft for v0.6.0, updated version numbering and changed console prompt character back to original one. 2016-12-17 20:17:32 +02:00
f54b2efd21 Update README.md 2016-12-17 20:12:53 +02:00
a043b6fa54 Update README.md 2016-12-17 20:10:20 +02:00
c5d1e95ef8 Update README.md 2016-12-16 21:45:08 +02:00
d0e293f249 Changed program return values to EXIT_FAILURE and EXIT_SUCCESS macros. 2016-12-16 21:39:30 +02:00
46e7ed1781 Fix README.md markdown formatting. 2016-12-16 21:22:09 +02:00
2f8c462c0f Added support for setting basic options with environment variables. 2016-12-16 21:13:01 +02:00
b8776a0984 Removed unallowed newlines. 2016-12-14 00:31:32 +02:00
a416251bfb Merge branch 'develop' of https://github.com/Tiiffi/mcrcon into develop 2016-12-14 00:14:14 +02:00
6ef31675d8 Added EXTRAFLAGS variable to Makefile. 2016-12-14 00:13:12 +02:00
b878ff1255 Comment cleanups and munged output bug (https://github.com/Tiiffi/mcrcon/issues/2) fixed. 2016-12-14 00:10:49 +02:00
8441c578be Update README.md 2016-11-16 18:16:10 +02:00
29f1f9c400 Merge pull request #14 from Tiiffi/refactoring/networking
Refactoring/networking
2016-11-15 22:21:13 +02:00
951f39cdbd Merge branch 'refactoring/networking' of https://github.com/Tiiffi/mcrcon into refactoring/networking 2016-11-15 21:59:47 +02:00
57d0cdbf95 Minor cleanups. 2016-11-15 21:59:30 +02:00
71d10a0af0 Update README.md 2016-11-15 21:46:02 +02:00
93e3e54357 Update and rename COMPILING to INSTALL 2016-11-15 21:44:07 +02:00
16819a6992 Update README.md 2016-11-15 21:21:03 +02:00
1c5654de2d Update README.md 2016-11-15 21:19:20 +02:00
796fb23195 README.md update. 2016-11-15 21:17:53 +02:00
e763c4df73 Merge branch 'refactoring/networking' of https://github.com/Tiiffi/mcrcon into refactoring/networking 2016-11-15 21:14:40 +02:00
6f0af9964c Typo fixes. 2016-11-15 21:14:30 +02:00
d2b434daf9 Merge branch 'refactoring/networking' of https://github.com/Tiiffi/mcrcon into refactoring/networking 2016-11-15 21:14:16 +02:00
f879937329 Typo fix. 2016-11-15 21:13:48 +02:00
c9a740a3ce Added "Installing" paragraph. 2016-11-15 21:06:00 +02:00
4d12f96e21 Update COMPILING 2016-11-15 20:55:54 +02:00
46af96a3a4 Moved changelog and compiling to own files and updated usage info in README.md. 2016-11-15 20:41:58 +02:00
a0e638edc9 Code style changes. 2016-11-15 20:28:33 +02:00
f9595188d5 manpage improvements. 2016-11-15 19:48:28 +02:00
c1bfcbb611 Improved error messages and version flag info added to usage helper. 2016-11-15 19:48:10 +02:00
d92a60bed4 Added Install / uninstall rules to Makefile and made changes to error printing. Also now password is not set by default and terminal mode is activated automatically if there are no commands to execute. 2016-11-13 18:12:03 +02:00
449eac6358 Added manpage to the project. 2016-11-13 14:16:14 +02:00
88c91d4096 Updated compiler flags. 2016-11-13 14:15:29 +02:00
786767e9f1 License update. 2016-11-13 14:12:30 +02:00
edc750ccef Added packet_build_malloc() forward declaration and type cast to 2nd argument of send() function to silence windows compiler warnings. 2016-10-28 03:21:16 +03:00
3e60b0d28f Added Windows support to Makefile. 2016-10-28 01:41:38 +03:00
a0d3d7f52e Commented windows version define and changed net_init_WSA() to request Winsock version 2.2 instead of old 1.1. 2016-10-28 01:40:38 +03:00
4b663958aa README.md update. 2016-10-27 03:33:04 +03:00
cbbdbcca93 net_init_WSA() function and error reporting improvements. 2016-10-27 03:25:28 +03:00
c9e3f86a89 Makefile improvements. 2016-10-27 03:23:32 +03:00
c5731c1109 New indentation and changes in net_connect error reporting. 2016-10-26 21:08:09 +03:00
9c6c8e3069 Replaced some networking functions with new ones. 2015-11-19 07:16:00 +02:00
7605586324 Changed port in example command. 2015-11-04 22:31:09 +02:00
e8f685ff0a README and help tweaks. 2015-11-04 22:08:44 +02:00
0a803aab55 .gitignore update. 2015-11-04 22:07:53 +02:00
7e10b01691 Merge pull request #11 from Kotobaminers/develop
Cross compile support + gnu99
2015-10-15 00:59:23 +03:00
660a2a1e27 Cross compile support 2015-10-15 00:45:56 +03:00
915f9a7972 Update README.md 2015-01-20 04:53:47 +02:00
1c367aa725 Update README.md 2015-01-20 04:48:40 +02:00
4f1ec0c0f9 Update README.md 2015-01-20 04:45:36 +02:00
e4e0d95e5e Update README.md 2015-01-20 04:45:12 +02:00
26159e7cc3 Updated LICENSE. 2015-01-19 03:04:35 +02:00
873e7672fb Updated years in license text. 2015-01-19 02:12:33 +02:00
e924373898 Removed "more info" link from readme. 2015-01-19 02:10:54 +02:00
c503dedd37 Update README.md 2015-01-19 02:08:19 +02:00
e2b3bb16e3 Update README.md 2015-01-19 02:06:27 +02:00
5f05286170 Moving version history from source file to readme. 2015-01-19 02:02:42 +02:00
3ab3e51889 Merge pull request #8 from Kotobaminers/develop
Ignoring built file
2015-01-19 01:03:37 +02:00
0a117b008c Ignoring built file 2015-01-19 00:48:21 +02:00
d1266e97b3 Minor formatting changes. 2015-01-13 20:05:10 +02:00
1d8175faba Update README.md 2015-01-13 15:02:55 +02:00
79f0d7ad09 Merge pull request #6 from Kotobaminers/readme
Updating README.md with fixed indent (retry)
2015-01-13 14:49:24 +02:00
670e599554 Fixing indent 2015-01-13 14:38:13 +02:00
957ff80842 Merge pull request #3 from Kotobaminers/Makefile
Creating Makefile to easy compile
2015-01-13 14:32:40 +02:00
f5c0ab9fde Enable rcon section to README.md 2015-01-13 08:24:39 +02:00
062156a006 Adding Usage section to readme.md 2015-01-13 08:16:46 +02:00
044cd6640e Creating Makefile to easy compile 2015-01-13 07:54:14 +02:00
5b6c192686 Fixed indentation. 2015-01-05 11:02:50 +02:00
91ac3e3fac Reformatted help string. 2015-01-05 05:24:03 +02:00
64dc3ac2d0 Added "r" to options handler string. 2015-01-05 05:19:53 +02:00
9809d13d63 Updated help function and added raw output functionality in "packet_print" function. 2015-01-05 05:15:25 +02:00
b1a42cb993 New option -r (raw output) for opts parser. 2015-01-05 05:06:30 +02:00
9 changed files with 888 additions and 524 deletions

5
.gitignore vendored
View File

@ -2,5 +2,8 @@
*.o
*.dev
*.win
*.txt
*.layout
*.project
*.project
mcrcon
todo

20
.travis.yml Normal file
View File

@ -0,0 +1,20 @@
language: c
sudo: false
dist: trusty
cache:
ccache: true
compiler:
- gcc
- clang
env:
global:
- EXTRAFLAGS='-v'
- PREFIX="${HOME}"
install:
- 'true'
script:
- make
- ./mcrcon -h
- ./mcrcon -v
- make install
- make uninstall

79
CHANGELOG.md Normal file
View File

@ -0,0 +1,79 @@
####Version history:
######0.6.1
- Color coding fixed
* Thanks to Hagb @ Github
######0.6.0
- Version numbering changed to more sane system (0.0.5 -> 0.6.0)
- Fixed munged output
- Support for using environment variables to set some basic options
- Cleaned networking code
- Various code cleanups
- Changes and updates in usage text and error reporting
- Version option flag (-v) added
- Man page added
- Proper makefile added
######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.
######0.0.4
- Reverted back to default getopts options error handler (opterr = 1).
Custom error handler requires rewriting.
- Some cosmetic changes in program output strings.
- Program usage(); function now waits for enter before exiting on Windows.
######0.0.3
- Colors are now supported on Windows too!
- Terminal mode is now triggered with "-t" flag. "-i" flag still works for
backwards compatibility.
- Bug fixes (Packet size check always evaluating false and color validity
check always evaluating true).
######0.0.2
- License changed from 'ISC License' to 'zlib/libpng License'.
- Bug fixes & code cleanups
- Interactive mode (-i flag). Client acts as interactive terminal.
- Program return value is now the number of rcon commmands sent successfully.
If connecting or authentication fails, the return value is -1.
- Colors are now enabled by default. Now '-c' flag disables the color support.
######0.0.1
- Added experimental support for bukkit colors.
Should work with any sh compatible shell.
- Packet string data limited to max 2048 (DATA_BUFFSIZE) bytes.
No idea how Minecraft handles multiple rcon packets.
If someone knows, please mail me so I can implement it.
####TODO:
- Make the receive buffer dynamic??
- Change some of the packet size issues to fatal errors.
- Code cleanups.
- Check global variables (remove if possible).
- Add some protocol checks (proper packet id check etc..).
- Preprocessor (#ifdef / #ifndef) cleanups.
- Follow valve rcon protocol standard strictly?
- Multiple packet support if minecraft supports it?!
- Investigate if player chat messages gets sent through rcon.
If they are, the messaging system requires rewriting.
- Name resolving should be integrated to connection creation function.
- Dont try to cleanup the socket if not authenticated
- Better sockets error reporting
- Better error function (VA_ARGS support)

22
INSTALL.md Normal file
View File

@ -0,0 +1,22 @@
Compiling and installing
------------------------
Only dependency is C library with POSIX getopt support.
Compiling with GCC or CLANG:
cc -std=gnu99 -Wpedantic -Wall -Wextra -Os -s -o mcrcon mcrcon.c
Note: on Window remember to link with winsockets by adding "-lws2_32" to your compiler command line.
Or you can just run "make":
make - compiles mcrcon
make install - installs compiled binaries and manpage to the system
make uninstall - removes binaries and manpage from the system
file install locations:
/usr/local/bin/mcrcon
/usr/local/share/man/man1/mcrcon.1
Makefile "install" and "uninstall" rules are disabled on windows.

View File

@ -1,4 +1,4 @@
Copyright (c) 2012-2013, Tiiffi <tiiffi --> gmail_dot_com>
Copyright (c) 2012-2016, Tiiffi <tiiffi_at_gmail_dot_com>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages

50
Makefile Normal file
View File

@ -0,0 +1,50 @@
# if you want to cross compile
# export PATH=$PATH:/path/to/compiler/bin
# export CROSS_COMPILE=arm-none-linux-gnueabi-
# make
EXENAME = mcrcon
PREFIX ?= /usr/local
EXTRAFLAGS ?= -fstack-protector-strong
INSTALL = install
LINKER =
RM = rm -f
ifeq ($(OS), Windows_NT)
CC = gcc
LINKER = -lws2_32
EXENAME = mcrcon.exe
RM = cmd /C del /F
endif
ifeq ($(shell uname), Darwin)
INSTALL = ginstall
CFLAGS ?= -std=gnu99 -Wall -Wextra -Wpedantic -Os
else
CFLAGS ?= -std=gnu99 -Wall -Wextra -Wpedantic -Os -s
endif
.PHONY: all
all: $(EXENAME)
$(EXENAME): mcrcon.c
$(CROSS_COMPILE)$(CC) $(CFLAGS) $(EXTRAFLAGS) -o $@ $< $(LINKER)
ifneq ($(OS), Windows_NT)
.PHONY: install
install:
$(INSTALL) -vD $(EXENAME) $(PREFIX)/bin/$(EXENAME)
$(INSTALL) -vD -m 0644 mcrcon.1 $(PREFIX)/share/man/man1/mcrcon.1
@echo "\nmcrcon installed. Run 'make uninstall' if you want to uninstall.\n"
.PHONY: uninstall
uninstall:
rm -f $(PREFIX)/bin/$(EXENAME) $(PREFIX)/share/man/man1/mcrcon.1
@echo "\nmcrcon uninstalled.\n"
endif
.PHONY: clean
clean:
$(RM) $(EXENAME)

View File

@ -1,10 +1,70 @@
####Compiling:
### Installing:
```gcc -std=gnu11 -pedantic -Wall -Wextra -O2 -s -o mcrcon mcrcon.c```
from sources:
```sh
git clone https://github.com/Tiiffi/mcrcon.git
cd mcrcon
make
sudo make install
```
Check **INSTALL** for more details.
On windows, remember to link with winsockets.
Add ```-lws2_32``` to compiler command line on Mingw GCC.
You can also download precompiled binaries*: https://github.com/Tiiffi/mcrcon/releases/latest
<sub>*At the moment binaries are provided for Linux and Windows.</sub>
---
More info [here](http://forums.bukkit.org/threads/admin-rcon-mcrcon-remote-connection-client-for-minecraft-servers.70910/).
### Usage:
mcrcon [OPTIONS] [COMMANDS]
Sends rcon commands to Minecraft server.
```
Option:
-h Print usage
-H Server address
-P Port (default is 25575)
-p Rcon password
-t Interactive terminal mode
-s Silent mode (do not print received packets)
-c Disable colors
-r Output raw packets (debugging and custom handling)
-v Output version information
```
Commands with arguments must be enclosed in quotes.
Server address, port and password can be set using following environment variables:
```
MCRCON_HOST
MCRCON_PORT
MCRCON_PASS
```
Note that command-line options will override environment variables.
Example:
```mcrcon -H my.minecraft.server -p password "say Server is restarting!" save-all stop```
---
### Enable rcon on server
Remember to enable rcon by adding following lines to ```server.properties``` file.
```
enable-rcon=true
rcon.port=25575
rcon.password=your_rcon_pasword
```
---
#### Contact:
* WWW: https://github.com/Tiiffi/mcrcon/
* MAIL: tiiffi_at_gmail_dot_com
* IRC: tiiffi @ quakenet
* BUG REPORTS: https://github.com/Tiiffi/mcrcon/issues/
---
<sub>Master:</sub> ![Master build](https://api.travis-ci.org/Tiiffi/mcrcon.svg?branch=master)
<sub>Develop:</sub> ![Develop build](https://api.travis-ci.org/Tiiffi/mcrcon.svg?branch=develop)

63
mcrcon.1 Normal file
View File

@ -0,0 +1,63 @@
.\" Process this file with
.\" groff -man -Tascii mcrcon.1
.\"
.TH MCRCON 1 "December 2016" "Version 0.6.1"
.SH NAME
mcrcon \- sends rcon commands to a Minecraft server
.SH SYNOPSIS
.B mcrcon [
options
.B ] [
commands
.B ]
.SH DESCRIPTION
mcrcon is Minecraft rcon client / terminal with bukkit coloring support.
It is well suited for remote administration and server maintenance scripts.
.SH OPTIONS
.IP -h
Print usage
.IP -H
Server address
.IP -P
Port (default is 25575)
.IP -p
Rcon password
.IP -t
Interactive terminal mode
.IP -s
Silent mode (do not print received packets)
.IP -c
Disable colors
.IP -r
Output raw packets (for debugging and custom handling)
.IP -v
Output version information
.PP
Commands with arguments must be enclosed in quotes.
.SH ENVIRONMENTAL VARIABLES
Server address, port and password can be set using following environment variables:
.PP
\fBMCRCON_HOST
.br
\fBMCRCON_PORT
.br
\fBMCRCON_PASS\fR
.PP
Note that command-line options will override environment variables.
.SH EXAMPLES
Make rcon connection in terminal mode using default port
.RS
\fBmcrcon\fR -H my.minecraft.server -p password
.RE
.PP
Send "weather clear" command to server using custom port 1337
.RS
\fBmcrcon\fR -H my.minecraft.server -P 1337 -p password "weather clear"
.RE
.PP
Send three commands to server (say, save-all and stop)
.RS
\fBmcrcon\fR -H my.minecraft.server -p password "say Server is restarting!" save-all stop
.RE
.SH BUGS
Bugs can be reported to \fBtiiffi_at_gmail_dot_com\fR or \fBhttps://github.com/Tiiffi/mcrcon/issues/\fR

1101
mcrcon.c

File diff suppressed because it is too large Load Diff