Exemplo n.º 1
0
 def test_get_cookies(self):
     test = Pfsense.PfSenseCertificate("https://192.168.1.1/", "admin",
                                       "pfsense")
     session = requests.session()
     get = session.get('https://192.168.1.1/', verify=False)
     cookies = test._PfSenseCertificate__get_cookies(get)
     self.assertEqual(cookies, get.cookies)
Exemplo n.º 2
0
 def test_get_certif_dl_link(self):
     test = Pfsense.PfSenseCertificate("https://192.168.1.1/", "admin",
                                       "pfsense")
     dic = test._PfSenseCertificate__get_certif_dl_link(
         "1234 4zlekfjzoeifjzei system_certmanager.php?act=exp&id=0 f zoeifuzoif zefzio CN=HUGO osijdozi CN=test zqdq d system_certmanager.php?act=exp&id=1 z",
         "CN=HUGO")
     self.assertEqual(
         dic, "https://192.168.1.1/system_certmanager.php?act=exp&amp&id=0")
Exemplo n.º 3
0
 def test_get_csrf(self):
     test = Pfsense.PfSenseCertificate("https://192.168.1.1/", "admin",
                                       "pfsense")
     csrf = test._PfSenseCertificate__get_csrf(
         'zekfljezlfkzehjf ùpzefzef zefpioj var csrfMagicToken = "sid:70aceff886f2b618da337d717d256ad0e2dab0eb,1551175658";var csrfMagicName = "__csrf_magic"  scvoisdjfiozefsvnjisvn sdofijvsdiofjv '
     )
     self.assertEqual(
         csrf, 'sid:70aceff886f2b618da337d717d256ad0e2dab0eb,1551175658')
Exemplo n.º 4
0
 def test_get_certif_name(self):
     test = Pfsense.PfSenseCertificate("https://192.168.1.1/", "admin",
                                       "pfsense")
     name = test._PfSenseCertificate__get_certif_names(
         "1234 4zlekfjzoeifjzeif zoeifuzoif zefzio CN=HUGO osijdozi CN=test zqdq dz"
     )
     self.assertEqual(name[0], 'CN=HUGO')
     self.assertEqual(name[1], "CN=test")
Exemplo n.º 5
0
 def test_payload_co(self):
     test = Pfsense.PfSenseCertificate("https://192.168.1.1/", "admin",
                                       "pfsense")
     payload = test._PfSenseCertificate__gen_payloadConnexion(
         "csrf", "admin", "pfsense")
     self.assertEqual(payload['__csrf_magic'], "csrf")
     self.assertEqual(payload['usernamefld'], "admin")
     self.assertEqual(payload['passwordfld'], "pfsense")
Exemplo n.º 6
0
 def test_create_dic_from_lists(self):
     test = Pfsense.PfSenseCertificate("https://192.168.1.1/", "admin",
                                       "pfsense")
     l1 = ['pomme', 'fraise', 'bannane']
     l2 = ['rouge', 'rose', 'jaune']
     dic = test._PfSenseCertificate__create_dic_from_lists(l1, l2)
     self.assertEqual(dic['pomme'], "rouge")
     self.assertEqual(dic['fraise'], "rose")
     self.assertEqual(dic['bannane'], "jaune")
Exemplo n.º 7
0
 def test_payload_cert(self):
     test = Pfsense.PfSenseCertificate("https://192.168.1.1/", "admin",
                                       "pfsense")
     payload = test._PfSenseCertificate__gen_payloadCertificat(
         "csrf", "hugo", "10")
     self.assertEqual(payload['__csrf_magic'], "csrf")
     self.assertEqual(payload['descr'], "hugo")
     self.assertEqual(payload['dn_commonname'], "hugo")
     self.assertEqual(payload['altname_value0'], "hugo")
     self.assertEqual(payload['lifetime'], "10")
Exemplo n.º 8
0
def createCertifAll(name, dayz, path):
    namefile = name + ".crt"
    test = auto.PfSenseCertificate("https://192.168.1.1/", "admin", "pfsense")
    test.create_cert(name, dayz)
    open(path + namefile, 'wb').write(test.dl_cert(name))
Exemplo n.º 9
0
 def test_constructeur(self):
     test = Pfsense.PfSenseCertificate("https://192.168.1.1/", "admin",
                                       "pfsense")
     self.assertEqual(test.m_url, "https://192.168.1.1/")
     self.assertEqual(test.m_login, "admin")
     self.assertEqual(test.m_pass, "pfsense")