confusedman's blog

By confusedman, history, 4 years ago, In English

UPDATE 2: It seems codeforces has added back AES, the original cf-tool will no longer work. The one posted here should work for parsing problem test cases though. (5th August 2020)

UPDATE 1: Since codeforces rolled back the AES update, the original cf-tool should work fine.

I have been using the codeforces cf-tool by xalanq quite extensively and was disappointed to learn that the new RCPC decryption update had completely broken the amazing tool.

So I thought it would be fixed soon by xalanq but it turns out that his last visit was 4 months ago.

There is a good possibility that he will not see these messages and there won't be an update to the tool... So I learnt Go and cloned his public repository, managing to add extra functionality that makes it possible to parse contests and test cases. This means that we can use cf parse <contest number> and cf test freely. However, it still isn't possible to login (hoping somebody can fix this?).

Anyway, here's the public repository: https://github.com/confusedman1/cf-tool

And here's the binary file release: https://github.com/confusedman1/cf-tool/releases/tag/v1.1

Tutorial

When you type in cf config, you should see the following:


0) login 1) add a template 2) delete a template 3) set default template 4) run "cf gen" after "cf parse" 5) set host domain 6) set proxy 7) set folders' name 8) add RCPC token

You have to choose option 8 and add your RCPC token before anything can work. The way you can obtain your RCPC token is by logging in to codeforces normally on the website, opening the developer console, and entering document.cookie. This should give you a very long string that contains something like this : ;RCPC=b82f94cccc963782ef928c71012df34e;. In this case, b82f94cccc963782ef928c71012df34e is the token you should enter after selecting option 8.

That's it, now you should be able to successfully parse contests/problems.

Thanks to xalanq for making cf-tool, prophet_ for identifying the AES issue and providing a foundation to fix it. Good luck to gevacrt, you are still active these days so I hope you can fix your tool!

  • Vote: I like it
  • +37
  • Vote: I do not like it

| Write comment?
»
4 years ago, # |
Rev. 3   Vote: I like it 0 Vote: I do not like it

Hello,

Thanks so much! When I tried this, it still didn't work...

Submit CONTEST 1111, problem d Not logged. Try to login Login el_heffeh... Cannot find csrf

Edit: Sorry, the above was for "cf submit." When I tried to do "cf parse," it comes in with another error:

$ cf parse 7 Parse CONTEST 7 Cannot find any problem statis

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Are you sure you correctly entered your RCPC token?

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Yes, I did F12 (inspect) then in the console typed "document.cookie" and under RCPC that's what it gave me.

      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        It's working fine for me, the only time I get 'Cannot find any problem statis' is when my RCPC token is set incorrectly. Try refreshing the codeforces page and updating the RCPC token on the terminal.

        • »
          »
          »
          »
          »
          4 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          It wasn't working yesterday, but now it works. Thanks!

          P.S. When do you think you can get the submit function to work?

          • »
            »
            »
            »
            »
            »
            4 years ago, # ^ |
              Vote: I like it +3 Vote: I do not like it

            Codeforces fortunately rolled back the AES decryption, which means you can download the original one by xalanq and all the functions should work perfectly.

            • »
              »
              »
              »
              »
              »
              »
              4 years ago, # ^ |
                Vote: I like it 0 Vote: I do not like it

              Submit works fine, but parsing the problems still does not parse the testcases.

              • »
                »
                »
                »
                »
                »
                »
                »
                4 years ago, # ^ |
                  Vote: I like it 0 Vote: I do not like it

                Just checked, it works fine for me. Are you sure you are using the one by xalanq?

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  4 years ago, # ^ |
                    Vote: I like it 0 Vote: I do not like it

                  Just checked again, now it works! Maybe was something with cache or the like.

            • »
              »
              »
              »
              »
              »
              »
              4 years ago, # ^ |
                Vote: I like it 0 Vote: I do not like it

              the old one by xalanq works now for parsing, but the submit function still does not work for me.

              • »
                »
                »
                »
                »
                »
                »
                »
                4 years ago, # ^ |
                  Vote: I like it 0 Vote: I do not like it

                You need to pass in the problem id for submit to work I think.

                • »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  »
                  4 years ago, # ^ |
                    Vote: I like it 0 Vote: I do not like it

                  Oh well, I did that and it still doesn't work. rip

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

rip xalanq

»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Thanks for making this partial fix to cf tools!

I've recently written a script to automatically decode the RCPC token from the command line, without needing to read from browser cookies. https://mirror.codeforces.com/blog/entry/80135

Perhaps you could potentially integrate something like this to automatically add the token?

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    I saw your post, but converting it from python to Go will take me some time since I just learnt Go.

»
4 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

I am noob. I don't understand what I should do after going to the binary file release. The cf file doesn't have any extension. Is it the exe file? And I am using windows.

»
4 years ago, # |
  Vote: I like it +8 Vote: I do not like it

As an alternative of cf tool, you can use ai-virtual-assistant . It works for not only codeforces but also a lot jugdes out there.