Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6045009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:04:38+00:00 2026-05-23T07:04:38+00:00

The Quest I’m trying to talk to a SRCDS Server from node.js via the

  • 0

The Quest

I’m trying to talk to a SRCDS Server from node.js via the RCON Protocol.
The RCON Protocol seems to be explained enough, implementations can be found on the bottom of the site in every major programming language. Using those is simple enough, but understanding the protocol and develop a JS library is what I set out to do.

Background

Being a self taught programmer, I skipped a lot of Computer Science Basics – learned only what I needed, to accomplish what I wanted. I started coding with PHP, eventually wrapped my head around OO, talked to databases etc. I’m currently programming with JavaScript, more specifically doing web stuff with node.js ..

Binary Data?!?!

I’ve read and understood the absolute binary basics. But when it comes to the packet data I’m totally lost. I’d like to read and understand the wireshark output, but I can’t make any sense if it. My biggest problem is probably that I don’t understand what the binary representation of the various INT and STRING (char ..) from JS look like and how I convert from data I got from the server to something usable in the program.

Help

So I’d be more than grateful if someone can point me to a tutorial on these topics. Tutorial as in “explanation that mere mortals can understand, preferably not written by a C.S. professor”. 🙂
When I’m looking at the PHP reference implementation I see (too much) magic happening there which I can’t translate to JS. Sending and reading data from a socket is no problem, but I need to know how PHPs unpack function works respectively how I can do that in JS with node.js.

So I hope you can see what I’m trying to accomplish here. First and foremost is understanding the whole theory needed to make implementing the protocol a breeze. But because I’m only good with scripting languages it would be incredibly helpful if someone could guide me a bit in the HOWTO part in PHP/JS..

Thank you so much for your time!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T07:04:39+00:00Added an answer on May 23, 2026 at 7:04 am

    I applaud the low level protocol pursuit.

    I’ll tell you the path I took. My approach was to use the client and server that already spoke the protocol and use libpcap to do analysis. I created a library that was able to unpack the custom protocol I was analyzing during this phase.

    Its super helpful to start with diagrams like this one:

    TCP Header

    From the wiki on TCP. Its an incredibly useful way to visualize the structure of the binary data. Its tightly packed, so slicing it apart requires attention to detail.

    Buffers and Binary

    I read up on Buffer. Its the way you deal with Binary in node. http://nodejs.org/docs/v0.4.8/api/buffers.html — the first thing to realize here is that buffers can be accessed bit by bit via array syntax, ie buffer[0] and such.

    Visualization

    Its helpful to be able to dump your binary data into a hex representation. I used https://github.com/a2800276/hexy.js to achieve this.

    node_pcap

    I grabbed https://github.com/mranney/node_pcap — this is the equivalent to wireshark, but you can programmatically poke at all outgoing and incoming traffic. I added udp payload support: https://github.com/jmoyers/node_pcap/commit/2852a8123486339aa495ede524427f6e5302326d

    I read through all mranney’s “unpack” code https://github.com/mranney/node_pcap/blob/master/pcap.js#L116-171

    I found https://github.com/rmustacc/node-ctype

    I read through all their “unpack” code https://github.com/rmustacc/node-ctype/blob/master/ctio.js

    Now, things to remember when you’re looking through this stuff. Most of the time they’re taking a binary Buffer representation and converting to a native javascript type, like say Number or String. They’ll use advanced techniques to do so — bitwise operations like shifts and such. You don’t necessarily need to understand all that.

    The key things are:

    1) endianness — the ordering of bits (network and host byte order can be reverse from each other) as this pertains to how things are unpacked

    2) Javascript Number representation is quirky — node-ctype goes into detail in the comments about how they convert the various number types in javascript’s Number. Integer, float, double etc are all Number in javascript land.

    In the end, its likely fine if you just USE these unpackers for your adventures. I ended up having to unpack things that weren’t covered in these libraries, like GUIDs and such, and it was tremendously helpful to study the source.

    Isolate the traffic you’re looking at

    Filter, filter, filter. Target one host. Target one direction. Target one message type. Focus on stripping off data that has a known fixed length first — often times the header in a protocol is a good place to start. Once you get the header unpacking into a nice json structure from binary, you are well on your way.

    After that, its one field at a time, top to bottom, one message at a time. You can use Buffer#slice and the unpack functions from node-ctype to grab each piece of data at a time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my quest to learn javascript (which seems to be my latest source of
In my everlasting quest to suck less I'm trying to understand the yield statement,
In my quest in trying to learn more about OOP in PHP. I have
In my quest to transition from a decade of C++ to Ruby, I find
I'm using Quest's TOAD for SQL Server on a SQL Server 2000 Server. Here
Which is a better way to select ans and quest from the table? SELECT
I am trying to use the jquery get statement: $.get(urlAddress+.asmx, { question: quest },
In my quest to understand queries against Django models, I've been trying to get
We are using Quest Geo Solution's Grid InQuest DLL (GIQ60.DLL) within an SQL Server
In my epic quest of making C++ do things it shouldn't, I am trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.