mushorg / conpot

ICS/SCADA honeypot
GNU General Public License v2.0
1.21k stars 409 forks source link

No matching global declaration error in custom template #553

Closed WZcabral closed 3 years ago

WZcabral commented 3 years ago

I modified Conpot's default template.xml file to mimic a PowerLogic meter. However, I get this error while trying to run it. Any help is most welcome.

2021-03-01 00:52:19,233 Starting Conpot using template: /usr/local/lib/python3.6/dist-packages/conpot-0.6.0-py3.6.egg/conpot/templates/default
2021-03-01 00:52:19,233 Starting Conpot using configuration found in: /usr/local/lib/python3.6/dist-packages/conpot-0.6.0-py3.6.egg/conpot/testing.cfg
ERROR:root:Error parsing XML template: /usr/local/lib/python3.6/dist-packages/conpot-0.6.0-py3.6.egg/conpot/templates/default/template.xml:1:0:ERROR:SCHEMASV:SCHEMAV_CVC_ELT_1: Element 'conpot_template': No matching global declaration available for the validation root.
2021-03-01 00:52:19,237 Error parsing XML template: /usr/local/lib/python3.6/dist-packages/conpot-0.6.0-py3.6.egg/conpot/templates/default/template.xml:1:0:ERROR:SCHEMASV:SCHEMAV_CVC_ELT_1: Element 'conpot_template': No matching global declaration available for the validation root.
glaslos commented 3 years ago

@WZcabral it would be great if you could paste the text from the error instead of providing an image. This makes it possible for others and search engines to find your described issue in the future. Your configuration is not matching the schema. You should be able to validate it using the linked schema. If you provide your config, I might be able to help you spot the issue.

glaslos commented 3 years ago

@WZcabral provided the template in private. It seems you can solve your issues by removing the outer conpot_template. Your template should look like:

<core>
    <template>
...
WZcabral commented 3 years ago

Thanks, @glaslos! I did just that however, now I am getting a new error which is:

WARNING:root:--force option specified. Using testing configuration
2021-03-01 02:44:11,866 --force option specified. Using testing configuration
2021-03-01 02:44:11,866 Starting Conpot using template: /usr/local/lib/python3.6/dist-packages/conpot-0.6.0-py3.6.egg/conpot/templates/default
2021-03-01 02:44:11,867 Starting Conpot using configuration found in: /usr/local/lib/python3.6/dist-packages/conpot-0.6.0-py3.6.egg/conpot/testing.cfg
ERROR:root:Error parsing XML template: /usr/local/lib/python3.6/dist-packages/conpot-0.6.0-py3.6.egg/conpot/templates/default/template.xml:66:0:ERROR:SCHEMASV:SCHEMAV_ELEMENT_CONTENT: Element 'protocols': This element is not expected.
2021-03-01 02:44:11,867 Error parsing XML template: /usr/local/lib/python3.6/dist-packages/conpot-0.6.0-py3.6.egg/conpot/templates/default/template.xml:66:0:ERROR:SCHEMASV:SCHEMAV_ELEMENT_CONTENT: Element 'protocols': This element is not expected.

So, I deleted the entire protocol section in the template and edited the protocols separately within their own files which seemed to fix the issues. Closing this thread