예제 #1
0
 def __init__(self, attackCard, context):
     """ Initialize the Request with the attack """
     self.attackCard = attackCard
     self.context = context
     self.defenseFilters = [ComparisonFilter(zoneType, FixedCriteria("defendFrom", zoneType, "==")) for zoneType in self.ZONES]
     self.cardsForZone = {}
     Request.__init__(self, [context.player])
예제 #2
0
    def __init__(self, url, password, proxy=None):

        Request.__init__(self, url, proxy)

        self.password = password
        self.extractor = re.compile("<%s>(.*)</%s>" % (self.password[2:], self.password[2:]), re.DOTALL)
        # 		self.extractor_debug = re.compile( "<%sDEBUG>(.*)</%sDEBUG>" % ( self.password[2:], self.password[2:] ), re.DOTALL )
        self.parsed = urlparse.urlparse(self.url)
        self.data = None

        if not self.parsed.path:
            self.query = self.parsed.netloc.replace("/", " ")
        else:
            self.query = "".join(self.parsed.path.split(".")[:-1]).replace("/", " ")
예제 #3
0
파일: cmdrequest.py 프로젝트: t3ll0/Weevely
	def __init__( self, url, password, proxy = None ):
		
		
		Request.__init__( self, url, proxy)
			
		self.password  = password
		self.extractor = re.compile( "<%s>(.*)</%s>" % ( self.password[2:], self.password[2:] ), re.DOTALL )
#		self.extractor_debug = re.compile( "<%sDEBUG>(.*)</%sDEBUG>" % ( self.password[2:], self.password[2:] ), re.DOTALL )
		self.parsed	   = urlparse.urlparse(self.url)
		self.data = None


		if not self.parsed.path:
			self.query = self.parsed.netloc.replace( '/', ' ' )
		else:
			self.query = ''.join( self.parsed.path.split('.')[:-1] ).replace( '/', ' ' )
 def __init__(self, cards, player, cost, toDescription):
     """ Initialize the Request with the potential options """
     self.cards = cards
     self.cost = cost
     self.toDescription = toDescription
     Request.__init__(self, [player])
예제 #5
0
'''Helpful print statements'''
print 'Beginning torrent for ' + name 
print 'Average piece length: ' + str(piece_length)
if debug:
	print 'The last piece will be of size: ' + str(last_piece_length)
print 'Total length: ' + str(total_length) 
print 'Number of pieces to receive: ' + str(num_pieces) + '\n'
'''////////////////////////''' 

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
host = socket.gethostname() # Get local machine name
'''host = 'bl_tardis'			'kate-english' - HE'''
port = 42044                # 25159 - HE
s.connect((host, port)) 	#connect to <host> at <port>

Request.__init__(s, num_pieces, piece_length, last_piece_length, debug, pieces, name) 

# Handshake
peer_id = ""
while len(peer_id) != 12:
	peer_id = peer_id + choice("1234567890")

peer_id = '-' + 'PY' + '0001' + '-' + peer_id
protocol_id = 'BitTorrent protocol'
# len_id = str(len(protocol_id))
reserved = '\x00'*7 + '\x01'
handshake = '\x13' + protocol_id + reserved + info_hash + peer_id

s.send(handshake)
data = s.recv(len(handshake))
예제 #6
0
 def __init__(self, options, player, relevantCards=None):
     """ Initialize the Request with the potential options """
     self.options = options
     self.relevantCards = relevantCards
     Request.__init__(self, [player])
예제 #7
0
파일: ping.py 프로젝트: Saiai/Mai-chan
 def __init__(self, sender):
     Request.__init__(self)
     self.response = '{} pong! Hehe that was fun!'.format(sender)
예제 #8
0
 def __init__(self, id, message):
     Request.__init__(self, 'POST', 'http://www.reddit.com/api/comment', api_type='json',
                      text=message, thing_id=id)
예제 #9
0
 def __init__(self, username, password):
     Request.__init__(self, 'POST', 'http://www.reddit.com/api/login', api_type='json', user=username, passwd=password)
 def __init__(self, post_url, limit=25):
     Request.__init__(self, 'GET', '{0}.json'.format(post_url), limit=limit)
     self.json = None
     self.comments = []