Created
December 11, 2019 08:12
-
-
Save shkpk/32f91753e4dabac20cd729e1436220c5 to your computer and use it in GitHub Desktop.
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
# | |
# options_good.py | |
# | |
import os, socket | |
# configuration | |
server = "10.5.6.131" | |
port = 1344 | |
request = """REQMOD icap://10.5.6.131/fe-nx ICAP/1.0 | |
Host: 10.5.6.131 | |
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1) | |
""" | |
# code | |
def run(): | |
# send request | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.setblocking(1) | |
s.connect((server, port)) | |
s.send(request.replace("\n", "\r\n")); | |
# read response | |
data = "" | |
while 1: | |
d = s.recv(1024) | |
if not d: break | |
data += d | |
# analyze | |
print data | |
# entry point | |
run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment