Changing Your Flag

How I changed my anonymous flag to a photo. It's not particularly accessible to non-programmers yet, but I'm sure will be added to the SFW code soon. My instructions assume you are using a Mac.

1. Find the image you want. I think it needs to be in PNG format. 64x64 pixels works well. On a Mac you can use the Preview application to downsize a larger image, and export it in PNG format.

Save it as flag.png on your desktop.

Chrome developer tools Network view.

2. Masquerade as your SFW client. In the Chrome browser, choose the menu item View -> Developer -> Developer Tools. Select the "Network" tab. Make a change to a page until you see an item with method PUT.

Find your cookie.

Click one of the PUT items and look for the line beginning "Cookie:" in the Headers tab. Copy the remainder of that line to your clipboard. It should start with "session=".

3. Make your request. Copy the code below to a text file, e.g. in the TextEdit application.

curl -X "POST" "http://YOUR_DOMAIN/favicon.png" \ -H "Cookie: YOUR_COOKIE" \ -H "Content-Type: application/json" \ -d "{\"image\": \"`base64 < ~/Desktop/flag.png`\"}"

Replace: - YOUR_DOMAIN with the domain name of your wiki, e.g. - YOUR_COOKIE with the value you copied at the end of step 2 (without any surrounding quotation marks).

Copy-paste that edited code (now with your domain and cookie) into the Terminal app. Press enter.

You should see a response "Favicon Saved" if all went well. Reload your wiki to see your new flag.

After running the command once, you can use the up arrow to get the command back (now all on one line) then enter again to re-run the command.

## Troubleshooting

If you get back a wall of text starting with "TypeError: Cannot call method &#39;replace&#39; of undefined", the server didn't understand your request.

Make sure that your text editor didn't replace the "dumb" quotes in the code with "smart" quotes.

#Changing it back

Download a favicon icon from fedwiki. Then in the command line change /flag.png to /favicon.png.

#For Windows Users Jon Udell This method hack presumes a Unix-style system. The tools required -- curl, base64 -- can run on Windows. I happen not to have them on the Windows machine I'm on at the moment. But I do have Fiddler, a tool that can debug and even manufacture HTTP requests. So I used that, along with an online tool that converted my flag.png into the textual representation the server expects. <p> I don't think anyone but me is likely to use this method. As Alex said, the result is clearly interesting to folks here, and so may become accessible without gymnastics. <p> But it sure is refreshing to be reminded, yet again, how radically flexible systems based on web technology are.

##For Programmer-Wannabes