def toOsm(received_file): client = pymongo.MongoClient("mongodb://mongo:27017") setup_obj = setup(client) validate_obj = validator() if 'network_functions' in received_file: doc = setup_obj.db_descriptors["translated_nsd"] translated = setup_obj.translate_to_osm_nsd(received_file) check = validate_obj.osm_validator(translated) if check == "True": temp = doc.insert_one(translated) translated_ref = temp.inserted_id elif 'virtual_deployment_units' in received_file: doc = setup_obj.db_descriptors["translated_vnfd"] translated = setup_obj.translate_to_osm_vnfd(received_file) check = validate_obj.osm_validator(translated) if check == "True": temp = doc.insert_one(translated) translated_ref = temp.inserted_id return {"descriptor": translated, "VALIDATE STATUS": check}
def toSonata(received_file): client = pymongo.MongoClient("mongodb://mongo:27017") setup_obj = setup(client) validate_obj = validator() if 'vnfd:vnfd-catalog' in received_file: doc = setup_obj.db_descriptors["translated_vnfd"] translated = setup_obj.translate_to_sonata_vnfd(received_file) check = validate_obj.sonata_vnfd_validate(translated) if check == "True": temp = doc.insert_one(translated) translated_ref = temp.inserted_id elif 'nsd:nsd-catalog' in received_file: doc = setup_obj.db_descriptors["translated_nsd"] translated = setup_obj.translate_to_sonata_nsd(received_file) check = validate_obj.sonata_nsd_validate(translated) if check == "True": temp = doc.insert_one(translated) translated_ref = temp.inserted_id return {"descriptor": translated, "VALIDATE STATUS": check}
def login(): if request.method == "POST": user = request.form["user"] mail = request.form["mail_id"] url = request.form["url"] price = request.form["price"] if validator(mail, url, user) == "ok": usr = Users(user, mail, url, price) db.session.add(usr) db.session.commit() return render_template("success.html") else: return render_template("home.html") else: return render_template("home.html")
f_deauth.start() time_started = time.time() f_scanning = True while f_scanning == True: f_airodump_parent_conn.send(f_scanning) deauth_parent_conn.send(f_scanning) deauth = deauth_parent_conn.recv() time.sleep(10) if deauth == True: files_handshake = os.listdir(handshake_dir) for files in files_handshake: #scan pcap file for valid handshake EAPOL packets handshake_file = (handshake_dir+files) if handshake_file == (handshake_dir+f_xml.name+"_scan-01.cap"): valid = validator(SSID=(f_xml.name), BSSID=(f_xml.bssid), capfile=(handshake_file)) print "Stripping handshake cap file of unnecessary packets" valid.strip(handshake_dir+valid.SSID+'_strip.cap') print "Validating stripped cap file..." strip_valid = validator(SSID=(f_xml.name), BSSID=(f_xml.bssid), capfile=(handshake_dir+valid.SSID+'_strip.cap')) strip_valid.validate_handshake() strip_valid.analyze() print "Validation result of stripped handshake capture:", strip_valid.validation_result print "Analysis result of stripped handshake capture:", strip_valid.analyze_result #when handshake detected stop focussed attack if strip_valid.validation_result or strip_valid.analyze_result == True: print "Handshake captured, my job here is done..." f_xml.cracked = 'True'
from xml_arse import xml_machine ##!!!!!!!!Remeber Vivet Ramachandra said that the incomplete handshake captures fail unless tidied up!!!!!!!!! This is why verifications are failing... #file locations ##These should be improved to be located in temp files and then cleaned up afterwards target_dir = '/home/odroid/targets/' output_dir = '/home/odroid/xmls/' handshake_dir = '/home/odroid/hs/' cracked_dir = '/home/odroid/cracked/' if __name__ == '__main__': try: #use hs capture with maybe only two packets or known good capture and test why not getting positive results...... valid = validator( SSID=('FLACserve'), #add correct variables here BSSID=('48:5B:39:12:9C:9B'), #add correct variables here capfile=(handshake_dir + 'test.cap')) #add correct variables here print "Stripping handshake cap file of unnecessary packets" valid.strip(handshake_dir + 'test_strip.cap') valid_strip = validator( SSID=('FLACserve'), #add correct variables here BSSID=('48:5B:39:12:9C:9B'), #add correct variables here capfile=(handshake_dir + 'test_strip.cap')) #add correct variables here valid_strip.validate_handshake() print "Validation result of handshake capture:", valid_strip.validation_result valid_strip.analyze() print "Analysis result of handshake capture:", valid_strip.analyze_result #when handshake detected stop focussed attack if valid_strip.validation_result or valid_strip.analyze_result == True: print "Handshake captured, my job here is done..."
from xml_arse import xml_machine ##!!!!!!!!Remeber Vivet Ramachandra said that the incomplete handshake captures fail unless tidied up!!!!!!!!! This is why verifications are failing... #file locations ##These should be improved to be located in temp files and then cleaned up afterwards target_dir = '/home/odroid/targets/' output_dir = '/home/odroid/xmls/' handshake_dir = '/home/odroid/hs/' cracked_dir = '/home/odroid/cracked/' if __name__ == '__main__': try: #use hs capture with maybe only two packets or known good capture and test why not getting positive results...... valid = validator(SSID=('FLACserve'), #add correct variables here BSSID=('48:5B:39:12:9C:9B'), #add correct variables here capfile=(handshake_dir+'test.cap')) #add correct variables here print "Stripping handshake cap file of unnecessary packets" valid.strip(handshake_dir+'test_strip.cap') valid_strip = validator(SSID=('FLACserve'), #add correct variables here BSSID=('48:5B:39:12:9C:9B'), #add correct variables here capfile=(handshake_dir+'test_strip.cap')) #add correct variables here valid_strip.validate_handshake() print "Validation result of handshake capture:", valid_strip.validation_result valid_strip.analyze() print "Analysis result of handshake capture:", valid_strip.analyze_result #when handshake detected stop focussed attack if valid_strip.validation_result or valid_strip.analyze_result == True: print "Handshake captured, my job here is done..." except KeyboardInterrupt: print "manually interrupted!"