All Samples(1295) | Call(1287) | Derive(0) | Import(8)
setdefaulttimeout(timeout) Set the default timeout in floating seconds for new socket objects. A value of None indicates that new socket objects have no timeout. When the socket module is first imported, the default is None.
src/p/y/python-sitemap-HEAD/samples/check-sitemap.py python-sitemap(Download)
def check_url(url, timeout=5):
def_timeout = socket.getdefaulttimeout()
socket.setdefaulttimeout(timeout)
found = True
try:
urllib2.urlopen(url)
except (urllib2.HTTPError, urllib2.URLError, socket.error, socket.sslerror):
found = False
socket.setdefaulttimeout(def_timeout)
src/p/k/pksampler-HEAD/pk/stereo/PyCDDB.py pksampler(Download)
import re import socket try: socket.setdefaulttimeout(30) #don't want things to wait forever now do we? except: pass
src/o/p/opensearch-HEAD/examples/test_opensearch_servers.py opensearch(Download)
from opensearch import Client
import socket, urllib2
socket.setdefaulttimeout(10)
# OS list of open OS targets
mainc = Client('http://a9.com/-/opensearch/public/osd')
src/d/j/django-datagrid-1.1/example/blogango/akismet.py django-datagrid(Download)
import socket
if hasattr(socket, 'setdefaulttimeout'):
# Set the default timeout on sockets to 5 seconds
socket.setdefaulttimeout(5)
__version__ = '0.2.0'
src/o/p/opensearch-0.8/examples/test_opensearch_servers.py opensearch(Download)
from opensearch import Client
import socket, urllib2
socket.setdefaulttimeout(10)
# OS list of open OS targets
mainc = Client('http://a9.com/-/opensearch/public/osd')
src/i/n/inguma-HEAD/modules/gather/CServiceIdentify.py inguma(Download)
def tryVmware(self, port):
try:
socket.setdefaulttimeout(self.timeout)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((self.target, int(port)))
data = s.recv(4096)
def tryStonegate(self, port):
try:
socket.setdefaulttimeout(self.timeout)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((self.target, int(port)))
data = s.recv(4096)
def tryCitrix(self, port):
try:
socket.setdefaulttimeout(self.timeout)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((self.target, int(port)))
data = s.recv(64)
def tryPcAnywhere(self, port):
try:
socket.setdefaulttimeout(self.timeout)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((self.target, int(port)))
s.send("ST")
data = s.recv(1024)
def tryVncServer(self, port):
try:
socket.setdefaulttimeout(self.timeout)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((self.target, int(port)))
data = s.recv(1024)
def tryHttpTimesTen(self, port):
try:
buf = "GET /hello\r\n\r\n"
socket.setdefaulttimeout(self.timeout)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((self.target, int(port)))
s.send(buf)
def tryRdp(self, port):
try:
buf = "\x03\x00\x00\x29\x24\xe0\x00\x00\x00\x00\x00Cookie: mstshash=theusername\x0d\x0a"
socket.setdefaulttimeout(self.timeout)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((self.target, int(port)))
s.send(buf)
def tryLdap(self, port):
try:
socket.setdefaulttimeout(self.timeout)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((self.target, int(port)))
s.send("\r\n"*3)
data = s.recv(1024)
def tryLdaps(self, port):
try:
socket.setdefaulttimeout(self.timeout)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((self.target, int(port)))
ssl_sock = socket.ssl(s)
ssl_sock.write("\r\n"*3)
def tryOrmiServer(self, port):
try:
socket.setdefaulttimeout(self.timeout)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((self.target, int(port)))
pkt = "\r\n\r\n\r\n"
s.sendall(pkt)
def tryOcfs2Service(self, port):
try:
socket.setdefaulttimeout(self.timeout)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((self.target, int(port)))
pkt = "\xfa\x57\x00\x00\x00\x00\x00\x00"
pkt += "\x00\x00\x00\x00\x00\x00\x00\x00"
def tryHttpServer(self, port):
try:
socket.setdefaulttimeout(self.timeout)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((self.target, int(port)))
s.send("GET / HTTP/1.1" + os.linesep + "HOST:localhost" + os.linesep + "CONNECTION:close" + os.linesep * 3)
data = s.recv(1024)
def tryRtspServer(self, port):
try:
socket.setdefaulttimeout(self.timeout)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((self.target, int(port)))
s.send("OPTIONS * RTSP/1.0\r\n\r\n")
data = s.recv(1024)
def tryHttpsServer(self, port):
try:
socket.setdefaulttimeout(self.timeout)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((self.target, int(port)))
ssl_sock = socket.ssl(s)
def tryTelnetServer(self, port):
try:
socket.setdefaulttimeout(self.timeout)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((self.target, int(port)))
data = s.recv(1024)
s.close()
def tryFtpServer(self, port):
try:
socket.setdefaulttimeout(self.timeout)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((self.target, int(port)))
data = s.recv(1024)
s.close()
def trySshServer(self, port):
try:
socket.setdefaulttimeout(self.timeout)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((self.target, int(port)))
data = s.recv(1024)
s.close()
def tryTnsServer(self, port):
try:
socket.setdefaulttimeout(self.timeout)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((self.target, int(port)))
tns = TNS()
def tryLpdServer(self, port):
try:
socket.setdefaulttimeout(self.timeout)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((self.target, int(port)))
s.sendall("\x03printer\n")
data = s.recv(1024)
def tryJetDirect(self, port):
try:
socket.setdefaulttimeout(self.timeout)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((self.target, int(port)))
s.sendall("@PJL INFO ID\n")
data = s.recv(1024)
def trySmtpServer(self, port):
try:
socket.setdefaulttimeout(self.timeout)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((self.target, int(port)))
data = s.recv(1024)
def tryMySQLServer(self, port):
try:
socket.setdefaulttimeout(self.timeout)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((self.target, int(port)))
data = s.recv(1024)
src/a/u/automanic-HEAD/trunk/ioData/server/lobby/ioLobbyServer.py automanic(Download)
self.maxclients = 1024
self.chatent = 'ioLobbyChat'
socket.setdefaulttimeout(10)
self.checkIn()
self.dispatcher.exceptions += ['natcl', 'discover']
src/j/a/jaft-HEAD/trunk/trace.py jaft(Download)
max_hoops = 25 baseport = 41381 socket.setdefaulttimeout(3) host = '' graphic = False ns_lookup = True
src/a/u/automanic-HEAD/ioData/server/lobby/ioLobbyServer.py automanic(Download)
self.maxclients = 1024
self.chatent = 'ioLobbyChat'
socket.setdefaulttimeout(10)
self.checkIn()
self.dispatcher.exceptions += ['natcl', 'discover']
src/j/a/jaft-HEAD/trace.py jaft(Download)
max_hoops = 25 baseport = 41381 socket.setdefaulttimeout(3) host = '' graphic = False ns_lookup = True
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next