Skip to content

Instantly share code, notes, and snippets.

@wuzhenda
Created January 18, 2018 03:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wuzhenda/235f652467eb33a9428fc3fea884a240 to your computer and use it in GitHub Desktop.
Save wuzhenda/235f652467eb33a9428fc3fea884a240 to your computer and use it in GitHub Desktop.
fake client by python
#!/usr/bin/env python
import socket
import time
def GetCmd(hexString):
hexString = hexString.replace(" ", "");
if ((len(hexString) % 2) != 0):
hexString += " ";
bits = ""
for x in range(0, len(hexString), 2):
bits += chr(int(hexString[x:x+2], 16))
return bits;
host = 'xxx.yyy.com'
port = 10001
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((host, port))
str = "7B 7D 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 32 0F 10 0A 4B 4C 00 00 00 00 00 00 00 00 3F 21"
convertStr=GetCmd(str)
print(convertStr)
while True:
sock.send(convertStr.encode(encoding='utf_8', errors='strict'))
time.sleep(60)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment