Ejemplo n.º 1
0
def login(**kwargs):
    s = None
    host = kwargs.get('host', config['msfrpcd/server'])
    port = kwargs.get('port', config['msfrpcd/port'])
    uri = kwargs.get('uri', config['msfrpcd/uri'])
    fn = cookie('%s.%s.%s.msfrpcd' % (host, port, uri.replace('/', '.')))
    if not path.exists(fn):
        f = fsemaphore(fn, 'wb')
        f.lockex()
        fv = [host, port, uri, 'msf']
        errmsg = ''
        while True:
            fv = multpasswordbox(
                errmsg, 'Metasploit Login',
                ['Server:', 'Port:', 'URI', 'Username:'******'Password:'], fv)
            if not fv:
                return
            try:
                s = MsfRpcClient(fv[4],
                                 server=fv[0],
                                 port=fv[1],
                                 uri=fv[2],
                                 username=fv[3])
            except MsfRpcError, e:
                errmsg = str(e)
                continue
            except socket.error, e:
                errmsg = str(e)
                continue
            break
Ejemplo n.º 2
0
def login(host='localhost', port='8834', username='', password=''):
    s = None
    fn = cookie('%s.%s.nessus' % (host, port))
    if not os.path.exists(fn):
        with fsemaphore(fn, 'wb') as f:
            f.lockex()
            errmsg = ''
            while True:
                fv = multpasswordbox(
                    errmsg,
                    'Nessus Login',
                    ['Server:', 'Port:', 'Username:'******'Password:'],
                    [host, port, username, password]
                )
                if not fv:
                    f.close()
                    os.unlink(fn)
                    return
                host, port, username, password = fv
                try:
                    s = NessusXmlRpcClient(username, password, host, port)
                except NessusException, e:
                    errmsg = str(e)
                    continue
                except socket.error, e:
                    errmsg = str(e)
                    continue
                break
            f.write(urlencode(dict(host=host, port=port, token=s.token)))
Ejemplo n.º 3
0
def get_creds():
    fn = cookie('netwitness')
    if not os.path.exists(fn):
        with fsemaphore(fn, 'wb') as f:
            f.lockex()
            while True:
                msg = 'Please enter your Netwitness credentials'
                fv = multpasswordbox(msg, 'Netwitness Credentials', ['Username:'******'Password:'******'username %s#password %s' % (nwu, nwp))
                break

    else:
        with fsemaphore(fn) as f:
            f.locksh()
            creds = f.read().split('#')
            for i in creds:
                if 'username' in i:
                    parse = i.split()
                    nwu = parse[1]
                if 'password' in i:
                    parse = i.split()
                    nwp = parse[1]

    return nwu, nwp
Ejemplo n.º 4
0
def login():
    s = None
    fn = cookie('nessus')
    if not path.exists(fn):
        f = fsemaphore(fn, 'wb')
        f.lockex()
        fv = ['localhost', '8834']
        errmsg = ''
        while True:
            fv = multpasswordbox(errmsg, 'Nessus Login', ['Server:', 'Port:', 'Username:'******'Password:'******'host' : fv[0], 'port' : fv[1], 'token': s.token}))
Ejemplo n.º 5
0
def insert_account_details():
    print "Loading canari.easygui ..."
    try:
        from canari.easygui import multpasswordbox
    except ImportError:
        print "Failed loading canari.easygui, trying to read from commandline"
        try:
            from getpass import getpass
        except ImportError:
            print "Failed loading getpass module, please add your Threat Central account details to {}".format(
                join(expanduser("~"), '.canari', 'ThreatCentral.conf'))
        else:
            print "Please enter your Threat Central account details"
            print ""
            return raw_input("Username: "), getpass()
    else:
        return multpasswordbox(msg='Please enter your username and password for Threat Central.',
                               title='Threat Central', fields=('username', 'password'))
Ejemplo n.º 6
0
def login():
    s = None
    fn = cookie('nessus')
    if not path.exists(fn):
        f = fsemaphore(fn, 'wb')
        f.lockex()
        fv = ['localhost', '8834']
        errmsg = ''
        while True:
            fv = multpasswordbox(
                errmsg, 'Nessus Login',
                ['Server:', 'Port:', 'Username:'******'Password:'******'host': fv[0], 'port': fv[1], 'token': s.token}))
Ejemplo n.º 7
0
def insert_account_details():
    print "Loading canari.easygui ..."
    try:
        from canari.easygui import multpasswordbox
    except ImportError:
        print "Failed loading canari.easygui, trying to read from commandline"
        try:
            from getpass import getpass
        except ImportError:
            print "Failed loading getpass module, please add your Threat Central account details to {}".format(
                join(expanduser("~"), '.canari', 'ThreatCentral.conf'))
        else:
            print "Please enter your Threat Central account details"
            print ""
            return raw_input("Username: "), getpass()
    else:
        return multpasswordbox(
            msg='Please enter your username and password for Threat Central.',
            title='Threat Central',
            fields=('username', 'password'))
Ejemplo n.º 8
0
def get_creds():
	fn = cookie('netwitness')
	if not path.exists(fn):
		f = fsemaphore(fn, 'wb')
		f.lockex()
		msg = 'Please enter your Netwitness credentials'
		fv = multpasswordbox(msg, 'Netwitness Credentials', ['Username:'******'Password:'******'username=%s#password=%s' % (nwu, nwp))
	else:
		f = fsemaphore(fn)
		f.locksh()
		creds = f.read().split('#')
		for i in creds:
			if 'username' in i:
				parse = i.split('=')
				nwu = parse[1]
			if 'password' in i:
				parse = i.split('=')
				nwp = parse[1]
	return nwu, nwp
Ejemplo n.º 9
0
def get_login():
    fn = cookie('pakey')
    if not path.exists(fn):
        f = fsemaphore(fn, 'wb')
        f.lockex()
        msg = "Please Enter the following Palo Alto Configuration"
        fv = easygui.multpasswordbox(msg, "PaloAlto Credentials", ['Username:'******'Password:'******'https://%s/api/?' % config['pamalt/pa_hostname']
        params_dic = {'type': 'keygen', 'user': pau, 'password': pap}

        enc_params = urllib.urlencode(params_dic)
        full_url = base_url + enc_params
        ret_data = http_get(full_url)
        root = ET.fromstring(ret_data)
        key = root[0][0].text
        f.write(key)
    else:
        f = fsemaphore(fn)
        f.locksh()
        key = f.read()
    return key
Ejemplo n.º 10
0
def get_login():
    fn = cookie('pakey')
    if not path.exists(fn):
        f = fsemaphore(fn, 'wb')
        f.lockex()
        msg = "Please Enter the following Palo Alto Configuration"
        fv = easygui.multpasswordbox(msg, "PaloAlto Credentials",
                                     ['Username:'******'Password:'******'https://%s/api/?' % config['pamalt/pa_hostname']
        params_dic = {'type': 'keygen', 'user': pau, 'password': pap}

        enc_params = urllib.urlencode(params_dic)
        full_url = base_url + enc_params
        ret_data = http_get(full_url)
        root = ET.fromstring(ret_data)
        key = root[0][0].text
        f.write(key)
    else:
        f = fsemaphore(fn)
        f.locksh()
        key = f.read()
    return key
Ejemplo n.º 11
0
def login(**kwargs):
    s = None
    host = kwargs.get('host', config['msfrpcd/server'])
    port = kwargs.get('port', config['msfrpcd/port'])
    uri = kwargs.get('uri', config['msfrpcd/uri'])
    fn = cookie('%s.%s.%s.msfrpcd' % (host, port, uri.replace('/', '.')))
    if not path.exists(fn):
        f = fsemaphore(fn, 'wb')
        f.lockex()
        fv = [ host, port, uri, 'msf' ]
        errmsg = ''
        while True:
            fv = multpasswordbox(errmsg, 'Metasploit Login', ['Server:', 'Port:', 'URI', 'Username:'******'Password:'], fv)
            if not fv:
                return
            try:
                s = MsfRpcClient(fv[4], server=fv[0], port=fv[1], uri=fv[2], username=fv[3])
            except MsfRpcError, e:
                errmsg = str(e)
                continue
            except socket.error, e:
                errmsg = str(e)
                continue
            break