{"id":21937364,"url":"https://github.com/jasondrawdy/ecp","last_synced_at":"2025-09-05T02:04:42.949Z","repository":{"id":183138431,"uuid":"141962355","full_name":"jasondrawdy/ECP","owner":"jasondrawdy","description":"A lightweight, flexible, and extensible network communcations protocol created with security in mind and focuses on the productivity of both potential clients and servers.","archived":false,"fork":false,"pushed_at":"2020-05-01T21:11:50.000Z","size":68,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-27T13:48:13.816Z","etag":null,"topics":["communications","cryptography","encryption","library","networking","protocol","security","tcp","tcp-client","tcp-server","udp","udp-client","udp-server"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jasondrawdy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-07-23T04:46:59.000Z","updated_at":"2022-07-12T08:18:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"42f17a22-973a-40c0-87bf-7bfcce9ffedb","html_url":"https://github.com/jasondrawdy/ECP","commit_stats":null,"previous_names":["jasondrawdy/ecp"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasondrawdy%2FECP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasondrawdy%2FECP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasondrawdy%2FECP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasondrawdy%2FECP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jasondrawdy","download_url":"https://codeload.github.com/jasondrawdy/ECP/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244967535,"owners_count":20539971,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["communications","cryptography","encryption","library","networking","protocol","security","tcp","tcp-client","tcp-server","udp","udp-client","udp-server"],"created_at":"2024-11-29T01:19:15.671Z","updated_at":"2025-03-22T14:22:19.562Z","avatar_url":"https://github.com/jasondrawdy.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg width=\"256\" height=\"256\" src=\"https://user-images.githubusercontent.com/40871836/43414723-3fac85b2-93f9-11e8-9794-61e8a4281465.png\"\u003e\n\u003cp\u003e\n\n# ECP\n\u003cp align=\"left\"\u003e\n    \u003c!-- Version --\u003e\n    \u003cimg src=\"https://img.shields.io/badge/version-1.0.0-brightgreen.svg\"\u003e\n    \u003c!-- Docs --\u003e\n    \u003cimg src=\"https://img.shields.io/badge/docs-not%20found-lightgrey.svg\"\u003e\n    \u003c!-- License --\u003e\n    \u003cimg src=\"https://img.shields.io/badge/license-MIT-blue.svg\"\u003e\n\u003c/p\u003e\n\nA lightweight, flexible, and extensible network communications protocol created with security in mind and focuses on the productivity of both potential clients and servers. ECP is built on top of multiple layers of security and is meant to be a base for anyone looking to implement networking into their own applications; ECP comes bundled with AES in CBC mode for general data encryption, SHA256 for checksum generation and validation, and Diffie-Hellman is used as the main key exchange algorithm. Given that the library is a base for other networking applications, ECP comes with some of the basic features and tools that are normally included in likewise software such as logging and packet management.\n\n### Requirements\n- .NET Framework 4.6.1\n\n# Features\n- A completely event based and object oriented library\n- Accept socket connections from the *Local Area Network*\n- Accept socket connections from the *Wide Area Network* (Internet)\n- Listen for data on a custom port number\n- Connect to an `ECPServer` using a username\n- Broadcast data to a specific user\n- Broadcast data to all currently connected users\n- All data is encrypted with AES256 in CBC mode with SHA2 hashing support\n- Multiple hashing algorithms and encoding algorithms have been incorporated\n    - #### Hashing\n        - MD5\n        - RIPEMD160\n        - SHA1\n        - SHA256\n        - SHA384\n        - SHA256\n    - #### Encoding\n        - Base64\n        - UTF8\n        - ASCII\n        \u003cbr\u003e\u003cbr\u003e\n- Allows multiple instances of both `ECPClient` and `ECPServer`\n- Multithreaded and thread handling with a multi-instanced thread manager\n- Logging capabilities with timestamps and entry levels\n- Simple packet management with parsing and encryption\n\n# TODO\n##### Updates\n- [ ] Allows both IPv4 and IPv6 addresses\n- [ ] Thread manager needs optimizing\n- [ ] Most constructors and some methods need overloading with proper properties\n- [ ] `ECPUser` objects should be generated on connection as well as their temporary names until user authentication\n\n##### New Features\n- [ ] File Transfers\n- [ ] All methods now have async versions\n\n##### Bugs\n- [x] \"*Broadcast All*\" doesn't encrypt text with client keys\n- [x] Keep-alive packets aren't sent encrypted even if the key isn't null\n- [x] Shutdown commands aren't sent encrypted even if the key isn't null\n- [x] Packets from both server and client do not have any structure to them; they only have termination chars\n- [x] Sending a `{SHUTDOWN}` command from the client causes a loop if ECPClient.Disconnect() is called afterwards\n- [ ] Client doesn't process text before initial shutdown command from server\n- [ ] Closing the server before sending a `{SHUTDOWN}` command to the Client will cause the Client to infinitely loop\n- [ ] Sending broken handshake requests like `xxx{HANDSHAKE}` breaks the tunnel requiring another handshake\n- [ ] Sending broken handshake replies like `{HREPLY}` or `xxx{HREPLY}` breaks the tunnel requiring another handshake\n\n# Examples\n### Server\nCreating a new server using the ECP library is fairly easy. In this example, we'll create a new `ECPServer` CLI application which will just greet the user and begin accepting connections on port 80 while listening for data from those sockets.\n```c#\nusing System;\nusing System.Text;\nusing ECP; // Always remember to import our library.\n\nnamespace ECPServer\n{\n    class Program\n    {\n        /// \u003csummary\u003e\n        /// The server that will be used for all incoming socket connections.\n        /// \u003c/summary\u003e\n        static ECPServer server = new ECPServer();\n\n        /// \u003csummary\u003e\n        /// The main entry point for our application.\n        /// \u003c/summary\u003e\n        static void Main(string[] args)\n        {\n            // Greet our user with any relevant information.\n            PrintGreeting();\n\n            // Create a new ECP server and set our event handlers.\n            server.OnServerConnect += OnConnect;\n            server.OnServerDisconnect += OnDisconnect;\n            server.OnDataReceived += OnDataReceived;\n            server.OnLogOutput += OnLogOutput;\n\n            // Start listening for data on the provided port.\n            server.Start(80); // Any general or unused port is valid.\n        }\n\n        /// \u003csummary\u003e\n        /// Prints a generic user greeting to the console.\n        /// \u003c/summary\u003e\n        static void PrintGreeting()\n        {\n            Console.WriteLine(\"============================================\");\n            Console.WriteLine(\"            Welcome to ECPServer            \");\n            Console.WriteLine(\"          Written By: Jason Drawdy          \");\n            Console.WriteLine(\"============================================\");\n        }\n\n        /// \u003csummary\u003e\n        /// Returns a string formatted with the current time of day and date.\n        /// \u003c/summary\u003e\n        static string GetTimestamp()\n        {\n            return (\"(\" + DateTime.Now.ToLongTimeString() + \" - \" + DateTime.Now.ToShortDateString() + \") \");\n        }\n\n        /// \u003csummary\u003e\n        /// Handles the socket connection of an incoming user.\n        /// \u003c/summary\u003e\n        static void OnConnect(object sender, ServerConnectEventArgs args)\n        {\n            Console.WriteLine(GetTimestamp() + \"ECPServer has been initialized!\");\n        }\n\n        /// \u003csummary\u003e\n        /// Handles the closing of a socket from a disconnecting user.\n        /// \u003c/summary\u003e\n        static void OnDisconnect(object sender, ServerDisconnectEventArgs args)\n        {\n            Console.WriteLine(GetTimestamp() + \"ECPServer has been stopped!\");\n        }\n\n        /// \u003csummary\u003e\n        /// Handles incoming data from a currently connected user.\n        /// \u003c/summary\u003e\n        static void OnDataReceived(object sender, ServerDataReceivedEventArgs args)\n        {\n            // Simply reads the incoming data and rebroadcasts it to all connected users.\n            Console.WriteLine(GetTimestamp() + args.User + \": \" + Encoding.ASCII.GetString(args.Data));\n            server.BroadcastAll(Encoding.ASCII.GetString(args.Data), args.User);\n        }\n\n        /// \u003csummary\u003e\n        /// Handles the logging of any internal data passed to the current server instance.\n        /// \u003c/summary\u003e\n        static void OnLogOutput(object sender, LogOutputEventArgs args)\n        {\n            // Print any errors or log events to the console.\n            if (args.Error != null)\n                Console.WriteLine(GetTimestamp() + args.Error.Message);\n            else\n                Console.WriteLine(GetTimestamp() + args.Output);\n        }\n    }\n}\n```\n\n\n### Client\nCreating an `ECPClient` is just as easy as creating an `ECPServer`. In this example, we'll create a client with a specified username and connect to the previously created `ECPServer`, send a *\"Hello, World!\"* message, and await any incoming data that would normally be sent from the server to the current client.\n\n```c#\nusing System;\nusing System.Text;\nusing ECP; // Always remember to import our library.\n\nnamespace ECPClient\n{\n    class Program\n    {\n        /// \u003csummary\u003e\n        /// The username which will be used to identify to the server.\n        /// \u003c/summary\u003e\n        static string username = \"Jason\";\n\n        /// \u003csummary\u003e\n        /// The main entry point for our application.\n        /// \u003c/summary\u003e\n        static void Main(string[] args)\n        {\n            // Print a greeting to our user along with any relevant information.\n            PrintGreeting();\n\n            // Allow any IPv4 address to be entered.\n            Console.Write(\"Enter an IP: \");\n            string ip = Console.ReadLine();\n\n            // Try connecting to the remote ECPServer instance.\n            try\n            {\n                // Create a client, hook-up events, and connect to our server.\n                ECPClient client = new ECPClient();\n                client.OnClientConnect += OnConnect;\n                client.OnClientDisconnect += OnDisconnect;\n                client.OnDataReceived += OnDataReceived;\n                client.OnLogOutput += OnLogOutput;\n                client.Connect(ip, username);\n\n                // Say hello to our server.\n                client.Send(\"Hello, World!\");\n\n                // Make a prompt to send our server a command.\n                Console.Write(\"~{0}: \", username);\n\n                // Create a loop in order to talk with our server.\n                string input = null;\n                while (!string.IsNullOrEmpty((input = Console.ReadLine())))\n                {\n                    // Get user input and send it off.\n                    client.Send(input);\n                    Console.Write(\"~{0}: \", username);\n                }\n\n                // Tell the user the server has disconnected.\n                Console.WriteLine(Timestamp() + \"[-] Server has disconnected...\");\n            }\n            catch { Console.WriteLine(Timestamp() + \"[x] Connection to server could not be established.\"); }\n\n            // Wait for user interaction.\n            Console.Read();\n        }\n\n        /// \u003csummary\u003e\n        /// Prints a generic user greeting to the console.\n        /// \u003c/summary\u003e\n        static void PrintGreeting()\n        {\n            Console.WriteLine(\"============================================\");\n            Console.WriteLine(\"            Welcome to ECPClient            \");\n            Console.WriteLine(\"          Written By: Jason Drawdy          \");\n            Console.WriteLine(\"============================================\");\n        }\n\n        /// \u003csummary\u003e\n        /// Returns a string formatted with the current time of day and date.\n        /// \u003c/summary\u003e\n        static string Timestamp()\n        {\n            return (\"(\" + DateTime.Now.ToLongTimeString() + \" - \" +\n            DateTime.Now.ToShortDateString() + \") \");\n        }\n\n        /// \u003csummary\u003e\n        /// Handles the connection to an \u003csee cref=\"ECPServer\"/\u003e instance.\n        /// \u003c/summary\u003e\n        static void OnConnect(object sender, ClientConnectEventArgs args)\n        {\n            Console.WriteLine(\"\\n\" + Timestamp() + \"[+] You have connected to {0}.\", args.Server);\n        }\n\n        /// \u003csummary\u003e\n        /// Handles the disconnection from an \u003csee cref=\"ECPServer\"/\u003e instance.\n        /// \u003c/summary\u003e\n        static void OnDisconnect(object sender, ClientDisconnectEventArgs args)\n        {\n            Console.WriteLine(\"\\n\" + Timestamp() + \"[!] You have been disconnected from the server.\");\n            Console.Write(\"~{0}: \", username);\n        }\n\n        /// \u003csummary\u003e\n        /// Handles the incoming data from a socket connected to an \u003csee cref=\"ECPServer\"/\u003e instance.\n        /// \u003c/summary\u003e\n        static void OnDataReceived(object sender, ClientDataReceivedEventArgs args)\n        {\n            Console.WriteLine(\"\\n\" + Timestamp() + \"[+] {0}\", Encoding.ASCII.GetString(args.Data));\n            Console.Write(\"~{0}: \", username);\n        }\n\n        /// \u003csummary\u003e\n        /// Handles the logging of any internal data passed to the current client instance.\n        /// \u003c/summary\u003e\n        static void OnLogOutput(object sender, LogOutputEventArgs args)\n        {\n            Console.WriteLine(\"\\n\" + Timestamp() + \"[+] {0}\", args.Output);\n            Console.Write(\"~{0}: \", username);\n        }\n    }\n}\n```\n\n# Credits\n**Icon:** `WEWEKA DESiGNERS` \u003cbr\u003e\nhttps://www.iconfinder.com/weweka \u003cbr\u003e\n\n**Encryption:** `sdrapkin` \u003cbr\u003e\nhttps://github.com/sdrapkin/SecurityDriven.Inferno \u003cbr\u003e\n\n# License\nCopyright © Jason Drawdy \n\nAll rights reserved.\n\nThe MIT License (MIT)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\nExcept as contained in this notice, the name of the above copyright holder\nshall not be used in advertising or otherwise to promote the sale, use or\nother dealings in this Software without prior written authorization.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasondrawdy%2Fecp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjasondrawdy%2Fecp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasondrawdy%2Fecp/lists"}