<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Knowledge Base (Posts about chat)</title><link>https://bgstack15.ddns.net/blog/</link><description></description><atom:link href="https://bgstack15.ddns.net/blog/categories/chat.xml" rel="self" type="application/rss+xml"></atom:link><language>en</language><copyright>Contents © 2022 &lt;a href="mailto:bgstack15@gmail.com"&gt;bgstack15&lt;/a&gt; 
&lt;a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/"&gt;
&lt;img alt="Creative Commons License BY-SA"
style="border-width:0; margin-bottom:12px;"
src="https://bgstack15.ddns.net/.images/l_by-sa_4.0_88x31.png"&gt;&lt;/a&gt;</copyright><lastBuildDate>Sun, 27 Feb 2022 04:05:08 GMT</lastBuildDate><generator>Nikola (getnikola.com)</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Get discord authorization token for ripcord the hard way</title><link>https://bgstack15.ddns.net/blog/posts/2022/02/22/get-discord-authorization-token-for-ripcord-the-hard-way/</link><dc:creator>bgstack15</dc:creator><description>&lt;p&gt;I saw that a friend was using &lt;a href="https://cancel.fm/ripcord/"&gt;ripcord&lt;/a&gt; and I wanted to try it. Thankfully, rpm-fusion-nonfree already had it available!&lt;/p&gt;
&lt;p&gt;To log ripcord into your Discord account, you need to follow the &lt;a href="https://cancel.fm/ripcord/static/app_misc/discord_token_howto_en-US.png"&gt;instructions&lt;/a&gt; which are apparently no good in Linux. I was unable to open the web inspector in the program to extract the right request header.&lt;/p&gt;
&lt;p&gt;However, I researched using Discord with a web proxy, and learned that with some command line parameters you can get the Linux Discord binary to use a web proxy. I had a &lt;a href="https://bgstack15.ddns.net/blog/posts/2020/10/04/setting-up-a-transparent-proxy-for-internal-network/"&gt;proxy already&lt;/a&gt;, and I pointed Discord to that with:&lt;/p&gt;
&lt;pre class="code literal-block"&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;/usr/lib64/discord/Discord --proxy-server=http://server4.ipa.internal.com:3128
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I adjusted the &lt;code&gt;/etc/squid.conf&lt;/code&gt; setting to include all headers: &lt;code&gt;%&amp;gt;h&lt;/code&gt;.&lt;/p&gt;
&lt;pre class="code literal-block"&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;logformat squid %ts.%03tu %&amp;gt;a %&amp;gt;A %03&amp;gt;Hs %ssl::bump_mode "%{User-Agent}&amp;gt;h" %rm %&amp;gt;ru %[un %&amp;lt;a %mt "%&amp;gt;h"
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And restarted squid, of course. I had also added directive &lt;code&gt;log_mime_hdrs on&lt;/code&gt; which might have made a difference.&lt;/p&gt;
&lt;p&gt;And then finally, with Discord spewing squid logs, I pressed &lt;code&gt;CTRL+R&lt;/code&gt; to reload and then I was able to capture the elusive Authorization tag on the &lt;code&gt;library&lt;/code&gt; request.&lt;/p&gt;
&lt;pre class="code literal-block"&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="mf"&gt;1645140815.634&lt;/span&gt; &lt;span class="mf"&gt;292.15.42.25&lt;/span&gt; &lt;span class="n"&gt;vm2&lt;/span&gt;&lt;span class="mf"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ipa&lt;/span&gt;&lt;span class="mf"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="n"&gt;ernal&lt;/span&gt;&lt;span class="mf"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt; &lt;span class="mf"&gt;200&lt;/span&gt; &lt;span class="n"&gt;bump&lt;/span&gt; &lt;span class="s"&gt;"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) discord/0.0.17 Chrome/91.0.4472.164 Electron/13.6.6 Safari/537.36"&lt;/span&gt; &lt;span class="kr"&gt;GET&lt;/span&gt; &lt;span class="n"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;//&lt;/span&gt;&lt;span class="n"&gt;discord&lt;/span&gt;&lt;span class="mf"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;api&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;v9&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="err"&gt;@&lt;/span&gt;&lt;span class="n"&gt;me&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;library&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mf"&gt;162.159.138.232&lt;/span&gt; &lt;span class="n"&gt;application&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt; &lt;span class="s"&gt;"Connection: keep-alive\r\nX-Super-Properties: eyJvcyI6IklpbnV4IiwioYJvd3NlciI7IkRpc2NmcmQgQ2pWm250IiwicmVsZWFzZn9jaGFubmVsIjoic3RhYmxlIiwiY2xpZ05kX3klcpNpl24iOiIwinAuMTciLCJvc192ZXJzaW9uIjoiNS4xNS4xNi0xMDAuZmMzNC54ODZfNjQnLCJvc18hcmNoInoieDY0Iiw2c3lzdGVtm2xvY2FFZSI6ImVuLVVnIiwid2lupG93X21hbmFnZXIiOiJYpkNFLHhmw2UiLCJebGllbrRfYnVpnGRfbnmtYmVnIjoxMpUzOTAlImNslWVulF9ldeVudF9z93VyYeUiOm21bG29\r\nX-Fingerprint: 4747279586394l2896.xw7Xk829mzlamNHlpbh5TsNLlTc\r\nX-Discord-Locale: en-US\r\nX-Debug-Options: bugReporterEnabled\r\nAccept-Language: en-US\r\nAuthorization: Mz3zNT41PjN5MlAzMEd3NTsx.hIg2Yu.sRo41PZ5S6ElG5P5AkM0QvHJbUI\r\nUser-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) discord/0.0.17 Chrome/91.0.4472.164 Electron/13.6.6 Safari/537.36\r\nAccept: */*\r\nSec-Fetch-Site: same-origin\r\nSec-Fetch-Mode: cors\r\nSec-Fetch-Dest: empty\r\nReferer: https://discord.com/channels/345623971105205893/344566260183208135\r\nAccept-Encoding: gzip, deflate, br\r\nCookie: __stripe_mid=2d4f2d8b-9edd-4939-9924-1a4fc1d382c2f5c03b; __dcfduid=81a1b6951ccb118c996e220a0c0303cd; __sdcfduid=81d1b8959cf931ac926e32090a6a07c654e5d65d958e05548c49e6a5cbf57443b805cc59954d5ac5af40b2a806fb86aa; __cf_bm=ijkhQ2ab63VuWPoNwHMMfRZo93P2wTx.M5ZaqR3s4K5-1685180538-1-AaGxFbXF0H68MxagOUmNhIzJSn4BL3wPa/ELs8ZoY6A3rxB339kZ2abladSI2XxKUmhX5NfbDLnhISHTSDSlaLc3vZ8Ctp/m4k5DzcMxksaYf+zZCEXgWRIsim9g0Omkr2==\r\nHost: discord.com\r\n"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And then I could paste that into ripcord!&lt;/p&gt;
&lt;pre class="code literal-block"&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;Mz3zNT41PjN5MlAzMEd3NTsx.hIg2Yu.sRo41PZ5S6ElG5P5AkM0QvHJbUI
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And yes, of course I randomized this token before publishing.&lt;/p&gt;
&lt;h4&gt;Bonus&lt;/h4&gt;
&lt;p&gt;For Fedora users, be sure to install &lt;a href="https://dev.cancel.fm/tktview?name=59d620444e"&gt;qt5-qtimageformats&lt;/a&gt;!&lt;/p&gt;
&lt;h3&gt;Alternative avenues that didn't work&lt;/h3&gt;
&lt;p&gt;I was thinking that I could do a tcpdump, gather all the packets, load in the private key of the TLS certificate to wireshark, and inspect the traffic. But I don't know how to import the TLS private key.&lt;/p&gt;
&lt;p&gt;Of course, as I already mentioned, the devtools in the Electron layer must not be enabled. If it were enabled in the binary I was using, I wouldn't have needed to do all this proxy stuff.&lt;/p&gt;
&lt;h2&gt;References&lt;/h2&gt;
&lt;h3&gt;Useful weblinks&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href="https://old.reddit.com/r/discordapp/comments/b20a0x/method_of_setting_a_proxy_for_discord/"&gt;Method of setting a proxy for Discord : discordapp&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://stackoverflow.com/questions/60920199/http-proxy-squid-logging-where-can-i-find-the-details-of-my-http-request-re"&gt;HTTP Proxy: Squid: Logging: Where can I find the details of my http request &amp;amp; response body - Stack Overflow/&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;Useless avenues&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href="https://stackoverflow.com/questions/30294600/how-to-include-chrome-devtools-in-electron"&gt;How to include Chrome DevTools in Electron? - Stack Overflow&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://serverfault.com/questions/87428/can-squid-http-proxy-dump-all-client-server-headers"&gt;Can squid http proxy dump all client/server headers? - Server Fault&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.squid-cache.org/Doc/config/log_mime_hdrs/"&gt;squid : log_mime_hdrs configuration directive&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;</description><category>audio</category><category>chat</category><category>discord</category><category>hack</category><category>proxy</category><category>ripcord</category><guid>https://bgstack15.ddns.net/blog/posts/2022/02/22/get-discord-authorization-token-for-ripcord-the-hard-way/</guid><pubDate>Tue, 22 Feb 2022 14:13:57 GMT</pubDate></item></channel></rss>