Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Rest-Framework Parser Convert xml to json, including attributes
##Getting Started
You need Python 3.7 or later
You also need json and xmltodict packages available from PyPI, if you have pip just run:
pip install xmltodict
####Instalation
pip install KXMLParser
Setting parser, edit settings.py :
REST_FRAMEWORK = {
'DEFAULT_PARSER_CLASSES': [
'KXMLParser.parsers.XMLParser',
],
}
Example
<?xml version="1.0" encoding="UTF-8"?>
<pessoas>
<pessoa codigo="1" nome="Fulano" telefone="2222-2222">
<endereco referencia='Ponto de Onibus, Pomar'>
<rua>Rua Marfim</rua>
<numero>1</numero>
<cidade>Ouro Preto</cidade>
<cep>35400-000</cep>
</endereco>
</pessoa>
<pessoa codigo="2" nome="Beltrano" telefone="3333-3333">
<endereco referencia='Ponto de Onibus, Pomar'>
<rua>Rua Marfim</rua>
<numero>2</numero>
<cidade>Ouro Preto</cidade>
<cep>35400-000</cep>
</endereco>
</pessoa>
<pessoa codigo="1" nome="Ciclano" telefone="4444-4444">
<endereco referencia='Ponto de Onibus, Pomar'>
<rua>Rua Marfim</rua>
<numero>3</numero>
<cidade>Ouro Preto</cidade>
<cep>35400-000</cep>
</endereco>
</pessoa>
</pessoas>
Result
{
"pessoas": {
"pessoa": [
{
"@codigo": "1",
"@nome": "Fulano",
"@telefone": "2222-2222",
"endereco": {
"@referencia": "Ponto de Onibus, Pomar",
"rua": "Rua Marfim",
"numero": "1",
"cidade": "Ouro Preto",
"cep": "35400-000"
}
},
{
"@codigo": "2",
"@nome": "Beltrano",
"@telefone": "3333-3333",
"endereco": {
"@referencia": "Ponto de Onibus, Pomar",
"rua": "Rua Marfim",
"numero": "2",
"cidade": "Ouro Preto",
"cep": "35400-000"
}
},
{
"@codigo": "1",
"@nome": "Ciclano",
"@telefone": "4444-4444",
"endereco": {
"@referencia": "Ponto de Onibus, Pomar",
"rua": "Rua Marfim",
"numero": "3",
"cidade": "Ouro Preto",
"cep": "35400-000"
}
}
]
}
}
FAQs
Rest Framework Parser xml to json
We found that KXMLParser demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.