我在学校做一个项目。我要求将瞻博网络防火墙配置文件转换为另一种防火墙语法。我的问题是将juniper conf文件转换为字典,以便我可以处理它
我尝试用“{”和“}”和一堆不同的东西分割文本,但似乎没有帮助
family inet {
replace:
/*
** $Id:$
** $Date:$
** $Revision:$
**
*/
filter bridge {
interface-specific;
term rule100 {
from {
source-address {
10.0.0.1/32;
}
destination-address {
10.0.0.1/32;
}
protocol tcp;
destination-port 80;
}
then {
discard;
}
}
}
}
}
我期待这样的python字典
dic = { "term rule100" : {
"from" :{
"source-address" : "10.0.0.1/32;",
"destination-address" : "10.0.0.1/32;",
"protocol" :"tcp;", "destination-port" : "80;",
"then" : "discard;"
},
}
}