# Path: Peach/Utilities/network.py
# def cleanupSocketProcesses():
# def getUnboundPort(host="", minRange=30000, maxRange=35000, socket_type=1, assignOnlyOnce=False):
# def runHTTPDThread():


import os
import uuid
import subprocess
import re
import atexit
import shutil
import logging
import shlex
from Peach.Utilities import network
        logging.debug(self.profile_prefs_path)
        shutil.copyfile(pref_path, self.profile_prefs_path)
        logging.debug("Successfully created temporary Firefox profile at %s" % self.profile_prefs_path)

    @staticmethod
    def getInstanceById(identifier, config):
        if identifier not in FirefoxProfile.instances:
            FirefoxProfile.instances[identifier] = FirefoxProfile(identifier, config)
        return FirefoxProfile.instances[identifier]

    @staticmethod
    @atexit.register
    def cleanInstances():
        for instance in FirefoxProfile.instances.values():
            instance.destroy()

    def __repr__(self):
        return self.profile_name

    def destroy(self):
        if self.profile_prefs_path.endswith('/prefs.js'):
            profile_path = os.path.dirname(self.profile_prefs_path)
            logging.debug("Deleting temporary Firefox profile at %s" % profile_path)
            shutil.rmtree(profile_path)


class TCPPort(object):
    instances = {}

    def __init__(self, identifier, config):

# Path: Peach/Utilities/network.py
# def cleanupSocketProcesses():
# def getUnboundPort(host="", minRange=30000, maxRange=35000, socket_type=1, assignOnlyOnce=False):
# def runHTTPDThread():


# Path: Peach/config.py
import os
import uuid
import subprocess
import re
import atexit
import shutil
import logging
import shlex
from Peach.Utilities import network

        logging.debug(self.profile_prefs_path)
        shutil.copyfile(pref_path, self.profile_prefs_path)
        logging.debug("Successfully created temporary Firefox profile at %s" % self.profile_prefs_path)

    @staticmethod
    def getInstanceById(identifier, config):
        if identifier not in FirefoxProfile.instances:
            FirefoxProfile.instances[identifier] = FirefoxProfile(identifier, config)
        return FirefoxProfile.instances[identifier]

    @staticmethod
    @atexit.register
    def cleanInstances():
        for instance in FirefoxProfile.instances.values():
            instance.destroy()

    def __repr__(self):
        return self.profile_name

    def destroy(self):
        if self.profile_prefs_path.endswith('/prefs.js'):
            profile_path = os.path.dirname(self.profile_prefs_path)
            logging.debug("Deleting temporary Firefox profile at %s" % profile_path)
            shutil.rmtree(profile_path)


class TCPPort(object):
    instances = {}

    def __init__(self, identifier, config):

        self.port_number = network.getUnboundPort(assignOnlyOnce=True)