MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / connect

Method connect

thirdparty/socks/socks.py:361–395  ·  view source on GitHub ↗

connect(self, despair) Connects to the specified destination through a proxy. destpar - A tuple of the IP/DNS address and the port number. (identical to socket's connect). To select the proxy server use setproxy().

(self, destpair)

Source from the content-addressed store, hash-verified

359 self.__proxypeername = (addr, destport)
360
361 def connect(self, destpair):
362 """connect(self, despair)
363 Connects to the specified destination through a proxy.
364 destpar - A tuple of the IP/DNS address and the port number.
365 (identical to socket's connect).
366 To select the proxy server use setproxy().
367 """
368 # Do a minimal input check first
369 if (not type(destpair) in (list,tuple)) or (len(destpair) < 2) or (type(destpair[0]) != type('')) or (type(destpair[1]) != int):
370 raise GeneralProxyError((5, _generalerrors[5]))
371 if self.__proxy[0] == PROXY_TYPE_SOCKS5:
372 if self.__proxy[2] != None:
373 portnum = self.__proxy[2]
374 else:
375 portnum = 1080
376 _orgsocket.connect(self, (self.__proxy[1], portnum))
377 self.__negotiatesocks5(destpair[0], destpair[1])
378 elif self.__proxy[0] == PROXY_TYPE_SOCKS4:
379 if self.__proxy[2] != None:
380 portnum = self.__proxy[2]
381 else:
382 portnum = 1080
383 _orgsocket.connect(self,(self.__proxy[1], portnum))
384 self.__negotiatesocks4(destpair[0], destpair[1])
385 elif self.__proxy[0] == PROXY_TYPE_HTTP:
386 if self.__proxy[2] != None:
387 portnum = self.__proxy[2]
388 else:
389 portnum = 8080
390 _orgsocket.connect(self,(self.__proxy[1], portnum))
391 self.__negotiatehttp(destpair[0], destpair[1])
392 elif self.__proxy[0] == None:
393 _orgsocket.connect(self, (destpair[0], destpair[1]))
394 else:
395 raise GeneralProxyError((4, _generalerrors[4]))
396
397def create_connection(address, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
398 source_address=None):

Callers 1

create_connectionFunction · 0.45

Calls 4

__negotiatesocks5Method · 0.95
__negotiatesocks4Method · 0.95
__negotiatehttpMethod · 0.95
GeneralProxyErrorClass · 0.85

Tested by

no test coverage detected