Created
April 28, 2014 00:27
-
-
Save apetrone/11358919 to your computer and use it in GitHub Desktop.
graylog2 proxy which bridges the gap between Java compression and minizip.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adam Petrone, May 2012 | |
import socket | |
import json | |
import zlib | |
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
host = "0.0.0.0" | |
port = 12202 | |
sock.bind((host,port)) | |
target_host = "127.0.0.1" | |
target_port = 12201 | |
server = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
print("Graylog2 Proxy server running...") | |
while True: | |
data, addr = sock.recvfrom(1024) | |
fatdata = zlib.decompress(data) | |
outdata = zlib.compress(fatdata) | |
server.sendto(outdata, (target_host, target_port)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment