Example #1
0
    def getFunnelURL(self):
        if patcherVer() == ['OFFLINE']:
            return
        if not patcherVer():
            patcherHTTP = HTTPClient()
            if checkParamFile() == None:
                patcherDoc = patcherHTTP.getDocument(URLSpec('http://download.toontown.com/english/currentVersion/content/patcher.ver'))
                vconGroup('w', self.cgRelease)
            else:
                patcherDoc = patcherHTTP.getDocument(URLSpec(checkParamFile()))
                vconGroup('w', self.cgBeta)
            rf = Ramfile()
            patcherDoc.downloadToRam(rf)
            self.patcherURL = rf.getData()
            if self.patcherURL.find('FUNNEL_LOG') == -1:
                patcherVer('w', 'OFFLINE')
                return
            self.patcherURL = self.patcherURL.split('\n')
            del rf
            del patcherDoc
            del patcherHTTP
            while self.patcherURL:
                self.confLine = self.patcherURL.pop()
                if self.confLine.find('FUNNEL_LOG=') != -1 and self.confLine.find('#FUNNEL_LOG=') == -1:
                    self.dynamicVRFunnel = self.confLine[11:].strip('\n')
                    patcherVer('w', self.confLine[11:].strip('\n'))

        else:
            self.dynamicVRFunnel = patcherVer()[0]
        return
Example #2
0
def reportMemoryLeaks():
    if printUnreachableNum() == 0:
        return
    import bz2, gc
    gc.set_debug(gc.DEBUG_SAVEALL)
    gc.collect()
    uncompressedReport = ''
    for s in gc.garbage:
        try:
            uncompressedReport += str(s) + '&'
        except TypeError:
            pass

    reportdata = bz2.compress(uncompressedReport, 9)
    headers = {'Content-type': 'application/x-bzip2',
     'Accept': 'text/plain'}
    try:
        baseURL = patcherVer()[0].split('/lo')[0]
    except IndexError:
        print 'Base URL not available for leak submit'
        return

    basePort = 80
    if baseURL.count(':') == 2:
        basePort = baseURL[-4:]
        baseURL = baseURL[:-5]
    baseURL = baseURL[7:]
    if basePort != 80:
        finalURL = 'http://' + baseURL + ':' + str(basePort) + '/logging/memory_leak.php?leakcount=' + str(printUnreachableNum())
    else:
        finalURL = 'http://' + baseURL + '/logging/memory_leak.php?leakcount=' + str(printUnreachableNum())
    reporthttp = HTTPClient()
    reporthttp.postForm(URLSpec(finalURL), reportdata)
 def __setAdArt(self):
     imageFrame = self.model.find('**/frame')
     randomImageNumber = random.randint(0, len(screenShots) - 1)
     imageFileName = screenShots[randomImageNumber]
     self.adImage = loader.loadModel(imageFileName)
     self.adImage.reparentTo(imageFrame)
     self.adImage.setScale(2.15 * 5, 1, 1.2 * 5)
     self.adImage.setPos(0, 0, 2.3)
     self.adImage.setBin('fixed', 1)
     if randomImageNumber == 0:
         urlToGet = 'http://log.go.com/log?srvc=dis&guid=951C36F8-3ACD-4EB2-9F02-8E8A0A217AF5&drop=0&addata=3232:64675:408091:64675&a=0'
         self.httpSession = HTTPClient()
         self.nonBlockHTTP = self.httpSession.makeChannel(False)
         self.nonBlockHTTP.beginGetDocument(DocumentSpec(urlToGet))
         instanceMarker = 'FunnelLoggingRequest-%s' % str(random.randint(1, 1000))
         self.startCheckingAsyncRequest(instanceMarker)
Example #4
0
def reportMemoryLeaks():
    # First check to make sure we are leaking, if number of leaks = 0, we can return
    if printUnreachableNum() == 0:
        return

    # If we made it this far, then some sort of leaking has happened.
    # For this, we will need the bz2(compression), gc(access to garbage list) modules

    import bz2, gc
    # import httplib

    gc.set_debug(gc.DEBUG_SAVEALL)
    gc.collect()
    uncompressedReport = ''
    for s in gc.garbage:
        try:
            uncompressedReport += str(s) + '&'
        except TypeError:
            # __repr__ is probably trying to return a non-string
            pass
    reportdata = bz2.compress(uncompressedReport, 9)

    headers = {"Content-type": "application/x-bzip2", "Accept": "text/plain"}
    # Need to split patcherVer()[0] to just get the base url and port
    try:
        baseURL = patcherVer()[0].split('/lo')[0]
    except IndexError:
        print 'Base URL not available for leak submit'
        return
    basePort = 80
    if baseURL.count(':') == 2:
        basePort = baseURL[-4:]
        baseURL = baseURL[:-5]
    baseURL = baseURL[7:]

    if basePort != 80:
        finalURL = 'http://' + baseURL + ':' + str(
            basePort) + '/logging/memory_leak.php?leakcount=' + str(
                printUnreachableNum())
    else:
        finalURL = 'http://' + baseURL + '/logging/memory_leak.php?leakcount=' + str(
            printUnreachableNum())
    reporthttp = HTTPClient()
    reporthttp.postForm(URLSpec(finalURL), reportdata)

    return
Example #5
0
 def getFunnelURL(self):
     # print 'VRS URL: ' + self.dynamicVRFunnel
     if (patcherVer() == ['OFFLINE']):
         # print "Funnel System Offline"
         return
     if (patcherVer() == []):
         # print "Funnel URL not set. Setting now"
         patcherHTTP = HTTPClient()
         if checkParamFile() == None:
             patcherDoc = patcherHTTP.getDocument(
                 URLSpec(
                     'http://download.toontown.com/english/currentVersion/content/patcher.ver'
                 ))
             # Now set vcon (Content Group) to the Release string
             vconGroup('w', self.cgRelease)
         else:
             patcherDoc = patcherHTTP.getDocument(URLSpec(checkParamFile()))
             # Set vcon (Content Group) to the Beta string
             vconGroup('w', self.cgBeta)
         # patcherDoc = patcherHTTP.getDocument(URLSpec('http://build64:3120/english/currentVersion/dev/content/patcher.ver'))
         rf = Ramfile()
         patcherDoc.downloadToRam(rf)
         self.patcherURL = rf.getData()
         if self.patcherURL.find('FUNNEL_LOG') == -1:
             # The file did not download, need to set
             # the patcherVer to offline
             patcherVer('w', 'OFFLINE')
             # print 'Patcher system could not be reached'
             return
         self.patcherURL = self.patcherURL.split('\n')
         del rf, patcherDoc, patcherHTTP
         while self.patcherURL:
             self.confLine = self.patcherURL.pop()
             if (self.confLine.find('FUNNEL_LOG=') != -1
                     and self.confLine.find('#FUNNEL_LOG=') == -1):
                 self.dynamicVRFunnel = self.confLine[11:].strip('\n')
                 patcherVer('w', self.confLine[11:].strip('\n'))
     else:
         self.dynamicVRFunnel = patcherVer()[0]
