示例#1
0
def checkPortConflict(knockPort):
    if not os.path.isdir(PROFILES_DIR):
        return

    profiles        = Profiles(PROFILES_DIR)
    matchingProfile = profiles.getProfileForPort(knockPort)

    if matchingProfile is not None:
        print "A profile already exists for knock port: " + str(knockPort) + " at this location: " + matchingProfile.getDirectory()
def checkPortConflict(knockPort):
    if (not os.path.isdir(PROFILES_DIR)):
        return

    profiles = Profiles(PROFILES_DIR)
    matchingProfile = profiles.getProfileForPort(knockPort)

    if (matchingProfile != None):
        print('A profile already exists for knock port: ' + str(knockPort) +
              ' at this location: ' + matchingProfile.getDirectory())
示例#3
0
def main(argv):
    checkPrivileges()
    checkConfiguration()

    profiles   = Profiles('/etc/knockknock.d/profiles/')
    config     = DaemonConfiguration('/etc/knockknock.d/config')

    if (profiles.isEmpty()):
        print('WARNING: Running knockknock-daemon without any active profiles.')

    knockknock.daemonize.createDaemon()

    input, output = os.pipe()
    pid           = os.fork()

    if pid:
        os.close(input)
        handleKnocks(os.fdopen(output, 'w'), profiles, config)
    else:
        os.close(output)
        handleFirewall(os.fdopen(input, 'r'), config)
def main(argv):
    checkPrivileges()
    checkConfiguration()

    profiles = Profiles("/etc/knockknock.d/profiles/")
    config = DaemonConfiguration("/etc/knockknock.d/config")

    if profiles.isEmpty():
        print "WARNING: Running knockknock-daemon without any active profiles."

    knockknock.daemonize.createDaemon()

    input, output = os.pipe()
    pid = os.fork()

    if pid:
        os.close(input)
        handleKnocks(os.fdopen(output, "w"), profiles, config)
    else:
        os.close(output)
        handleFirewall(os.fdopen(input, "r"), config)
def main(argv):
    checkPrivileges()
    checkConfiguration()

    profiles   = Profiles('/etc/knockknock.d/profiles/')
    config     = DaemonConfiguration('/etc/knockknock.d/config')

    if (profiles.isEmpty()):
        print 'WARNING: Running knockknock-daemon without any active profiles.'

    knockknock.daemonize.start()

    input, output = os.pipe()
    pid           = os.fork()

    if pid:
        os.close(input)
        handleKnocks(os.fdopen(output, 'w'), profiles, config)
    else:
        os.close(output)
        handleFirewall(os.fdopen(input, 'r'), config)
示例#6
0
def getProfiles():
    homedir  = os.path.expanduser('~')
    profiles = Profiles(homedir + '/.knockknock/')
    profiles.resolveNames()
    
    return profiles
示例#7
0
def getProfiles():
    homedir  = os.path.expanduser('~')
    profiles = Profiles(homedir + '/.knockknock/')
    profiles.resolveNames()
    
    return profiles