Exemplo n.º 1
0
 def __init__(self, shared_=None, log_fn=print):
     self.callout = win32file.CreateFile(
         self.CALLOUT_DRIVER_NAME,
         win32file.GENERIC_READ | win32file.GENERIC_WRITE,
         win32file.FILE_SHARE_READ, None, win32file.OPEN_EXISTING, 0, 0)
     self.log = log_fn
     if shared_ is None:
         self.shared = RAVerifier(self.log)
     else:
         self.shared = shared_
Exemplo n.º 2
0
    def __init__(self, config=None, socket_=None, verifier=None):
        if socket_ is None:
            self.socket = socket.socket(socket.PF_SYSTEM, socket.SOCK_STREAM,
                                        socket.SYSPROTO_CONTROL)
        else:
            self.socket = socket_

        if verifier is None:
            syslog.openlog("TrustRouter")

            def log(string):
                syslog.syslog(syslog.LOG_ALERT, string)

            self.verifier = RAVerifier(log, config)
        else:
            self.verifier = verifier
Exemplo n.º 3
0
def cb(payload):
    print("python callback called!")

    common_part = RAVerifier()
    sock = socket.socket(
        socket.AF_INET6,
        socket.SOCK_RAW,
        IPPROTO_ICMPV6)        
    sock.settimeout(2)
    if common_part.verify(
            payload.get_data(),
            payload.get_indev(),
            sock):
        payload.set_verdict(nfqueue.NF_ACCEPT)
    else:
        payload.set_verdict(nfqueue.NF_DROP)

    sys.stdout.flush()
    return 1
Exemplo n.º 4
0
 def setUp(self):
     self.verifier = RAVerifier()
Exemplo n.º 5
0
from trustrouter.core import RAVerifier

packet = b"\x60\x00\x00\x00\x01\xc8\x3a\xff\xfe\x80\x00\x00\x00\x00\x00\x00\x2c\xf2\x7e\xf7\x8f\x98\xdf\x97\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x86\x00\x10\xf1\x40\x00\x00\xb4\x00\x00\x00\x00\x00\x00\x00\x00\x03\x04\x40\xe0\x00\x01\x51\x80\x00\x00\x38\x40\x00\x00\x00\x00\x20\x01\x06\x38\x08\x07\x02\x1d\x00\x00\x00\x00\x00\x00\x00\x00\x19\x03\x00\x00\x00\x00\x00\x3c\x20\x01\x06\x38\x08\x07\x02\x01\x02\x11\x43\xff\xfe\x5b\x35\x1b\x01\x01\x00\x00\x1c\xd5\x06\x41\x0b\x18\x01\x00\x40\x7e\xd5\xfc\xc9\x69\x05\x3d\x8f\xa3\x7b\xb6\x09\x39\x86\xe2\xfe\x80\x00\x00\x00\x00\x00\x00\x00\x30\x81\x9f\x30\x0d\x06\x09\x2a\x86\x48\x86\xf7\x0d\x01\x01\x01\x05\x00\x03\x81\x8d\x00\x30\x81\x89\x02\x81\x81\x00\xaf\x96\x81\x88\xe2\xfb\x44\x20\x3d\xa9\xc9\x1b\x07\xde\x9d\x55\x27\x9e\xf7\xdc\xe6\xe2\xd2\x9b\x5c\x9a\x46\x72\x2b\x02\x10\xce\x4d\xc2\x87\xb7\x74\x03\x91\xac\xcd\xc5\x87\x5e\x06\xaf\xc8\x9a\xda\x29\xf9\xe9\x16\x8a\xc6\x97\x62\x76\xbb\x14\xb0\xab\xb7\xfe\x03\x34\x12\x98\x4b\x8e\x77\xba\x2b\x1b\x09\x8f\x6e\xd9\xb3\x59\x68\xb5\x35\xa8\x68\x08\x21\x70\x7f\x65\x6d\xca\xd1\x75\xdd\xc1\xbc\x1c\xc6\xee\x8b\x8c\x74\x3f\xbd\x8b\x8f\xde\x26\xa1\x99\x3b\xb2\x3c\xb6\x6b\xfc\xc5\xa1\x76\xaf\xd5\x07\x02\x62\x71\x6c\x09\x02\x03\x01\x00\x01\x00\x0d\x02\x00\x00\x00\x00\x00\x00\x00\x00\x4f\x1e\x90\x6e\xd0\x74\x2a\x02\x07\x00\x80\x81\x0a\x0b\x09\x00\x00\x00\x00\x00\x00\x00\x0c\x13\x00\x00\xf8\x55\x0b\xb2\x49\xe1\xd9\x0a\x2a\xe4\x00\xc2\x02\xc1\x8b\xff\x09\x24\x31\xdf\xb5\x66\xd2\x00\x74\x82\x0c\x84\x8d\xfa\x39\x33\x9c\x80\xfb\x7d\x2c\x10\x68\x7f\x4b\x75\x28\x28\x5a\x41\x39\x44\x23\x6f\x36\xc1\x42\x9a\x86\x3c\xcc\x25\xfc\xd7\x16\x66\x0a\x42\x46\xe5\x0b\x9f\x8f\x09\xf3\xde\x43\x58\xdc\x2b\xa7\x89\xbb\xa6\xf9\x98\x4b\xb2\x45\x28\x44\xd2\xd2\xa3\xaf\x85\x16\xf2\xca\x3f\x81\x7a\x99\xea\x7a\x39\xc8\xe5\xc1\xbc\x65\xf4\x5e\xa6\x88\x4b\x7a\x34\x55\x72\xd0\xbe\x2d\x51\xd2\xd9\x42\x2b\x68\x32\x77\x83\xc8\xbc\x6c\xf8\x79\x68\xcb\xed\x90\x84\x45\x20\xc5\x24\x60\xcf\x00\x00\x00\x00"

verifier = RAVerifier()

result = verifier.verify(packet, 4)

print(result)