def initConfigFile(self):
        print "[+] Creating a new config file."
        i_server = ""
        i_port = 25
        i_timeout = 300
        i_auth = "no"
        i_user = ""
        i_pass = ""
        i_from = ""
        i_to = ""
        i_tls = "no"

        while True:
            i_server = raw_input('    > Enter smtp mail server IP or hostname: ')
            if not i_server == "":
                break

        while True:
            i_port = raw_input('    > Enter mail server port (default: 25): ')
            if not str(i_port) == "":
                try:
                    i_port = int(i_port)
                    break
                except:
                    continue
            else:
                i_port = 25
                break

        while True:
            i_from = raw_input("    > Enter 'From' email address: ")
            if not i_from == "":
                break

        while True:
            i_to = raw_input("    > Enter 'To' email address: ")
            if not i_to == "":
                break

        while True:
            i_timeout = raw_input('    > Enter mail server timeout (in seconds, default: 300): ')
            if not str(i_timeout) == "":
                try:
                    i_timeout = int(i_timeout)
                    break
                except:
                    continue
            else:
                i_timeout = 300
                break

        while True:
            i_auth = raw_input('    > Does server require authentication? (yes/no, default: no): ')
            i_auth = i_auth.lower()
            if i_auth == "":
                i_auth = "no"
            if i_auth in ["yes", "no"]:
                break

        if i_auth == "yes":
            while True:
                i_user = raw_input('    > Username: ')
                if not i_user == "":
                    break
            while True:
                i_pass = raw_input('    > Password: ')
                if not i_pass == "":
                    break

        while True:
            i_tls = raw_input('    > Does server require/support STARTTLS ? (yes/no, default: no): ')
            i_tls = i_tls.lower()
            if i_tls == "":
                i_tls = "no"
            if i_tls in ["yes", "no"]:
                break

        initserverdata = []
        initserverdata.append("server=%s" % i_server)
        initserverdata.append("port=%d" % i_port)
        initserverdata.append("from=%s" % i_from)
        initserverdata.append("to=%s" % i_to)
        initserverdata.append("timeout=%d" % i_timeout)
        initserverdata.append("auth=%s" % i_auth)
        initserverdata.append("user=%s" % i_user)
        initserverdata.append("pass=%s" % i_pass)
        initserverdata.append("tls=%s" % i_tls)

        self.serverinfo = {}
        self.serverinfo[i_server] = initserverdata
        self.writeConfigFile()
        return
dataset/ETHPy150Open corelan/dnshjmon/dnshjmon.py/MailConfig.initConfigFile/original