xinetd + shell script echoing flags in TCP packet
0
votes
1
answer
221
views
I'm trying to create a script that replicates a JSON status response from a Minecraft server (https://wiki.vg/Server_List_Ping) . I've currently set up
xinetd
to execute a shell script that echos a preset back, but I'm having trouble crafting the TCP packet. For some reason it returns whatever comes after echo
, ignoring any flags. Here's a stripped down case that replicates the issue:
/usr/bin/mc
#!/bin/sh
# hello!
echo -en "\x68\x65\x6c\x6c\x6f\x21"
/etc/xinetd.d/minecraft
service minecraft
{
type = UNLISTED
instances = 20
socket_type = stream
protocol = tcp
wait = no
user = root
group = root
server = /usr/bin/mc
port = 25565
disable = no
}
TCP reply data as seen from the client that initiated the request:
00000000: 2d65 6e20 5c78 3638 5c78 3635 5c78 3663 -en \x68\x65\x6c
00000010: 5c78 3663 5c78 3666 5c78 3231 0a \x6c\x6f\x21.
Do I need to read the client request first, or is echo
aliased to something else if called from xinetd
?
Asked by gupti
(3 rep)
Dec 13, 2020, 01:50 AM
Last activity: Dec 13, 2020, 02:38 AM
Last activity: Dec 13, 2020, 02:38 AM