Server import socket from socket import AF_INET, SOCK_STREAM, SO_REUSEADDR, SOL_SOCKET, SHUT_RDWR import ssl KEYFILE = ‘server_key.pem’ CERTFILE = ‘server_cert.pem’ def echo_client(s): while True: data = s.recv(8192) print(data.decode(“utf-8″)) if data == b”: break s.send(b’This is a response.’) print(‘Connection closed’) s.close() def echo_server(address): s = socket.socket(AF_INET, SOCK_STREAM) s.bind(address) s.listen(1) s.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) s_ssl = ssl.wrap_socket(s, keyfile=KEYFILE, certfile=CERTFILE, […]
I found this to be much more difficult than I thought it would be. The solution was simple, but finding it was a bit of a pain. Here is the solution: Extremely simple, but it caused me a fair amount of headache to figure that out. Common errors that might bring you to this post: AttributeError: […]
I got this error the other day when I was trying to compile the exploit code for the mremap exploit on Linux. While I have programmed a lot I have not spent an inordinate amount of time with gcc and this was something of a pain to solve so I thought I would share a […]
I got this and it took some time to troubleshoot. The error is misleading. What it’s really telling you is that the plugin failed to execute properly. Here’s the catch, this includes warnings. So if you manually test the plugin from the command line outside of Icinga and it works, but gives a warning, when […]
I got this the other day and was most confused because I already had python-tk installed. Turns out the error message is a bit misleading. If you are running python 3 you have to install the python3 version of tkinter with the command: sudo apt-get install python3-tk Hope this helps.
This code is for Python 3. I was surprised to discover that I couldn’t really find a good way to do this when I Googled for a solution. I just kept getting results for Google’s youtube API, which is great… but also massive overkill for what I wanted to do. I just wanted to search […]
pyCiscoConsole v1.00- A Class Based Approach for Serial IO to a Cisco Device Contents Overview Requirements Installation CiscoDevice Class Public Methods __init__ set_receive_wait get_mode set_mode send_command DeviceMode Class Usage Example Downloads Overview pyCiscoConsole provides a class based interface for communicating with a Cisco device over a console cable. pyCiscoConsole is single threaded and uses a heuristic […]
For my latest project I wanted to communicate with a Cisco device over serial via the console port with my python program. It isn’t overly complicated, but it took me a bit to hack together something that worked properly and I thought I’d share it with everyone. Below is the code: The first line opens […]