Example #6
0
 def __init__(self):
     self.hitboxAcct = 'DM53030620EW'
     self.language = 'en-us'
     self.cgRoot = 'ToonTown_Online'
     self.cgBeta = 'Beta'
     self.cgRelease = 'Release'
     self.cgLocation = 'US'
     self.campaignID = ''
     self.cfCookieFile = 'cf.txt'
     self.dynamicVRFunnel = 'http://download.toontown.com/'
     self.hostDict = {0: 'Internal Disney PHP Collector Site',
      1: 'ehg-dig.hitbox.com/HG?',
      2: 'ehg-dig.hitbox.com/HG?',
      3: 'build64.online.disney.com:5020/index.php?'}
     self.CurrentHost = ''
     self.URLtoSend = ''
     self.gameName = 'ToonTown'
     self.browserName = 'Panda3D%20(' + self.gameName + ';%20' + sys.platform + ')'
     self.HTTPUserHeader = [('User-agent', 'Panda3D')]
     self.osMajorver = ''
     self.osMinorver = ''
     self.osRevver = ''
     self.osBuild = ''
     self.osType = ''
     self.osComments = ''
     self.msWinTypeDict = {0: 'Win32s on Windows 3.1',
      1: 'Windows 95/98/ME',
      2: 'Windows NT/2000/XP',
      3: 'Windows CE'}
     self.milestoneDict = {0: 'New User',
      1: 'Create Account',
      2: 'View EULA',
      3: 'Accept EULA',
      4: 'Download Start',
      5: 'Download End',
      6: 'Installer Run',
      7: 'Launcher Start',
      8: 'Launcher Login',
      9: 'Client Opens',
      10: 'Create Pirate Loads',
      11: 'Create Pirate Exit',
      12: 'Cutscene One Start',
      13: 'Cutscene One Ends',
      14: 'Cutscene Two Start',
      15: 'Cutscene Thee Start',
      16: 'Cutscene Three Ends',
      17: 'Access Cannon',
      18: 'Cutscene Four Starts',
      19: 'Cutscene Four Ends',
      20: 'Dock - Start Game'}
     self.macTypeDict = {2: 'Jaguar',
      1: 'Puma',
      3: 'Panther',
      4: 'Tiger',
      5: 'Lepard'}
     self.milestone = ''
     self.pandaHTTPClientVarWSS = []
     self.pandaHTTPClientVarCTG = []
     self.pandaHTTPClientVarDM = []
     self.checkForCFfile()
     self.httpSession = HTTPClient()
     self.whatOSver()
