socket server for bot communication
Project description
Secure socket communication via botnet
>>> pip install botsocket
Based on Command Bus design pattern.
myserver.py
import os
from botsocket.server import start_server
from mycommands import *
if __name__ == '__main__':
start_server(listen_ip='0.0.0.0', port=PORT, allowed_host=CLIENT_IP)
mycommands.py
from botsocket.commandbus import Command, CommandHandler
class MyCommand(Command):
def __init__(self, msg):
self.msg = msg
class MyCommandHandler(CommandHandler):
def handle(self, command):
return command.msg
myclient.py
import os
from botsocket.client import send_command
from mycommands import MyCommand
if __name__ == '__main__':
cmd = MyCommand('yo')
result = send_command(cmd, server_ip=SERVER_IP, port=PORT)
Notes for production:
create self-signed certificate cert.pem;
>>> openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365
create logging.yml;
import all commands in myserver.py in order to unpickle command’s objects.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
botsocket-0.2.4.tar.gz
(3.5 kB
view details)
File details
Details for the file botsocket-0.2.4.tar.gz
.
File metadata
- Download URL: botsocket-0.2.4.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 505e2c7e0e851c49b3debf22e031c024991cc4209ddb29c985927a068e2bcde6 |
|
MD5 | 2b6c308c05d844274b6dbf62c65ae05f |
|
BLAKE2b-256 | 66708a6973a19b2409ac4ca78776e8bd0cd7ba456ab4bd457316a98e7feeaa58 |