Skip to content

Commit

Permalink
Create change_password_endpoint_xmlrpc.json
Browse files Browse the repository at this point in the history
  • Loading branch information
maxalone authored Sep 23, 2022
1 parent bbb1754 commit 171cf54
Showing 1 changed file with 389 additions and 0 deletions.
389 changes: 389 additions & 0 deletions RED_node/change_password_endpoint_xmlrpc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,389 @@
[
{
"id": "c628ee0b2cfbe6fe",
"type": "http in",
"z": "46920228373bafd0",
"name": "",
"url": "/www/osname",
"method": "post",
"upload": false,
"swaggerDoc": "",
"x": 170,
"y": 3340,
"wires": [
[
"0e145eb1b7207878"
]
]
},
{
"id": "0e145eb1b7207878",
"type": "function",
"z": "46920228373bafd0",
"name": "",
"func": "\nfunction xorStrings(key, input) {\n var output = '';\n for (var i = 0; i < input.length; i++) {\n var c = input.charCodeAt(i);\n var k = key.charCodeAt(i % key.length);\n output += String.fromCharCode(c ^ k);\n }\n return output;\n}\nconst buff = Buffer.from(msg.payload.pass, 'base64');\nconst str = buff.toString('utf-8');\nmsg.payload.passenc = xorStrings(msg.payload.key, str);\n\nconst nomecompleto = msg.payload.avatar;\nconst a_nomecomp = nomecompleto.split(\" \");\nconst nome= a_nomecomp[0];\nconst cognome = a_nomecomp[1];\nmsg.payload.nome=nome;\nmsg.payload.cognome=cognome;\n\n\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 360,
"y": 3340,
"wires": [
[
"aefa31de29a16132"
]
]
},
{
"id": "b4c936b24103a263",
"type": "template",
"z": "46920228373bafd0",
"name": "topbase",
"field": "topbase",
"fieldType": "msg",
"format": "text",
"syntax": "plain",
"template": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><methodCall><methodName>admin_update_user</methodName><params><param><value><struct><member><name>password</name><value><string>__YOUR_ADMIN_XMLRPC_PASSWORD_</string></value></member>",
"output": "str",
"x": 420,
"y": 3380,
"wires": [
[
"1cdbaa65a43981b1"
]
]
},
{
"id": "1cdbaa65a43981b1",
"type": "template",
"z": "46920228373bafd0",
"name": "username",
"field": "username",
"fieldType": "msg",
"format": "text",
"syntax": "mustache",
"template": "<member><name>user_firstname</name><value><string>{{payload.nome}}</string></value></member>",
"output": "str",
"x": 420,
"y": 3420,
"wires": [
[
"84f7be8c2ed8dd5b"
]
]
},
{
"id": "84f7be8c2ed8dd5b",
"type": "template",
"z": "46920228373bafd0",
"name": "lastname",
"field": "lastname",
"fieldType": "msg",
"format": "text",
"syntax": "mustache",
"template": "<member><name>user_lastname</name><value><string>{{payload.cognome}}</string></value></member>",
"output": "str",
"x": 420,
"y": 3460,
"wires": [
[
"52800a3548d724b6"
]
]
},
{
"id": "52800a3548d724b6",
"type": "template",
"z": "46920228373bafd0",
"name": "userpass",
"field": "userpass",
"fieldType": "msg",
"format": "text",
"syntax": "mustache",
"template": "<member><name>user_password</name><value><string>{{payload.passenc}}</string></value></member>",
"output": "str",
"x": 420,
"y": 3500,
"wires": [
[
"936eae1bd462c97e"
]
]
},
{
"id": "91a3ee3beb41435d",
"type": "function",
"z": "46920228373bafd0",
"name": "monta xml",
"func": "msg.payload=msg.topbase+msg.username+msg.lastname+msg.userpass+msg.bottombase;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 600,
"y": 3540,
"wires": [
[
"c7ff9e304b88686a"
]
]
},
{
"id": "936eae1bd462c97e",
"type": "template",
"z": "46920228373bafd0",
"name": "bottombase",
"field": "bottombase",
"fieldType": "msg",
"format": "text",
"syntax": "plain",
"template": "</struct></value></param></params></methodCall>",
"output": "str",
"x": 430,
"y": 3540,
"wires": [
[
"91a3ee3beb41435d"
]
]
},
{
"id": "da9b0bc753c8e435",
"type": "http request",
"z": "46920228373bafd0",
"name": "azione opensim",
"method": "POST",
"ret": "txt",
"paytoqs": "ignore",
"url": "http://172.17.0.5:9004/",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"x": 640,
"y": 3580,
"wires": [
[
"2332dfb4760236d9"
]
]
},
{
"id": "7dd985ac83d33bf8",
"type": "http response",
"z": "46920228373bafd0",
"name": "",
"statusCode": "200",
"headers": {},
"x": 1180,
"y": 3620,
"wires": []
},
{
"id": "8a02f3a2bf1b70b7",
"type": "switch",
"z": "46920228373bafd0",
"name": "",
"property": "payload.methodResponse.params.param.struct.member.value.boolean",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "1",
"vt": "str"
},
{
"t": "eq",
"v": "0",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 930,
"y": 3620,
"wires": [
[
"608816e49aca93e1"
],
[
"ad3a4bebe0e10f6b"
]
]
},
{
"id": "ad3a4bebe0e10f6b",
"type": "change",
"z": "46920228373bafd0",
"name": "errore",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "ERRORE",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1050,
"y": 3640,
"wires": [
[
"7dd985ac83d33bf8"
]
]
},
{
"id": "608816e49aca93e1",
"type": "change",
"z": "46920228373bafd0",
"name": "ok",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "OK",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1050,
"y": 3600,
"wires": [
[
"7dd985ac83d33bf8"
]
]
},
{
"id": "2332dfb4760236d9",
"type": "function",
"z": "46920228373bafd0",
"name": "xml resp s/head",
"func": "const pulito = msg.payload.substr(38,msg.payload.lenght);\nmsg.payload = pulito;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 660,
"y": 3620,
"wires": [
[
"6002a8170bd453a2"
]
]
},
{
"id": "6002a8170bd453a2",
"type": "function",
"z": "46920228373bafd0",
"name": "2json",
"func": "function convertXmlToJson(xmlString) {\n const jsonData = {};\n for (const result of xmlString.matchAll(/(?:<(\\w*)(?:\\s[^>]*)*>)((?:(?!<\\1).)*)(?:<\\/\\1>)|<(\\w*)(?:\\s*)*\\/>/gm)) {\n const key = result[1] || result[3];\n const value = result[2] && convertXmlToJson(result[2]); //recusrion\n jsonData[key] = ((value && Object.keys(value).length) ? value : result[2]) || null;\n }\n return jsonData;\n}\n\nmsg.payload=convertXmlToJson(msg.payload);\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 810,
"y": 3620,
"wires": [
[
"8a02f3a2bf1b70b7"
]
]
},
{
"id": "3e2c5dcb866878a2",
"type": "comment",
"z": "46920228373bafd0",
"name": "AGGIORNAMENTO",
"info": "",
"x": 650,
"y": 3440,
"wires": []
},
{
"id": "c7ff9e304b88686a",
"type": "change",
"z": "46920228373bafd0",
"name": "sec del",
"rules": [
{
"t": "delete",
"p": "topbase",
"pt": "msg"
},
{
"t": "delete",
"p": "username",
"pt": "msg"
},
{
"t": "delete",
"p": "lastname",
"pt": "msg"
},
{
"t": "delete",
"p": "userpass",
"pt": "msg"
},
{
"t": "delete",
"p": "bottombase",
"pt": "msg"
},
{
"t": "delete",
"p": "payload.passenc",
"pt": "msg"
},
{
"t": "delete",
"p": "payload.key",
"pt": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 760,
"y": 3540,
"wires": [
[
"da9b0bc753c8e435"
]
]
},
{
"id": "aefa31de29a16132",
"type": "junction",
"z": "46920228373bafd0",
"x": 460,
"y": 3340,
"wires": [
[
"b4c936b24103a263"
]
]
}
]

0 comments on commit 171cf54

Please sign in to comment.