Giter Site home page Giter Site logo

coc-proxy-csharp's Introduction

#coc-proxy-csharp

Build, then run with:

coc-proxy-csharp.exe

Warning: This does not automatically close the other side when the connection to the client or server closes. In fact, it doesn't even detect that either side has closed and will still try to send data on the closed socket.

##Installation

Install libsodium-net with NuGet.

Patch libg.so with:

adb pull /data/data/com.supercell.clashofclans/lib/libg.so
dd if=libg.so of=key-backup.bin skip=$(<libg.so.offset) bs=1 count=32
xxd -p -c 32 key-backup.bin
echo 72f1a4a4c48e44da0c42310f800e96624e6dc6a641a9d41c3b5039d8dfadc27e | xxd -r -p > key-new.bin
xxd -p -c 32 key-new.bin
dd if=key-new.bin of=libg.so seek=$(<libg.so.offset) bs=1 count=32 conv=notrunc
adb push libg.so /data/data/com.supercell.clashofclans/lib/libg.so

Be sure the correct offset for your client version and device platform is in your libg.so.offset file, or replace $(<libg.so.offset) with the appropriate offset in the above commands. Also, be sure to confirm the remote location of the libg.so file on your platform. For example, the file is stored at /data/app-lib/com.supercell.clashofclans-2/libg.so on Kitkat.

See the Key Offsets wiki page for the offsets in the various versions of libg.so.

###Routing Packets

This topic is expansive and is outside the scope of this document. See the Routing Packets wiki page for more information.

coc-proxy-csharp's People

Contributors

clugh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

coc-proxy-csharp's Issues

CryptographicException with unpatched libg.so

System.Security.Cryptography.CryptographicException occurred
  HResult=-2146233296
  Message=Failed to open PublicKeyBox
  Source=Sodium
  StackTrace:
       at Sodium.PublicKeyBox.Open(Byte[] cipherText, Byte[] nonce, Byte[] secretKey, Byte[] publicKey)
       at coc_proxy_csharp.ServerCrypto.DecryptPacket(Socket socket, ServerState state, Byte[] packet) in coc-proxy-csharp\ServerCrypto.cs:line 36
  InnerException: 

This is almost certainly due to running without a patched libg.so. I can see there are hardcoded keys for both the client and server at the top of ClientCrypto and ServerCrypto. My guess is that I need to update this with the appropriate data for my real client (on ios). Are those keys listed anywhere currently?

How to add sodium and Newtonsoft.Json.Linq packages

Hi!
It's the first time I'm trying to compile a C# app like this and I'm not able to compile it. I used Nuget like you said to install the sodium lib, but there is always an error on the ClientCrypto.cs.

How to include the nuget package in the references to compile the proxy ?

Thanks

Converting proxy to standalone server

Excellent work with the proxy. I couldn't be more impressed with your first C# project.

I'm trying to convert your proxy to a private server that doesn't pass traffic to the real server. The approach I am using so far is to modify ServerCrypto.decryptPacket() to not call ClientCrypto.encryptPacket(). Instead, I will create messages in response to messages from the client.

When creating the 20104 message, what would my values for the nonce and shared key be? I'm hoping I can just make up a nonce (PublicKeyBox.GenerateNonce()). For a shared key, would I need to call crypto_box_beforenm? I don't see that exposed in the LibSodium.NET wrapper, but I can call the libsodium.dll directly if needed. If that's what I need to do, which of the public and private keys would I pass it?

Thanks for your help.

Patching libg.so

The script given to patch libg.so uses xxd which is not part of windows, how would I go and patch it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.