Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2030913

Browse files
Merge pull request avinashkranjan#2164 from shraddha761/doh-dig
Crypt_Socket script is added
2 parents fb16d37 + c7f3c2f commit 2030913

File tree

3 files changed

+62
-0
lines changed

3 files changed

+62
-0
lines changed

‎Crypt_Socket/Readme.md‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Crypt_Socket
2+
3+
Basic client-server application for secure socket communication in Python, using SSL/TLS encryption. The code demonstrates how to establish a secure connection between a server and a client, ensuring confidentiality and integrity of the transmitted data.
4+
5+
6+
## Usage
7+
8+
Follow the prompts in the client terminal to enter messages. The messages will be encrypted using SSL/TLS and securely transmitted to the server. The server will decrypt and display the received messages.
9+
10+
To exit the client or server, enter the message "quit" in the client terminal.
11+
12+
## Security Considerations
13+
14+
The code provided demonstrates a basic implementation of SSL/TLS encryption using Python's `ssl` module and the `cryptography` library. However, for production use or in scenarios where stronger security is required, additional security measures should be implemented, such as:
15+
16+
- Proper certificate management: Use trusted certificates signed by a trusted certificate authority (CA) to ensure secure communication.
17+
- Secure cipher suites: Configure the SSL/TLS cipher suites to use strong encryption algorithms and key exchange mechanisms.
18+
- Secure key management: Protect the private keys used for SSL/TLS encryption and ensure secure key generation, storage, and rotation.
19+
20+
It's important to consult SSL/TLS best practices and consider the specific security requirements of your application for a robust and secure implementation.
21+
22+

‎Crypt_Socket/crypt_socket.py‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import socket
2+
import ssl
3+
4+
# Create a socket object
5+
server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
6+
7+
# Bind the socket to a specific address and port
8+
server_socket.bind(('localhost', 12345))
9+
10+
# Listen for incoming connections
11+
server_socket.listen(1)
12+
13+
print('Server is listening...')
14+
15+
# Accept a connection from a client
16+
client_socket, client_address = server_socket.accept()
17+
18+
print('Connected to:', client_address)
19+
20+
# Wrap the socket with SSL/TLS encryption
21+
ssl_socket = ssl.wrap_socket(client_socket, server_side=True, ssl_version=ssl.PROTOCOL_TLS)
22+
23+
while True:
24+
# Receive data from the client
25+
data = ssl_socket.recv(1024)
26+
27+
# Decode and print the received data
28+
print('Received:', data.decode())
29+
30+
# If the client sends 'quit', close the connection
31+
if data.decode() == 'quit':
32+
break
33+
34+
# Close the SSL/TLS socket
35+
ssl_socket.close()
36+
37+
# Close the server socket
38+
server_socket.close()

‎SCRIPTS.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@
100100
| 96\. | Sorting Techniques | Sorting techniques are scripts that arrange a collection of data elements in a particular order, typically ascending or descending. | [Take Me](./Sorting%20Techniques/) | [Himanshu Agarwal](https://github.com/himanshu-03)
101101
| 99\. | File Organizer script | A File Organizer script is a program or script that automates the process of organizing files within a directory or multiple directories | [Take Me](./File Organizer script/) | [Abhinav kumar](https://github.com/Abhinavcode13)
102102
| 100\. | File Encryption/Decryption script | A File Organizer script is a program or script that automates the process of organizing files within a directory or multiple directories | [Take Me](./File Encryption/Decryption script/) | [Abhinav kumar](https://github.com/Abhinavcode13)
103+
| 101\. | Crypt_Socket | Basic client-server application for secure socket communication in Python, using SSL/TLS encryption. The code demonstrates how to establish a secure connection between a server and a client, ensuring confidentiality and integrity of the transmitted data.
104+
| [Take Me](./Crypt_Socket/) | [Shraddha SIngh](https://github.com/shraddha761)
103105
| 101\. |Story Generator | This script randomly selects a character, setting, action, and conclusion from predefined lists and generates a story using these elements. | [Take Me](./Story_Generator/story_generator.py) | [Shraddha Singh](https://github.com/shraddha761)
104106
| 102\. | Scientific Calculator | This python program will help to solve the hardest problems of trigonometry, exponents functions, logarithmic functions, etc. in very easy way. This program has a best User interface of the scientific calculator and provide a best user experience | [Take Me](./Scientific_Calculator) | [Avdhesh Varshney](https://github.com/Avdhesh-Varshney)
105107
| 103\. | Chess Game | Chess Game is created using PYTHON script that provides user a interactive platform to play chess game. This program will create a interactive GUI of chess board for the user. Directly started in the terminal. | [Take Me](./Chess-Game/) | [Avdhesh Varshney](https:github.com/Avdhesh-Varshney)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /