A Python module that allows you to create and use simple sockets.

Related tags

NetworkingEasySockets
Overview

EasySockets

A Python module that allows you to create and use simple sockets.

Installation

The easysockets module can be installed using pip.

pip install easysockets

or

pip install git+https://github.com/Matthias1590/EasySockets.git

You can also install it by cloning this repository and running the following commands:

python3 setup.py build
python3 setup.py install

Examples

The easysockets module contains 3 main classes: ServerSocket, ClientSocket and Connection. Below are examples on how to use each of them.

ServerSocket:

# The ServerSocket class is used to create a server socket, to create an instance of the ServerSocket class you need a client handler, a client handler is a function that will be passed a connection, the client handler function can then, as the name suggests, handle the client/connection
server_socket = ServerSocket(client_handler=lambda connection: connection.send(b"Hello, world!"))  # This handler just sends "Hello, world!" and then closes the connection

# To make the server socket listen, use the "listen" method. You'll have to specify a host and port
server_socket.listen(host="localhost", port=8080)

# Now whenever a client connects, the lambda we made earlier will be called and will send "Hello, world!" to the client after which it'll close the connection

ClientSocket:

# The ClientSocket class is used to connect to server sockets
client_socket = ClientSocket()

# To connect to a server, use the "connect" method. You'll have to specify the host and port the server is hosted on. This will return a connection that you can then use to communicate with the server
connection = client.connect(host="localhost", port=8080)

# Sending "Hey!" to the server
connection.send(b"Hey!")

# Receiving a message and printing it (NOTE: The message will be received as bytes, to turn it into a string you can use the decode method)
print(connection.receive().decode())

# Closing the connection (NOTE: This isn't necessary if you end the program but it's good practice to do it anyway)
connection.close()

Connection:

# Assume that we just connected to a server
...

# The Connection class is used to communicate to a server/client, whenever you connect to a server or have a client connect to you, you will be given a Connection instance, you cannot create Connections using the constructor

# Send a message (you can only send bytes, if you want to send a string, just encode it)
connection.send("Hello".encode())
# is the same as
connection.send(b"Hello")

# Receive a message
message = connection.receive()
print(message.decode())

# Closing the connection
connection.close()

For more examples, check out example/client.py and example/server.py

Downloads

Downloads Downloads Downloads

Supported Operating Systems

The easysockets module is supported on every operating system as it only uses the built-in socket module.

Owner
Matthias Wijnsma
I'm a self-taught python developer that's always eager to learn!
Matthias Wijnsma
A Python script that alerts via SMS when a stock is reaching an inflection point

TradeAlert Not sure what this will ultimately become, but for now, its a Python script that alerts via SMS when a stock is reaching an inflection poin

3 Feb 22, 2022
Takes a file of hosts or domains and outputs the IP address of each host/domain in the file.

Takes a file of hosts or domains and outputs the IP address of each host/domain in the file. Installation $ git clone https://github.com/whoamisec75/i

whoami security 2 May 10, 2022
Arp Spoofer using Python 3.

ARP Spoofer / Wifi Killer By Auax Run: Run the application with the following command: python3 spoof.py -t target_ip_address -lh host_ip_address I

Auax 6 Sep 15, 2022
Netwalk is a Python library to discover, parse, analyze and change Cisco switched networks

Netwalk is a Python library born out of a large remadiation project aimed at making network device discovery and management as fast and painless as possible.

38 Nov 07, 2022
A server and client for passing data between computercraft computers/turtles across dimensions or even servers.

ccserver A server and client for passing data between computercraft computers/turtles across dimensions or even servers. pastebin get zUnE5N0v client

1 Jan 22, 2022
Tsunami-Fi is simple multi-tool bash application for Wi-Fi attacks

🪴 Tsunami-Fi 🪴 Русская версия README 🌿 Description 🌿 Tsunami-Fi is simple multi-tool bash application for Wi-Fi WPS PixieDust and NullPIN attack,

【Kiko】 35 Dec 09, 2022
A vpn that sits in your browser, accessible via a website

VPNInYourBrowser A vpn that sits in your browser, accessible via a website Example setup: https://VPNInBrowser.jaffa42.repl.co Setup Put the code onto

1 Jan 20, 2022
A benchmark for stateful fuzzing of network protocols

A benchmark for stateful fuzzing of network protocols

3 Apr 25, 2022
Simple python script for automated network scans with random name generator(useful for CTF boxes).

📄 Automated NMAP script Description Simple python script for automated network scans with random name generator(useful for CTF boxes). Requirements 1

Dhmos Funk 2 Oct 29, 2021
Module for convenient work with TCP sockets.

m_socket-py Module for convenient work with TCP sockets. Contributing Pool Request is supported! Ask questions in the Issues section. License Copyrigh

Egor Arskiy 5 Mar 09, 2022
mitm6 is a pentesting tool that exploits the default configuration of Windows to take over the default DNS server.

mitm6 is a pentesting tool that exploits the default configuration of Windows to take over the default DNS server.

Fox-IT 1.3k Jan 05, 2023
Tiny JSON RPC via HTTP library.

jrpc Simplest ever possible Asynchronous JSON RPC via HTTP library for Python, backed by httpx. Installation pip install async-jrpc Usage Import JRPC

Onigiri Team 2 Jan 31, 2022
Cobalt Strike C2 Reverse proxy that fends off Blue Teams, AVs, EDRs, scanners through packet inspection and malleable profile correlation

Cobalt Strike C2 Reverse proxy that fends off Blue Teams, AVs, EDRs, scanners through packet inspection and malleable profile correlation

Mariusz B. 715 Dec 25, 2022
Dshell is a network forensic analysis framework.

Dshell An extensible network forensic analysis framework. Enables rapid development of plugins to support the dissection of network packet captures. K

DEVCOM Army Research Laboratory 5.4k Jan 06, 2023
ProtOSINT is a Python script that helps you investigate Protonmail accounts and ProtonVPN IP addresses

ProtOSINT ProtOSINT is a Python script that helps you investigate ProtonMail accounts and ProtonVPN IP addresses. Description This tool can help you i

pixelbubble 249 Dec 23, 2022
Edge static generator. Also Edge means: the outside limit of an object, area, or surface.

Edge Edge is a new static generator. Edge is onworking. Do not clone or do any changes. No P.R will be merged Also Edge means: the outside limit of an

AmirHossein Mohammadi 12 Jan 16, 2022
Caching for HTTPX

Caching for HTTPX. Note: Early development / alpha, use at your own risk. This package adds caching functionality to HTTPX Adapted from Eric Larson's

Mehul Solanki 0 Oct 08, 2022
A pure python implementation of multicast DNS service discovery

python-zeroconf Documentation. This is fork of pyzeroconf, Multicast DNS Service Discovery for Python, originally by Paul Scott-Murphy (https://github

Jakub Stasiak 483 Dec 29, 2022
This is a simple python script to collect sub-domains from hackertarget API

Domain-Scraper 🌐 This is a simple python script to collect sub-domains from hackertarget API Note : This is tool is limited to 20 Queries / day with

CHINO TECH TOOLS 4 Sep 09, 2021
Terminal based chat - networking project with sockets in python

Terminal based chat - networking project with sockets in python

2 Jan 24, 2022