kevinmahaffey/tescat

i make a python version and filter.^_^

Opened this issue · 0 comments

!/usr/bin/env python

-- coding:UTF-8 --

from socket import *
from time import ctime

HOST = '192.168.90.51'

PORT = 20101

PORT = 20100
BUFSIZE = 1024

ADDR = (HOST,PORT)

udpSerSock = socket(AF_INET, SOCK_DGRAM)
udpSerSock.bind(ADDR)

while True:
data, addr = udpSerSock.recvfrom(BUFSIZE)
udpSerSock.sendto('%s'%(data),addr)
datax = ", Data:"
if str(hex(ord(data[2]))) == "0x0":
if str(hex(ord(data[3]))) == "0x50" or str(hex(ord(data[3]))) == "0xf" or str(hex(ord(data[3]))) == "0x32" or str(hex(ord(data[3]))) == "0x1a" or str(hex(ord(data[3]))) == "0x67" or str(hex(ord(data[3]))) == "0x69" or str(hex(ord(data[3]))) == "0x6b" or str(hex(ord(data[3]))) == "0x32" or str(hex(ord(data[3]))) == "0x37" or str(hex(ord(data[3]))) == "0x81" or str(hex(ord(data[3]))) == "0xc" or str(hex(ord(data[3]))) == "0x50" or str(hex(ord(data[3]))) == "0x32" or str(hex(ord(data[3]))) == "0x85" or str(hex(ord(data[3]))) == "0x81" or str(hex(ord(data[3]))) == "0x5" or str(hex(ord(data[3]))) == "0x7" or str(hex(ord(data[3]))) == "0x38" or str(hex(ord(data[3]))) == "0x4f" or str(hex(ord(data[3]))) == "0x80" or str(hex(ord(data[3]))) == "0x82" or str(hex(ord(data[3]))) == "0x6a" or str(hex(ord(data[3]))) == "0x68" or str(hex(ord(data[3]))) == "0x8b" or str(hex(ord(data[3]))) == "0x3d" or str(hex(ord(data[3]))) == "0x9" or str(hex(ord(data[3]))) == "0x7a" or str(hex(ord(data[3]))) == "0x6c" or str(hex(ord(data[3]))) == "0x6d" or str(hex(ord(data[3]))) == "0x6e" or str(hex(ord(data[3]))) == "0x6f" or str(hex(ord(data[3]))) == "0x79" or str(hex(ord(data[3]))) == "0x70" or str(hex(ord(data[3]))) == "0x71" or str(hex(ord(data[3]))) == "0x72" or str(hex(ord(data[3]))) == "0x73" or str(hex(ord(data[3]))) == "0x74" or str(hex(ord(data[3]))) == "0x75" or str(hex(ord(data[3]))) == "0x76" or str(hex(ord(data[3]))) == "0x77" or str(hex(ord(data[3]))) == "0x78" or str(hex(ord(data[3]))) == "0x7c" or str(hex(ord(data[3]))) == "0x89":
continue
elif str(hex(ord(data[2]))) == "0x1":
if str(hex(ord(data[3]))) == "0x9f" or str(hex(ord(data[3]))) == "0x1":
continue
elif str(hex(ord(data[2]))) == "0x2":
if str(hex(ord(data[3]))) == "0x58" or str(hex(ord(data[3]))) == "0xf0" or str(hex(ord(data[3]))) == "0x28" or str(hex(ord(data[3]))) == "0x38" or str(hex(ord(data[3]))) == "0x48" or str(hex(ord(data[3]))) == "0x8" or str(hex(ord(data[3]))) == "0x9":
continue
elif str(hex(ord(data[2]))) == "0x3":
if str(hex(ord(data[3]))) == "0x8f" or str(hex(ord(data[3]))) == "0x59" or str(hex(ord(data[3]))) == "0xb8" or str(hex(ord(data[3]))) == "0xb9" or str(hex(ord(data[3]))) == "0xc9" or str(hex(ord(data[3]))) == "0x8" or str(hex(ord(data[3]))) == "0xe8":
continue
elif str(hex(ord(data[2]))) == "0x4":
if str(hex(ord(data[3]))) == "0x38":
continue
elif str(hex(ord(data[2]))) == "0x5":
if str(hex(ord(data[3]))) == "0x48":
continue

for i in xrange(4,len(data)):
    datax = datax + str(hex(ord(data[i]))) + " "
print "Type:" + str(hex(ord(data[2]))) + ", Opcode:" + str(hex(ord(data[3]))) + datax

udpSerSock.close()