Skip to content

Parses user input to generate patterns in the client, then sends the encrypted payload to the server, using getopt, TCP Sockets, and the OpenSSL Library

Notifications You must be signed in to change notification settings

stenslae/EncryptedPattern

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Encrypted Patterns

Project Description

Encrypted Patterns is a single client to server demo written in C that transmits encrypted pattern data from a client to a server. It demonstrates symmetric encryption, message signing, TCP sockets, and command-line interface handling with getopt.

Program Flow

  1. Client connects to server and reads in user input.
  2. The client encrypts messages and includes a pre-generated signature that authenticates the client to the server.
  3. Server recieves packet and checks the signature.
    • On a bad signature, it disconnects the client and shuts down.
  4. With a good signature, the server checks if the client requested to close the connection.
    • If the client requested to close the conneciton, it disconnects the client and shuts down.
  5. Server decrypts the message from the client, and sends "ACK" if the message was recieved sucessfully.
  6. On ACK, client sends a new message. On NACK, the client retries three times then disconnects.

Dependencies

  • Run on a Linux machine or VM with gcc & cmake installed.
  • Install the latest version of OpenSSL:
sudo apt install openssl

Usage

  1. Clone the repository.
  2. In this directory, run make
  3. In the keys folder, run bash keygen.sh
  4. In one terminal, run the server using the instructions in Server Usage.
  5. In another terminal, run the client using the instructions in Client Usage. An example file, pattern1.txt, is provided for the -f option.

Server

Command:

./server -t PORT

Description:

Recieve an encrypted 8 byte value.

Arguments:

Arg Opt Desc
-t PORT set the port for TCP

Example:

./server -t 8001

Client

Command:

./client [-h] [-v] -t PORT (-f FILE | -p VALUE,TIME)

Description:

Send encrypted 8 byte values in a pattern to a server.

Arguments:

Arg Opt Description
-t PORT set the port for TCP
-h show this help message and exit
-v enable verbose output
-p VALUE(hex),TIME(ms) specify pattern, can repeat for a sequence.
-f FILE specify a text file with <VALUE> <TIME> lines

Example:

./client -v -f assets/pattern1.txt -t 8001
./client -p 0x01,200 -p 0xff,500 -p 0x32,200 -t 8001

Acknowledgments

  • Language: C
  • Tools Getopt, OpenSSL

About

Parses user input to generate patterns in the client, then sends the encrypted payload to the server, using getopt, TCP Sockets, and the OpenSSL Library

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published