Open mohuangNPC opened 2 weeks ago
Check SHA-224 Hash Implementation to ensure that your Sha224Util.encryptThisString(password) function is generating the SHA-224 hash as expected, Trojan expects the hex-encoded version of the SHA-224 hash, so make sure the result is correct.
Trojan protocol expects specific line breaks (CRLF, 0x0D0A), so check that the formatting exactly matches the protocol, like the following if i am not mistaking (but dont take my word for it): After the password hash, you should have a CRLF (0x0D, 0x0A). At the end of the Trojan request section, you should also include a CRLF.
When encoding destination addresses, for domain names (ATYP 0x03), make sure you correctly write the length byte, and the UTF-8 address after. And ye, make sure the encoding is right.
Socks5-like request structure - make sure the trojan request follows the exact byte order CMD (0x01) – usually represents CONNECT. ATYP (0x01 for IPv4 or 0x03 for domain names). DST.ADDR – encoded according to ATYP. DST.PORT – encoded in big-endian (network byte order). (found this on the internet, maybe it helps)
As i understand you are spawning a thread to forward data from clientInput to trojanOutput, and also handling data from trojanInput to clientOutput in proxyToClient(). just make sure these threads dont interfere with each other, maybe by calling flush() after writing data to ensure it's sent immediately
Also check that the SSLContext is correctly initialized and that trojanSocket.startHandshake() successfully establishes an ssl connection
Also, the simplest, check network configs and firewall rules.
I know this may not be within the scope of your answer, but I still hope you can help me out. I want to use Java to construct a Trojan request, and it does follow the data in the document, but it never works. This is my code. I'm sorry, I don't know where the problem is.