Python socket.IPPROTO_SCTP Examples

The following are 4 code examples of socket.IPPROTO_SCTP(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module socket , or try the search function .
Example #1
Source File: test_socket.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def newSocket(self):
        return socket.socket(socket.AF_INET, socket.SOCK_STREAM,
                             socket.IPPROTO_SCTP) 
Example #2
Source File: test_socket.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def newSocket(self):
        return socket.socket(socket.AF_INET, socket.SOCK_STREAM,
                             socket.IPPROTO_SCTP) 
Example #3
Source File: test_socket.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def newSocket(self):
        return socket.socket(socket.AF_INET, socket.SOCK_STREAM,
                             socket.IPPROTO_SCTP) 
Example #4
Source File: dizzy.py    From dizzy-legacy with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
def send(self, data):
        try:
            if not self.maxsize is None and len(data) > self.maxsize:
                data = data[:self.maxsize-1]
                if DEBUG:
                    print("Truncated data to %d byte." % self.maxsize)
            if self.session_type == "eth":
                self.s.send(data)
            elif self.session_type == "file":
                self.f.write(data)
            elif self.session_type == "stdout":
                self.f.write(data + b"\n")
            elif self.session_type == "stdout-hex":
                self.f.write(binascii.hexlify(data))
            elif self.session_type == "cmd":
                try:
                    subprocess.call("%s %s" % (self.cmd, binascii.hexlify(data).upper()), shell=True)
                except Exception as e:
                    raise dizz_sessionException("error on executing %s: '%s'" % (self.cmd, str(e)))
            elif self.session_type == "usb-dscr":                
                self.u = usb.dizzyUSB(self.filename, self.timeout, data=data, fuzz_dscr=self.fuzz_dscr)
                self.u.open()
                self.u.close()
            elif self.session_type == "usb-endp":
                if not self.u.opened:
                    raise dizz_sessionException("usb connection closed...")
                try:
                    self.u.write(data)
                except ValueError as e:
                    raise dizz_sessionException("error sending to endpoint: %s" % str(e))
            elif self.session_type == "tcp" or self.session_type == "tls":
                if self.server_side:
                    if not self.cs:
                        raise dizz_sessionException("no client connection, cant send")
                    self.cs.send(data)
                else:
                    self.s.send(data)
            #~ elif self.session_type == "sctp":
                #~ self.s.sendmsg([data], [(socket.IPPROTO_SCTP, self.SCTP_SNDRCV, self.sndrcvinfo)], 0, (self.dest, self.dport))
            else:
                self.s.sendto(data, (self.dest, self.dport))
        except Exception as e:
            if self.auto_reopen:
                if DEBUG:
                    print("session got closed '%s', autoreopening..." % str(e))
                    traceback.print_exc()
                self.close()
                self.open()
            else:
                self.close()
                raise dizz_sessionException("error on sending '%s', connection closed." % str(e))