from scapy.all import *
import yaml
import sqlite3

yamlfile=open("config.yaml")
data = yaml.load(yamlfile, Loader=yaml.FullLoader)
mydb=sqlite3.connect("assets.db",check_same_thread=False)
query=mydb.cursor()

def show_list():
	for i in get_if_list():
		if(not query.execute("SELECT interface_name FROM interfaces WHERE interface_name='"+i+"'").fetchone()):
			updateiface='INSERT INTO interfaces\
					(interface_name,plant)\
					VALUES\
					("'+i+'","'+data["configuration"]["edge_device_location"]+'")'
			query.execute(updateiface)
			mydb.commit()
	query.close()
	print(get_if_list())