*vhddlZddlZddlmZddlmZddlmZddlm Z ddl m Z ddl m Z ddlmZdd lmZejeZd Zd Zd Zd efdZd egfdZdS)N) find_wp_paths) EventsAPI)config)get_myimunify_users)get_upgrade_url_link) HostingPanel)MyImunifyWPAdvice) MyImunifyIMUNIFY_PROTECTIONc|g}tjtj|}|r|dddrdSdS)Nr protectionFactiveno)r selectwhereuserin_dictsget)usernameitemresponses d/opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/myimunify/advice/advice_manager.pyget_myimunify_protection_statusrsl :D!!'' (:(:4(@(@AAGGIIHHQKOOL%88xtczKg}|d}t|}|d}|d}|d}|d}|d}|d} t|d{V} t|D]} d | } t j|d |d | d } | d | }td"id |d|d| d| dzd|dtddd|d|ddddddd|d|dd d!d }| | |S)#a imunify advice item: {"id": 123, "server_id": null, "type": "malware_found_myimun_2", "date": 123, "severity": 1, "translation_id": "1", "parameters": {}, "description": null, "link_text": null, "link": null, "dashboard": false, "popup": false, "snoozed_until": 0, "popup_title": null, "popup_description": null, "config_action": {}, "ignore": {}, "notification": false, "smartadvice": true, "smartadvice_title": "Web hosting user account is infected", "smartadvice_description": " Imunify detected live malware on the user account hosting this website: * inf1 * inf2 ", "smartadvice_user": "isuser", "smartadvice_domain": "isuser.com", "smartadvice_docroot": "/", "ts": 123, "first_generated": 123, "iaid": "agent-iaid-123", "notification_body_html": null, "notification_period_limit": 0, "notification_subject": null, "notification_user": null} -> { "created_at": "2024-10-02T01:22:11.918688+00:00", "updated_at": "2024-10-02T01:22:11.918688+00:00", "metadata": { "app": "imunify" "username": "tkcpanel", "domain": "tk-cpanel.com", "website": "/", "panel_url": "https://10.193.176.2:2083/cpsess0000000000/frontend/paper_lantern/lveversion/wpos.live.pl", }, "advice": { "id": "287718", "type": "CPCSS", "status": "review", "description": "Turn on Critical Path CSS", "is_premium": true, "module_name": "critical_css", "license_status": "NOT_REQUIRED", "subscription": { "status": "active", "upgrade_url": "https://whmcs.dev.cloudlinux.com?username=tkcpanel&domain=tk-cpanel.com&server_ip=10.193.176.2&m=cloudlinux_advantage&action=provisioning&suite=accelerate_wp_premium" }, "total_stages": 0, "completed_stages": 0, "detailed_description": "Critical Path CSS eliminates render-blocking CSS on your website and improves browser page render performance. Your website will load much faster for your visitors. Note: Applying the current advice will also enable the AccelerateWP feature." } } smartadvice_usersmartadvice_domainsmartadvice_docroot upgrade_urlsmartadvice_titlesmartadvice_descriptioniaidN/-zutf-8_rdomainwebsite panel_urlz?show_cleanup_dialog=trueidtypestatusreview descriptiondetailed_description is_premiumF module_nameimunifylicense_status NOT_REQUIREDsubscription_status total_stagesrcompleted_stages) rrpanel_user_linkrhashlibmd5encode hexdigestr ADV_TYPEappend to_advice)imunify_adviceadvices_by_docrootrprotection_statusr'infected_docrootr r.r/r#r)siter( hashed_udwadv_idim360_protection_advices r _make_advicerIs|01H7AA 0 1F%&;< /K !45K)*CD & !D"nn44X>>>>>>>>I.//GGd**[ , ,& , ,7 , , 3 3G < <  )++ '':''"3# # # X# 6# G#  )** # v # # 8# $ # "6!5# u# " # *># !2 1# $ # !# "Q## & !!"9"C"C"E"EFFFF rreturnc Kg}td{V}tdt||r~|D]{} t |d{V}nM#t $r@}tdt|t|Yd}~^d}~wwxYw||||S)NzIM360 advice list: %szz,get_advice_notifications..s8    %     r CONTROL_PANELsmart_advice_allowedzLSmart Advice events API response with notifications: %s, users to report: %scBg|]}|dv|S)r)r)rZeventusers_to_reports rr[z,get_advice_notifications..s;     99' ( (O ; ;  ; ; ;rrrr ) setrr ConfigFileraddr smart_advicesrMrNrOr) users_to_poprconfrdatarr`s @rrLrLso  133333333   O55L## &&xx)?@@ #   T " " "% 4O,........H KK 6 H  O         D   2 HH' ( ($((3G*H*H  ] Kr)loggingr:clcommon.clwpos_libr!defence360agent.api.server.eventsrdefence360agent.contractsr&defence360agent.contracts.myimunify_idrdefence360agent.utils.whmcsr+defence360agent.subsys.panels.hosting_panelr*defence360agent.myimunify.advice.dataclassr defence360agent.myimunify.modelr getLogger__name__rMr>rrIlistrWdictrLr8rrrus%------777777,,,,,,FFFFFF<<<<<<DDDDDDIHHHHH555555  8 $ $ cccL4(r