Example #7
0
    def __init__(self):

        # Variables required for acct service access
        # HitBox Account Number.
        # DOL test account = DM510925KJWE
        # Pirates Account = DM560804E8WD
        # ToonTown Account = DM53030620EW

        self.hitboxAcct = 'DM53030620EW'
        # self.hitboxAcct = 'DM510925KJWE'
        # Language Used; example: English (US) = en-us

        self.language = 'en-us'

        # Content Group

        self.cgRoot = 'ToonTown_Online'

        # Content Sub-Groups
        # For now, I've hardcoded the cgLocation to US. In the future
        # we'll need to change this by hand or via a function, to reflect
        # the geolocation that this is being built for.

        self.cgBeta = 'Beta'
        self.cgRelease = 'Release'
        self.cgLocation = 'US'

        # Campaign ID for hitbox
        # Again, this ID has yet to be provided

        self.campaignID = ''

        # Cookie CallBack for HBX, but can be used for others if needed

        # self.cfCookie = cookielib.MozillaCookieJar('cf.txt')
        self.cfCookieFile = 'cf.txt'

        # Host Listing. Access hostnames and paths will be listed here
        # Each item has an int that goes along with it.

        self.dynamicVRFunnel = 'http://download.toontown.com/'
        # self.dynamicVRFunnel = 'http://build64:3120/logging/collector.php'

        self.hostDict = {
            0: 'Internal Disney PHP Collector Site',
            1: 'ehg-dig.hitbox.com/HG?',
            2: 'ehg-dig.hitbox.com/HG?',
            3: 'build64.online.disney.com:5020/index.php?'
        }

        # The current host variable will be an int value that points to an
        # entry in the hostDict. It is used at URL generation time to insert
        # the correct hostname and path into the URL

        self.CurrentHost = ''

        # URLtoSend is the actual URL that will be accessed when run() is called
        self.URLtoSend = ''

        # System Variables to report on. Currently, they are not all being used.
        # Some variables have been put in place for future use.

        # GameName is the name of the game being reported on

        self.gameName = 'ToonTown'

        # BrowserName for ID

        self.browserName = 'Panda3D%20(' + self.gameName + ';%20' + sys.platform + ')'
        # HTTPUserHeader to be transmitted once the http connection is established. This is not part of the URL that is sent. It is part of the header.

        self.HTTPUserHeader = [('User-agent', 'Panda3D')]

        # OS Major Version: Example MS-WinXP = 5, MacOSX Tiger = 10

        self.osMajorver = ''

        # OS Minor Version: Example MS-WinXP = 1, OSX Tiger = 4

        self.osMinorver = ''

        # OS Rev Version: Example OSX Tiger = 1...9

        self.osRevver = ''

        # OS Build Number: Example MS-WinXP = 2600

        self.osBuild = ''

        # OS Type. Example: int value that goes along with the msWinTypeDict

        self.osType = ''

        # The getwindowsversion command returns comments. An example would the a comment about the currently installed service pack

        self.osComments = ''

        # Dict of int to string pairs for self.osType

        self.msWinTypeDict = {
            0: 'Win32s on Windows 3.1',
            1: 'Windows 95/98/ME',
            2: 'Windows NT/2000/XP',
            3: 'Windows CE'
        }

        self.milestoneDict = {
            0: 'New User',
            1: 'Create Account',
            2: 'View EULA',
            3: 'Accept EULA',
            4: 'Download Start',
            5: 'Download End',
            6: 'Installer Run',
            7: 'Launcher Start',
            8: 'Launcher Login',
            9: 'Client Opens',
            10: 'Create Pirate Loads',
            11: 'Create Pirate Exit',
            12: 'Cutscene One Start',
            13: 'Cutscene One Ends',
            14: 'Cutscene Two Start',
            15: 'Cutscene Thee Start',
            16: 'Cutscene Three Ends',
            17: 'Access Cannon',
            18: 'Cutscene Four Starts',
            19: 'Cutscene Four Ends',
            20: 'Dock - Start Game'
        }

        self.macTypeDict = {
            2: 'Jaguar',
            1: 'Puma',
            3: 'Panther',
            4: 'Tiger',
            5: 'Lepard'
        }

        # Milestone string var. Used to hold the funnel location string. This used to be an int (as per the dict above), but later is was decided that it would be a string value; ie. START_GAME or BUILD_PIRATE_START. I have left the milestoneDict in place for reference purposes.

        self.milestone = ''

        # The next three lists hold the cookie vars for the three hitbox based
        # variable / value pairs requred for hitbox.
        # [DOMAIN, /, VARIABLE, VALUE]

        self.pandaHTTPClientVarWSS = []
        self.pandaHTTPClientVarCTG = []
        self.pandaHTTPClientVarDM = []

        # In an effort to determine if this is the first time the client has
        # been executed on the system, we will check for the existance of the
        # cf.txt file. If the file does not exist, we will set the firstRun()
        # to True.

        self.checkForCFfile()

        # Instance an HTTPClient session

        self.httpSession = HTTPClient()

        # Run the whatOSver command at the end of the constructor.
        self.whatOSver()
Example #8
0
        baseURL = patcherVer()[0].split('/lo')[0]
    except IndexError:
        print 'Base URL not available for leak submit'
        return None

    basePort = 80
    if baseURL.count(':') == 2:
        basePort = baseURL[-4:]
        baseURL = baseURL[:-5]
    
    baseURL = baseURL[7:]
    if basePort != 80:
        finalURL = 'http://' + baseURL + ':' + str(basePort) + '/logging/memory_leak.php?leakcount=' + str(printUnreachableNum())
    else:
        finalURL = 'http://' + baseURL + '/logging/memory_leak.php?leakcount=' + str(printUnreachableNum())
    reporthttp = HTTPClient()
    reporthttp.postForm(URLSpec(finalURL), reportdata)


def checkParamFile():
    if os.path.exists('parameters.txt') == 1:
        paramfile = open('parameters.txt', 'r')
        contents = paramfile.read()
        paramfile.close()
        del paramfile
        contents = contents.split('\n')
        newURL = ''
        while contents:
            checkLine = contents.pop()
            if checkLine.find('PATCHER_BASE_URL=') != -1 and checkLine[0] == 'P':
                newURL = checkLine.split('=')[1]