mpaste/pastebins/termbin.py

19 lines
483 B
Python
Raw Normal View History

import socket
"""
Super simple termbin client
"""
def publish_to_termbin(content):
host = 'termbin.com'
port = 9999
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((host, port))
sock.sendall(content.encode('utf-8'))
response = sock.recv(1024).decode('utf-8').strip()
sock.close()
return response
except Exception as e:
print(f"Error connecting to Termbin: {e}")
return None