예제 #1
0
def start_servers():
    if SETTINGS['DNS']:
        FAKEDNS.main(SETTINGS['Interface_IP'],
                     generate_dns_rules(),
                     SETTINGS['DNS_Rules']['Pass_Through_IP'],
                     SETTINGS['Debug'])
        print('>> DNS server thread is running...')

    if SETTINGS['HTTP']:
        try:
            server = ThreadedHTTPServer((SETTINGS['Interface_IP'], SETTINGS['HTTP_Port']), MyHandler)
            thread = threading.Thread(name='HTTP_Server',
                                      target=server.serve_forever,
                                      args=(),
                                      daemon=True)
            thread.start()
            print('>> HTTP server thread is running...')
        except socket.error:
            closer('ERROR: Could not start server, is another program on tcp:{}?'.format(SETTINGS['HTTP_Port']))
        except OSError:
            print('ERROR: Could not start server, is another program on tcp:{}?'.format(SETTINGS['HTTP_Port']))
            closer('    ^^This could also be a permission error^^')
        except UnicodeDecodeError:
            print('ERROR: Python failed to get a FQDN (This is a Python Bug)')
            closer('    ^^Change your computers name to be [a-zA-Z0-9]^^')
예제 #2
0
def start_servers():
    if SETTINGS['DNS']:
        FAKEDNS.main(SETTINGS['DNS_Interface_IP'],
                     SETTINGS['DNS_Port'],
                     generate_dns_rules(),
                     SETTINGS['DNS_Rules']['Pass_Through_IP'],
                     SETTINGS['Debug'])
        print('>> DNS server thread is running...')

    if SETTINGS['HTTP']:
        try:
            server = ThreadedHTTPServer((SETTINGS['HTTP_Interface_IP'], SETTINGS['HTTP_Port']), MyHandler)
            thread = threading.Thread(name='HTTP_Server',
                                      target=server.serve_forever,
                                      args=(),
                                      daemon=True)
            thread.start()
            print('>> HTTP server thread is running...')
        except socket.error:
            closer('ERROR: Could not start server, is another program on tcp:{}?'.format(SETTINGS['HTTP_Port']))
        except OSError:
            print('ERROR: Could not start server, is another program on tcp:{}?'.format(SETTINGS['HTTP_Port']))
            closer('    ^^This could also be a permission error^^')
        except UnicodeDecodeError:
            print('ERROR: Python failed to get a FQDN (This is a Python Bug)')
            closer('    ^^Change your computers name to be [a-zA-Z0-9]^^')
예제 #3
0
def start_servers(lan, rules):
    """Start DNS and HTTP servers on seperate threads"""
    FAKEDNS.main(lan, rules, DEBUG)
    print('>> DNS server thread is running...')

    try:
        server = ThreadedHTTPServer((lan, 80), MyHandler)
        thread = threading.Thread(name='HTTP_Server',
                                  target=server.serve_forever,
                                  args=(),
                                  daemon=True)
        thread.start()
        print('>> HTTP server thread is running...')
    except socket.error:
        closer('ERROR: Could not start server, is another program on tcp:80?')
    except OSError:
        print('ERROR: Could not start server, is another program on tcp:80')
        sys.exit('    ^^This could also be a permission error^^')
예제 #4
0
def start_servers():
    if SETTINGS['DNS']:
        FAKEDNS.main(SETTINGS['Interface'],
                     generate_dns_rules(),
                     SETTINGS['DNS_Rules']['Pass_Through'],
                     SETTINGS['Debug'])
        print('>> DNS server thread is running...')

    if SETTINGS['HTTP']:
        try:
            server = ThreadedHTTPServer((SETTINGS['Interface'], 80), MyHandler)
            thread = threading.Thread(name='HTTP_Server',
                                      target=server.serve_forever,
                                      args=(),
                                      daemon=True)
            thread.start()
            print('>> HTTP server thread is running...')
        except socket.error:
            closer('ERROR: Could not start server, is another program on tcp:80?')
        except OSError:
            print('ERROR: Could not start server, is another program on tcp:80')
            closer('    ^^This could also be a permission error^^')