def response(context, flow): """======================================================================== "Called when a server response has been received"... łapię wyłącznie odpowiedzi, bo interesują mnie zestawy (request/response). Przechwycony response wraz z requestem wchodzą w skład transakcji, reprezentowanej przez mitmproxy.models.HTTPFlow() "HTTPFlow is collection of objects representing a single HTTP transaction". Więcej info na WWW: http://docs.mitmproxy.org/en/stable/dev/models.html ===========================================================================""" if flow.request.host.endswith('.thesettlersonline.pl'): if "application/x-amf" in flow.response.headers.get("Content-Type", "_"): with decoded(flow.response): res = flow.response.content req = flow.request.content if search( 'defaultGame.Communication.VO.TradeWindow.dTradeWindowResultVO', res )\ and search( 'userAcceptedTradeIDs', res ) and search( 'tradeOffers', res )\ and search( 'GetAvailableOffers', req ): log.debug("got trade REQ/RESP pair, feeding TDD thread...") try: t= Thread(target=ttd._incoming_traffic_handler, args=(context, flow,)) t.setDaemon(True) t.start() except (KeyboardInterrupt, SystemExit): log.info('caught either KeyboardInterrupt or SystemExit, quitting threads') t.__stop() import thread thread.interrupt_main()
def response(context, flow): """======================================================================== ===========================================================================""" if flow.request.host.endswith('.thesettlersonline.pl'): if "application/x-amf" in flow.response.headers.get("Content-Type", "_"): with decoded(flow.response): res = flow.response.content if search( 'defaultGame.Communication.VO.dZoneVO', res )\ and search( 'defaultGame.Communication.VO.dBuffVO', res )\ and search( 'defaultGame.Communication.VO.dPlayerVO',res ): log.debug("got type 1001 response... wysyłam szpiega...") try: t= Thread(target=sgd._incoming_traffic_handler, args=(flow.response.content,)) t.setDaemon(True) t.start() except (KeyboardInterrupt, SystemExit): log.info('caught either KeyboardInterrupt or SystemExit, quitting threads') t.__stop() import thread thread.interrupt_main()
self.c.mysql_db ) db.autocommit(False) db.ping(reconnect=True) cur = db.cursor() cur.executemany(sql, sql_ins_data_list) db.commit() db.close() self.market = captured self.c.lastupdatedTS = self.now() self.updatecounter += 1 log.info('updatecounter %d'%self.updatecounter) t= Thread(target=self.market_research_a, args=(captured,)) t.setDaemon(True) t.start() ############################################################################### class Offer(object): """ oferta handlowa """ def __init__(self, r_offer, r_slotPos, r_created, r_type, r_senderID,\ r_senderName, r_lotsRemaining, r_id, r_slotType, realmName,\ servercurrtime): self.r_offer = r_offer self.r_slotPos = r_slotPos self.r_created = r_created self.r_type = r_type self.r_senderID = r_senderID self.r_senderName=r_senderName self.r_lotsRemaining= r_lotsRemaining