# Discord PingPong

Oh god this one was really annoying to set up

Running the executable returns:

```Successfully connected to Discord API
Last message in #general is: Welcome to our secret server! Only trusted bots and users have access to the secret channels. Our secret plans have been moved from here to a secret channel.
Bot is now running. Press CTRL-C to exit.

Sending anything through stdin wouldn't yield anything.

running `file` on it:

`discordbot: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, Go BuildID=_ZEAdEO-wvSQGBQYhkGM/xFUNbqa5yDNs4HrN4WQF/IfIgpWbUNMnt11lPcn7W/sNa0sC3hsaXC9dymZEeD, not stripped`

So yeah, golang.

Searching google for a Go discord bot returns:


And it contains the pingpong example:


Which also matches this string in the source:
`Bot is now running. Press CTRL-C to exit.`

However not much of it is useful.. any passed arguments to the bot are ignored.

# Intended solution

Apparently, what was needed to complete the challenge was just to run `strings` on the discordbot file and extract the discord api token, and then get the flag from the secret discord server.

# How I worked it out

So I had originally run `strings` on the file, but it returned so much data and sifting through it would have been hell..

Having some knowledge of Golang requests, I knew that by default the net/http library respects the environment variables for proxies.

Knowing this, launch burp and set the environment variables in my terminal for the HTTP and HTTPS proxies to ``, and added the Burp Suite CA certificate to `/usr/local/share/ca-certificates`

Helpful links for this:

After that, you can see the requests through Burp, you just run the discordbot, get the token, and retrieve the flag from one of the channels using the discord api.

Sorry, I didn't take screenshots, and it was annoying to set up again :/

Original writeup (https://github.com/xxonorg/dCTF2021_Writeup/blob/main/Discord%20PingPong.md).