Town of Salem game sessions are not stored anywhere, meaning you have to video record the game in order to analyze it later.

What it does

Consigliere is designed to capture game sessions. Instead of recording your screen, it intercepts the Town of Salem client connection and reads data from that.

How I built it

Starting out, I captured network traffic using Wireshark while playing the game. By observing the communication between the client and server, I was able to determine the general message structure.

The protocol is fairly simple: 0x06 0x03 0x64 0x51 0x77 0x34 0x77 0x39 0x57 0x67 0x58 0x63 0x51 0x00

It is parsed as follows:

  • First byte: Message type 0x06 (ChatBoxMessage)
  • Second byte: Player (1-15) who sent the message.
  • Rest of data: chat message contents
  • Last byte: null terminator

Here's how this message looks parsed: Name of Player 3: Why me? smh

From there, it was as simple as adding pcap4j to my build.gradle

Challenges I ran into

  • Java bits are signed. Need I say more?
  • Apparently the developers couldn't decide on whether to send a byte or a string literal to represent numbers. The result: most messages send bytes, but a select few use strings.

Accomplishments that I'm proud of

  • This is 99% reverse engineering. The 1% is because I copied some message IDs from this project (but not the actual message parsing).
  • I have never used so many string formatters in my life

What I learned

  • I like making stuff that aggregates data.
  • More regex

What's next for Consigliere

  • A UI to replace/complement the console interface
  • A method of capturing packets that doesn't involve libpcap or administrative privileges.

Try It out



java, pcap4j

Devpost Software Identifier