| @@ -4,10 +4,8 @@ | ||
| 4 | 4 | class WTSEC_LIBRARY_WT |
| 5 | 5 | { |
| 6 | 6 | |
| 7 | 7 | const URL = "https://api.wtotem.com/graphql"; |
| 8 | -// const URL = "https://api-1.2ke2xgwx4.wtotem.com/graphql"; | |
| 9 | -// const URL = "https://api.webtotem.kz/graphql"; | |
| 10 | 8 | |
| 11 | 9 | public static function auth($key) |
| 12 | 10 | { |
| 13 | 11 | $payload = '{"query":"mutation{ guest{ apiKeys{ auth(apiKey:\"' . $key . '\"),{ token{ value,refreshToken,expiresIn } } } } }"}'; |
| @@ -49,10 +47,9 @@ | ||
| 49 | 47 | WTSEC_LIBRARY_App::logout(); |
| 50 | 48 | } |
| 51 | 49 | } else { |
| 52 | 50 | if ($message !== false) { |
| 53 | - | |
| 54 | - WTSEC_LIBRARY_Session::setNotification("warning", $payload); | |
| 51 | + WTSEC_LIBRARY_Session::setNotification("warning", $message); | |
| 55 | 52 | } |
| 56 | 53 | } |
| 57 | 54 | } |
| 58 | 55 | return $result; |
| @@ -214,23 +211,11 @@ | ||
| 214 | 211 | $payload = '{"operationName":null,"variables":{"id":"' . $host_id . '","avLogFilter":{"event":"'.$event.'","dateRange":{"to":'.$to.',"from":'.$from.'},"order":{"direction":"DESC","field":"time"},"pagination":{"first":' . $limit . ',"cursor":' . $cursor . '}}},"query":"query ($id: ID!, $avLogFilter: AvLogFilter!) { auth { viewer { sites { one(id: $id) { id ... on Site { configs { ... on AvConfig { isActive id } } } antivirus { status log(avLogFilter: $avLogFilter) { edges { node { filePath matches event signatures time } } pageInfo { endCursor hasNextPage __typename } } lastTest { time } stats { changed deleted scaned infected } } } } } } }"}'; |
| 215 | 212 | return self::requestApi($payload, true); |
| 216 | 213 | } |
| 217 | 214 | |
| 218 | -// public static function getOptions($host_id) | |
| 219 | -// { | |
| 220 | -// $payload = '{"query":"query{\nuserHost(id:' . $host_id . '){\n id\n title\n hostname\n stack\n createdAt\n services {\n id\n name\n configs {\n id\n \tdata\n isActive\n }\n }\n }\n}"}'; | |
| 221 | -// return self::requestApi($payload, true); | |
| 222 | -// } | |
| 223 | - | |
| 224 | - public static function getConfigs($host_id) | |
| 215 | + public static function getOptions($host_id) | |
| 225 | 216 | { |
| 226 | - $payload = '{"query":"query{ auth{ viewer{ sites{ one(id:\"'.$host_id.'\"){ configs{ ... on WaConfig { id service isActive } ... on AvConfig { id service isActive } ... on DcConfig { id service isActive } ... on DecConfig { id service isActive } ... on RcConfig { id service isActive } ... on CmsConfig { id service isActive } ... on PsConfig { id service isActive } ... on WafConfig { id service isActive } } } } } } } "}'; | |
| 227 | - return self::requestApi($payload, true); | |
| 228 | - } | |
| 229 | - | |
| 230 | - public static function toggleConfigs($service_id) | |
| 231 | - { | |
| 232 | - $payload = '{"query":"mutation{ auth{ configs{ toggle(id: \"'.$service_id.'\"){ ... on WaConfig { service isActive } ... on AvConfig { service isActive } ... on DcConfig { service isActive } ... on DecConfig { service isActive } ... on RcConfig { service isActive } ... on CmsConfig { service isActive } ... on PsConfig { service isActive } ... on WafConfig { service isActive } } } } } "}'; | |
| 217 | + $payload = '{"query":"query{\nuserHost(id:' . $host_id . '){\n id\n title\n hostname\n stack\n createdAt\n services {\n id\n name\n configs {\n id\n \tdata\n isActive\n }\n }\n }\n}"}'; | |
| 233 | 218 | return self::requestApi($payload, true); |
| 234 | 219 | } |
| 235 | 220 | |
| 236 | 221 | public static function getFirewall($host_id, $limit = 20, $cursor = null, $days = 365) |