pen test
Signed-off-by: Jeff <jeff@gotenzing.com>
Showing
19 changed files
with
1036 additions
and
0 deletions
| 1 | <?php | ||
| 2 | |||
| 3 | //GPL license | ||
| 4 | |||
| 5 | include sanitize_file_name('gplLicense.php'); | ||
| 6 | |||
| 7 | /*Updating database after verifying signature failed*/ | ||
| 8 | function Beagle_WP_auto_Verify(){ | ||
| 9 | |||
| 10 | global $wpdb; | ||
| 11 | |||
| 12 | $Beagle_WP_scan_table = $wpdb->prefix."beagleScanData"; | ||
| 13 | |||
| 14 | $getTokenFromTbl = $wpdb->get_results( $wpdb->prepare ("SELECT * FROM $Beagle_WP_scan_table")); | ||
| 15 | |||
| 16 | $Beagle_WP_application_token = $getTokenFromTbl[0]->application_token; | ||
| 17 | |||
| 18 | $updateData = $wpdb->query( $wpdb->prepare("UPDATE $Beagle_WP_scan_table SET autoVerify = %d WHERE application_token = %s",1, $Beagle_WP_application_token)); | ||
| 19 | try{ | ||
| 20 | if($updateData) { | ||
| 21 | echo json_encode("succeess"); | ||
| 22 | exit; | ||
| 23 | } else { | ||
| 24 | echo json_encode("failed"); | ||
| 25 | exit; | ||
| 26 | } | ||
| 27 | } catch (Exception $e) { | ||
| 28 | console.log('Message: ' .$e->getMessage()); | ||
| 29 | } | ||
| 30 | } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
wp-content/plugins/beagle-security-wp-security-advanced-penetration-testing/Admin/bootstrap.php
0 → 100644
This diff could not be displayed because it is too large.
wp-content/plugins/beagle-security-wp-security-advanced-penetration-testing/Admin/deleteTest.php
0 → 100644
| 1 | <?php | ||
| 2 | |||
| 3 | //GPL license | ||
| 4 | |||
| 5 | include sanitize_file_name('gplLicense.php'); | ||
| 6 | |||
| 7 | /*delete the application only after the verification*/ | ||
| 8 | function Beagle_WP_delete_Test() { | ||
| 9 | |||
| 10 | global $wpdb; | ||
| 11 | global $deleteID; | ||
| 12 | $Beagle_WP_scan_table = $wpdb->prefix."beagleScanData"; | ||
| 13 | $result =$wpdb->get_results($wpdb->prepare("SELECT * FROM $Beagle_WP_scan_table ")); | ||
| 14 | foreach ( $result as $print ){ | ||
| 15 | $deleteID = $print->id; | ||
| 16 | } | ||
| 17 | try { | ||
| 18 | $updateData = $wpdb->query($wpdb->prepare("DELETE FROM $Beagle_WP_scan_table WHERE id=%d", $deleteID)); | ||
| 19 | echo json_encode($updateData); | ||
| 20 | exit; | ||
| 21 | } | ||
| 22 | catch(Exception $e) { | ||
| 23 | } | ||
| 24 | } |
wp-content/plugins/beagle-security-wp-security-advanced-penetration-testing/Admin/getResultData.php
0 → 100644
| 1 | <?php | ||
| 2 | |||
| 3 | //GPL license | ||
| 4 | |||
| 5 | include sanitize_file_name('gplLicense.php'); | ||
| 6 | |||
| 7 | /*to get status of currently running test*/ | ||
| 8 | function Beagle_WP_getResultOf_CurrentTestData() { | ||
| 9 | |||
| 10 | global $wpdb; | ||
| 11 | |||
| 12 | global $apiServerBaseUrl; | ||
| 13 | |||
| 14 | $Beagle_WP_scan_table = $wpdb->prefix."beagleScanData"; | ||
| 15 | |||
| 16 | $getTableData = $wpdb->get_results($wpdb->prepare("SELECT * FROM $Beagle_WP_scan_table")); | ||
| 17 | |||
| 18 | foreach ( $getTableData as $entryOne ){ | ||
| 19 | $Beagle_WP_access_token = $entryOne->access_token; | ||
| 20 | $Beagle_WP_application_token = $entryOne->application_token; | ||
| 21 | $BWP_result_token = $entryOne->result_token; | ||
| 22 | } | ||
| 23 | |||
| 24 | try { | ||
| 25 | |||
| 26 | if($Beagle_WP_access_token != null || $Beagle_WP_application_token != null) { | ||
| 27 | |||
| 28 | $beaglrURL = $apiServerBaseUrl.'test/result'; | ||
| 29 | |||
| 30 | $getStatusDataTest = array("access_token" => $Beagle_WP_access_token, "application_token" => $Beagle_WP_application_token, "result_token" => $BWP_result_token); | ||
| 31 | |||
| 32 | $request = wp_remote_post($beaglrURL, array( | ||
| 33 | 'headers' => array('Content-Type' => 'application/json; charset=utf-8'), | ||
| 34 | 'body' => json_encode($getStatusDataTest), | ||
| 35 | 'method' => 'POST', | ||
| 36 | 'data_format' => 'body', | ||
| 37 | )); | ||
| 38 | $statusResponse = json_decode(wp_remote_retrieve_body( $request )); | ||
| 39 | try { | ||
| 40 | if($statusResponse){ | ||
| 41 | $updateData = $wpdb->query( $wpdb->prepare("UPDATE $Beagle_WP_scan_table SET runningStatus = %s WHERE application_token = %s","notRunning", $Beagle_WP_application_token)); | ||
| 42 | } | ||
| 43 | } | ||
| 44 | catch(Exception $e) { | ||
| 45 | } | ||
| 46 | echo json_encode($statusResponse); | ||
| 47 | exit; | ||
| 48 | } | ||
| 49 | } | ||
| 50 | catch(Exception $e) { | ||
| 51 | } | ||
| 52 | } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
wp-content/plugins/beagle-security-wp-security-advanced-penetration-testing/Admin/getStatus.php
0 → 100644
| 1 | <?php | ||
| 2 | |||
| 3 | //GPL license | ||
| 4 | include sanitize_file_name('gplLicense.php'); | ||
| 5 | |||
| 6 | /*to get status of an ongoing test*/ | ||
| 7 | function Beagle_WP_getStatusOf_CurrentTestData() | ||
| 8 | { | ||
| 9 | |||
| 10 | global $wpdb; | ||
| 11 | |||
| 12 | global $apiServerBaseUrl; | ||
| 13 | |||
| 14 | $Beagle_WP_scan_table = $wpdb->prefix . "beagleScanData"; | ||
| 15 | |||
| 16 | $getTableData = $wpdb->get_results($wpdb->prepare("SELECT * FROM $Beagle_WP_scan_table")); | ||
| 17 | |||
| 18 | foreach ($getTableData as $entryOne) { | ||
| 19 | $Beagle_WP_access_token = $entryOne->access_token; | ||
| 20 | $Beagle_WP_application_token = $entryOne->application_token; | ||
| 21 | $BWP_result_token = $entryOne->result_token; | ||
| 22 | } | ||
| 23 | try { | ||
| 24 | |||
| 25 | if ($Beagle_WP_access_token != null && $Beagle_WP_application_token != null && $BWP_result_token != null) { | ||
| 26 | |||
| 27 | $beaglrURL = $apiServerBaseUrl . 'test/status'; | ||
| 28 | |||
| 29 | $getStatusDataTest = array("access_token" => $Beagle_WP_access_token, "application_token" => $Beagle_WP_application_token, "result_token" => $BWP_result_token); | ||
| 30 | |||
| 31 | $request = wp_remote_post($beaglrURL, array( | ||
| 32 | 'headers' => array('Content-Type' => 'application/json; charset=utf-8'), | ||
| 33 | 'body' => json_encode($getStatusDataTest), | ||
| 34 | 'method' => 'POST', | ||
| 35 | 'data_format' => 'body', | ||
| 36 | )); | ||
| 37 | |||
| 38 | $statusResponse = json_decode(wp_remote_retrieve_body($request)); | ||
| 39 | |||
| 40 | try { | ||
| 41 | if ($statusResponse) { | ||
| 42 | |||
| 43 | $updateData = $wpdb->query($wpdb->prepare("UPDATE $Beagle_WP_scan_table SET status = %s WHERE application_token = %s", $statusResponse->status, $Beagle_WP_application_token)); | ||
| 44 | } | ||
| 45 | |||
| 46 | echo json_encode($statusResponse); | ||
| 47 | exit; | ||
| 48 | } catch (Exception $e) { | ||
| 49 | } | ||
| 50 | } | ||
| 51 | } catch (Exception $e) { | ||
| 52 | } | ||
| 53 | } |
wp-content/plugins/beagle-security-wp-security-advanced-penetration-testing/Admin/gplLicense.php
0 → 100644
| 1 | <?php | ||
| 2 | |||
| 3 | /* | ||
| 4 | Beagle Security - WP Security, Advanced Penetration Testing, 2021 Beagle Security | ||
| 5 | This plugin is distributed under the terms of the GNU GPL | ||
| 6 | |||
| 7 | This program is free software; you can redistribute it and/or modify | ||
| 8 | it under the terms of the GNU General Public License as published by | ||
| 9 | the Free Software Foundation; either version 2 of the License, or | ||
| 10 | (at your option) any later version. | ||
| 11 | |||
| 12 | This program is distributed in the hope that it will be useful, | ||
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | GNU General Public License for more details. | ||
| 16 | |||
| 17 | You should have received a copy of the GNU General Public License | ||
| 18 | along with this program; If not, see {License URI}. | ||
| 19 | */ | ||
| 20 | ?> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | <?php | ||
| 2 | |||
| 3 | //GPL license | ||
| 4 | |||
| 5 | include sanitize_file_name('gplLicense.php'); | ||
| 6 | |||
| 7 | /*To post the signature in the wordpress root directory*/ | ||
| 8 | function Beagle_WP_addDataTo_DB() | ||
| 9 | { | ||
| 10 | global $wpdb; | ||
| 11 | |||
| 12 | global $apiServerBaseUrl; | ||
| 13 | |||
| 14 | $Beagle_WP_scan_table = $wpdb->prefix . "beagleScanData"; | ||
| 15 | |||
| 16 | $Beagle_WP_access_token = sanitize_text_field($_POST['access_token']); | ||
| 17 | |||
| 18 | $Beagle_WP_application_token = sanitize_text_field($_POST['application_token']); | ||
| 19 | |||
| 20 | try { | ||
| 21 | if (isset($_POST['startVerify'])) { | ||
| 22 | $Beagle_WP_dataInDB = $wpdb->get_results("SELECT * FROM $Beagle_WP_scan_table WHERE `application_token`='$Beagle_WP_application_token'"); | ||
| 23 | try { | ||
| 24 | if (!$Beagle_WP_dataInDB) { | ||
| 25 | |||
| 26 | $beaglrURL = $apiServerBaseUrl . 'test/signature'; | ||
| 27 | $getverifiedToken = array("access_token" => $Beagle_WP_access_token, "application_token" => $Beagle_WP_application_token); | ||
| 28 | $request = wp_remote_post($beaglrURL, array( | ||
| 29 | 'headers' => array('Content-Type' => 'application/json; charset=utf-8'), | ||
| 30 | 'body' => json_encode($getverifiedToken), | ||
| 31 | 'method' => 'POST', | ||
| 32 | 'data_format' => 'body', | ||
| 33 | )); | ||
| 34 | $statusResponse = json_decode(wp_remote_retrieve_body($request)); | ||
| 35 | try { | ||
| 36 | $dateLog = date("Y-m-d"); | ||
| 37 | if ($statusResponse->status == "Failed") { | ||
| 38 | try { | ||
| 39 | $Beagle_WP_log_save_path = plugin_dir_path(__FILE__) . '../log.txt'; | ||
| 40 | if (is_writable($Beagle_WP_log_save_path)) { | ||
| 41 | $Beagle_WP_log_open = fopen($Beagle_WP_log_save_path, "a"); | ||
| 42 | $Beagle_WP_log_write = fputs($Beagle_WP_log_open, "\n" .$dateLog. " -> " .$statusResponse->message. + "\n"); | ||
| 43 | fclose($Beagle_WP_log_open); | ||
| 44 | } | ||
| 45 | } catch (Exception $e) { | ||
| 46 | } | ||
| 47 | ?> | ||
| 48 | <script> | ||
| 49 | function appExist() { | ||
| 50 | var errorMsg = setTimeout("document.getElementById('errMsg').style.display='none';", 4000); | ||
| 51 | } | ||
| 52 | appExist() | ||
| 53 | </script> | ||
| 54 | <div class="errormsg"> | ||
| 55 | <p id="errMsg">Invalid credentials. Please try again!</p> | ||
| 56 | </div> | ||
| 57 | <?php | ||
| 58 | } else if($statusResponse == null) { | ||
| 59 | try { | ||
| 60 | $Beagle_WP_log_save_path = plugin_dir_path(__FILE__) . '../log.txt'; | ||
| 61 | if (is_writable($Beagle_WP_log_save_path)) { | ||
| 62 | $Beagle_WP_log_open = fopen($Beagle_WP_log_save_path, "a"); | ||
| 63 | $Beagle_WP_log_write = fputs($Beagle_WP_log_open, "\n" .$dateLog. "-> User not authorized. \n"); | ||
| 64 | fclose($Beagle_WP_log_open); | ||
| 65 | } | ||
| 66 | } catch (Exception $e) { | ||
| 67 | } | ||
| 68 | ?> | ||
| 69 | <script> | ||
| 70 | function appExist() { | ||
| 71 | var errorMsg = setTimeout("document.getElementById('errMsg').style.display='none';", 4000); | ||
| 72 | } | ||
| 73 | appExist() | ||
| 74 | </script> | ||
| 75 | <div class="errormsg"> | ||
| 76 | <p id="errMsg">User not authorized!</p> | ||
| 77 | </div> | ||
| 78 | <?php | ||
| 79 | } | ||
| 80 | else if ($statusResponse->status == "NotVerified") { | ||
| 81 | $verifyText = $statusResponse->signature; | ||
| 82 | try { | ||
| 83 | $Beagle_WP_file_save_path = plugin_dir_path(__FILE__) . '../' . $verifyText . '.txt'; | ||
| 84 | $Beagle_WP_file_save_path_test = plugin_dir_path(__FILE__) . '../fileWrightTest.txt'; | ||
| 85 | if (is_writable($Beagle_WP_file_save_path_test)) { | ||
| 86 | $Beagle_WP_file_open = fopen($Beagle_WP_file_save_path, "a"); | ||
| 87 | $Beagle_WP_file_write = fputs($Beagle_WP_file_open, $verifyText); | ||
| 88 | fclose($Beagle_WP_file_open); | ||
| 89 | if ($Beagle_WP_file_write) { | ||
| 90 | $wpdb->insert($Beagle_WP_scan_table, array("access_token" => $Beagle_WP_access_token, "application_token" => $Beagle_WP_application_token, "verified" => 0, "title" => $statusResponse->title, "url" => $statusResponse->url, "runningStatus" => "notRunning", "autoVerify" => "0"), array("%s", "%s", "%d", "%s", "%s", "%s", "%d")); | ||
| 91 | } else { | ||
| 92 | ?> | ||
| 93 | <script> | ||
| 94 | function appExist() { | ||
| 95 | var errorMsg = setTimeout("document.getElementById('errMsg').style.display='none';", 4000); | ||
| 96 | } | ||
| 97 | appExist() | ||
| 98 | </script> | ||
| 99 | <div class="errormsg"> | ||
| 100 | <p id="errMsg">An unexpected error occurred. Please try again!</p> | ||
| 101 | </div> | ||
| 102 | <?php | ||
| 103 | } | ||
| 104 | }else { | ||
| 105 | $wpdb->insert($Beagle_WP_scan_table, array("access_token" => $Beagle_WP_access_token, "application_token" => $Beagle_WP_application_token, "verified" => 0, "title" => $statusResponse->title, "url" => $statusResponse->url, "runningStatus" => "notRunning", "autoVerify" => "1"), array("%s", "%s", "%d", "%s", "%s", "%s", "%d")); | ||
| 106 | } | ||
| 107 | } catch (Exception $e) { | ||
| 108 | } | ||
| 109 | } else { | ||
| 110 | $wpdb->insert($Beagle_WP_scan_table, array("access_token" => $Beagle_WP_access_token, "application_token" => $Beagle_WP_application_token, "verified" => 1, "title" => $statusResponse->title, "url" => $statusResponse->url, "runningStatus" => "notRunning", "autoVerify" => "0"), array("%s", "%s", "%d", "%s", "%s", "%s", "%d")); | ||
| 111 | } | ||
| 112 | } catch (Exception $e) { | ||
| 113 | } | ||
| 114 | } | ||
| 115 | } catch (Exception $e) { | ||
| 116 | } | ||
| 117 | } | ||
| 118 | } catch (Exception $e) { | ||
| 119 | } | ||
| 120 | } |
This diff is collapsed.
Click to expand it.
wp-content/plugins/beagle-security-wp-security-advanced-penetration-testing/Admin/progressRound.php
0 → 100644
This diff is collapsed.
Click to expand it.
wp-content/plugins/beagle-security-wp-security-advanced-penetration-testing/Admin/script.php
0 → 100644
| 1 | <script> | ||
| 2 | // for first loader button | ||
| 3 | function BeagleWP_Token_Input() { | ||
| 4 | var access_token = document.getElementById("access_token").value; | ||
| 5 | var application_token = document.getElementById("application_token").value; | ||
| 6 | if (access_token.length == 32 && application_token.length == 32) { | ||
| 7 | document.getElementById("continueSave").style.display = "none"; | ||
| 8 | document.getElementById("spinnerSave").style.display = "block"; | ||
| 9 | } | ||
| 10 | } | ||
| 11 | // for delete application | ||
| 12 | function BeagleWP_delete_Confirm() { | ||
| 13 | Swal.fire({ | ||
| 14 | text: 'Are you sure you want to delete this application?', | ||
| 15 | icon: 'warning', | ||
| 16 | icon: 'warning', | ||
| 17 | showCancelButton: true, | ||
| 18 | confirmButtonColor: '#d33', | ||
| 19 | confirmButtonText: 'Delete' | ||
| 20 | }).then((result) => { | ||
| 21 | if (result.isConfirmed) { | ||
| 22 | // ajax call | ||
| 23 | var data = { | ||
| 24 | 'action': 't4a_ajax_call_delete' | ||
| 25 | }; | ||
| 26 | jQuery.post(ajaxurl, data, function(response) { | ||
| 27 | // analyse response | ||
| 28 | try { | ||
| 29 | var deleteDataResponse = JSON.parse(response); | ||
| 30 | if (deleteDataResponse == true || deleteDataResponse == 1 || deleteDataResponse != null) { | ||
| 31 | Swal.fire( | ||
| 32 | 'Application deleted!', | ||
| 33 | '', | ||
| 34 | 'success' | ||
| 35 | ); | ||
| 36 | location.reload(); | ||
| 37 | } else { | ||
| 38 | Swal.fire({ | ||
| 39 | icon: 'error', | ||
| 40 | title: 'Delete failed!', | ||
| 41 | text: 'Something went wrong!', | ||
| 42 | }); | ||
| 43 | } | ||
| 44 | } catch (err) { | ||
| 45 | console.log(err); | ||
| 46 | } | ||
| 47 | }) | ||
| 48 | } | ||
| 49 | }); | ||
| 50 | } | ||
| 51 | |||
| 52 | // for verify domain | ||
| 53 | function BeagleWP_verifyDomain_ByUser() { | ||
| 54 | |||
| 55 | document.getElementById("verifyDomain").style.display = "none"; | ||
| 56 | document.getElementById("verifyDomainHide").style.display = "block"; | ||
| 57 | var data = { | ||
| 58 | 'action': 't4a_ajax_call_verify' | ||
| 59 | }; | ||
| 60 | jQuery.post(ajaxurl, data, function(response) { | ||
| 61 | try { | ||
| 62 | var verifyResponse = JSON.parse(response); | ||
| 63 | if (verifyResponse.status != "Failed") { | ||
| 64 | var data = { | ||
| 65 | 'action': 't4a_ajax_call_verify_update' | ||
| 66 | }; | ||
| 67 | jQuery.post(ajaxurl, data, function(response) { | ||
| 68 | location.reload(); | ||
| 69 | }); | ||
| 70 | } else { | ||
| 71 | var data = { | ||
| 72 | 'action': 't4a_ajax_call_verify_update_failed' | ||
| 73 | }; | ||
| 74 | jQuery.post(ajaxurl, data, function(response) {}); | ||
| 75 | document.getElementById("verifyDomainHide").style.display = "none"; | ||
| 76 | document.getElementById("verifyError").style.display = "block"; | ||
| 77 | } | ||
| 78 | } catch (err) { | ||
| 79 | } | ||
| 80 | }); | ||
| 81 | } | ||
| 82 | |||
| 83 | // for automatic domain verify fail info | ||
| 84 | function BeagleWP_show_Msg() { | ||
| 85 | Swal.fire({ | ||
| 86 | title: '', | ||
| 87 | text: "Domain verification failed. Try the other verification methods available by logging in to your Beagle Security account.", | ||
| 88 | icon: 'info', | ||
| 89 | showCancelButton: true, | ||
| 90 | confirmButtonColor: '#3085d6', | ||
| 91 | confirmButtonText: 'LOG IN' | ||
| 92 | }).then((result) => { | ||
| 93 | if (result.isConfirmed) { | ||
| 94 | window.open("https://beaglesecurity.com/login", '_blank'); | ||
| 95 | } | ||
| 96 | }) | ||
| 97 | } | ||
| 98 | |||
| 99 | // for status | ||
| 100 | function BeagleWP_get_Data() { | ||
| 101 | try { | ||
| 102 | document.getElementById("statusGet").style.display = "none"; | ||
| 103 | document.getElementById("spinner").style.display = "block"; | ||
| 104 | // ajax call | ||
| 105 | var data = { | ||
| 106 | 'action': 't4a_ajax_call' | ||
| 107 | }; | ||
| 108 | jQuery.post(ajaxurl, data, function(response) { | ||
| 109 | // analyse response | ||
| 110 | try { | ||
| 111 | var dataresponse = JSON.parse(response); | ||
| 112 | if (dataresponse.status != null || dataresponse.status != 'undefined') { | ||
| 113 | var width = dataresponse.progress; | ||
| 114 | var status = dataresponse.status; | ||
| 115 | document.getElementById("progress").style.width = width + "%"; | ||
| 116 | document.getElementById("progress").innerText = width + "%"; | ||
| 117 | document.getElementById("status").innerText = dataresponse.status + " : "; | ||
| 118 | document.getElementById("message").innerText = dataresponse.message; | ||
| 119 | document.getElementById("statusGet").style.display = "block"; | ||
| 120 | document.getElementById("spinner").style.display = "none"; | ||
| 121 | if (status == 'completed') { | ||
| 122 | document.getElementById("statusbar").style.display = "none"; | ||
| 123 | location.reload(); | ||
| 124 | BeagleWP_get_Result(); | ||
| 125 | } else { | ||
| 126 | document.getElementById("resultData").style.display = "none"; | ||
| 127 | } | ||
| 128 | } else { | ||
| 129 | console.log("Error occures!."); | ||
| 130 | } | ||
| 131 | } catch (err) { | ||
| 132 | } | ||
| 133 | }); | ||
| 134 | } catch (err) { | ||
| 135 | } | ||
| 136 | } | ||
| 137 | |||
| 138 | // for get result | ||
| 139 | function BeagleWP_get_Result() { | ||
| 140 | try { | ||
| 141 | document.getElementById("statusbar").style.display = "none"; | ||
| 142 | } catch (err) { | ||
| 143 | } | ||
| 144 | document.getElementById("resultData").style.display = "flex"; | ||
| 145 | var data = { | ||
| 146 | 'action': 't4a_ajax_call_result' | ||
| 147 | }; | ||
| 148 | jQuery.post(ajaxurl, data, function(response) { | ||
| 149 | try { | ||
| 150 | var data = { | ||
| 151 | 'action': 't4a_ajax_call_result' | ||
| 152 | }; | ||
| 153 | jQuery.post(ajaxurl, data, function(response) { | ||
| 154 | var dataresponse = JSON.parse(response); | ||
| 155 | var dataResult = JSON.parse(dataresponse.result); | ||
| 156 | if(dataResult!=null) { | ||
| 157 | var totalBug = dataResult.vulnerability_summary.critical + dataResult.vulnerability_summary.high + dataResult.vulnerability_summary.medium + dataResult.vulnerability_summary.low + dataResult.vulnerability_summary.very_low; | ||
| 158 | var score = dataResult.score; | ||
| 159 | if(score <= 2){ | ||
| 160 | document.getElementById("progressClass").classList.add('p' + dataResult.score + '0'); | ||
| 161 | document.getElementById("progressClass").classList.add('criticalBug'); | ||
| 162 | } else if(score <= 4){ | ||
| 163 | document.getElementById("progressClass").classList.add('p' + dataResult.score + '0'); | ||
| 164 | document.getElementById("progressClass").classList.add('highBug'); | ||
| 165 | } else if(score <= 6){ | ||
| 166 | document.getElementById("progressClass").classList.add('p' + dataResult.score + '0'); | ||
| 167 | document.getElementById("progressClass").classList.add('mediumBug'); | ||
| 168 | } else if(score <= 8){ | ||
| 169 | document.getElementById("progressClass").classList.add('p' + dataResult.score + '0'); | ||
| 170 | document.getElementById("progressClass").classList.add('lowBug'); | ||
| 171 | } else if(score <= 10){ | ||
| 172 | document.getElementById("progressClass").classList.add('p' + dataResult.score + '0'); | ||
| 173 | document.getElementById("progressClass").classList.add('verylowBug'); | ||
| 174 | } | ||
| 175 | document.getElementById("progressCount").innerText = dataResult.score; | ||
| 176 | document.getElementById("criticalBug").innerText = dataResult.vulnerability_summary.critical; | ||
| 177 | document.getElementById("highBug").innerText = dataResult.vulnerability_summary.high; | ||
| 178 | document.getElementById("mediumBug").innerText = dataResult.vulnerability_summary.medium; | ||
| 179 | document.getElementById("lowBug").innerText = dataResult.vulnerability_summary.low; | ||
| 180 | document.getElementById("verylowBug").innerText = dataResult.vulnerability_summary.very_low; | ||
| 181 | document.getElementById("totalBug").innerText = totalBug; | ||
| 182 | document.getElementById("genDate").innerText = " " + dataResult.generated_date; | ||
| 183 | } | ||
| 184 | }); | ||
| 185 | } catch (err) { | ||
| 186 | } | ||
| 187 | }); | ||
| 188 | } | ||
| 189 | </script> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
wp-content/plugins/beagle-security-wp-security-advanced-penetration-testing/Admin/startTest.php
0 → 100644
| 1 | <?php | ||
| 2 | |||
| 3 | //GPL license | ||
| 4 | include sanitize_file_name('gplLicense.php'); | ||
| 5 | |||
| 6 | /*To start the test after verifying the application*/ | ||
| 7 | function Beagle_WP_start_Test() { | ||
| 8 | |||
| 9 | global $wpdb; | ||
| 10 | |||
| 11 | global $apiServerBaseUrl; | ||
| 12 | |||
| 13 | $Beagle_WP_scan_table = $wpdb->prefix."beagleScanData"; | ||
| 14 | |||
| 15 | $getTokenFromTbl = $wpdb->get_results($wpdb->prepare("SELECT * FROM $Beagle_WP_scan_table")); | ||
| 16 | |||
| 17 | foreach ( $getTokenFromTbl as $print ){ | ||
| 18 | $Beagle_WP_access_token = $print->access_token; | ||
| 19 | $Beagle_WP_application_token = $print->application_token; | ||
| 20 | } | ||
| 21 | |||
| 22 | $beaglrURL = $apiServerBaseUrl.'test/start'; | ||
| 23 | |||
| 24 | $scanStartData = array("access_token" => $Beagle_WP_access_token, "application_token" => $Beagle_WP_application_token); | ||
| 25 | |||
| 26 | $startRequest = wp_remote_post($beaglrURL, array( | ||
| 27 | 'headers' => array('Content-Type' => 'application/json; charset=utf-8'), | ||
| 28 | 'body' => json_encode($scanStartData), | ||
| 29 | 'method' => 'POST', | ||
| 30 | 'data_format' => 'body', | ||
| 31 | )); | ||
| 32 | |||
| 33 | $startMsgResponse = json_decode(wp_remote_retrieve_body( $startRequest )); | ||
| 34 | try { | ||
| 35 | if( $startMsgResponse ) { | ||
| 36 | |||
| 37 | try { | ||
| 38 | if ($startMsgResponse->status == 'Failed') { | ||
| 39 | |||
| 40 | $updateData = $wpdb->query($wpdb->prepare("UPDATE $Beagle_WP_scan_table SET status = %s WHERE application_token = %s",$startMsgResponse->status, $Beagle_WP_application_token)); | ||
| 41 | |||
| 42 | ?> | ||
| 43 | <script> | ||
| 44 | function app_Exist(){ | ||
| 45 | var errorMsg=setTimeout("document.getElementById('errMsg').style.display='none';",4000); | ||
| 46 | } | ||
| 47 | app_Exist() | ||
| 48 | </script> | ||
| 49 | <div class="errormsg"> | ||
| 50 | <p id="errMsg"><?php echo $startMsgResponse->message;?></p> | ||
| 51 | </div> | ||
| 52 | <?php | ||
| 53 | }else { | ||
| 54 | |||
| 55 | $resultToken = $startMsgResponse->result_token; | ||
| 56 | |||
| 57 | $updateData = $wpdb->query( $wpdb->prepare("UPDATE $Beagle_WP_scan_table SET status = %s , result_token = %s, runningStatus = %s WHERE application_token = %s",$startMsgResponse->status, $startMsgResponse->result_token, "Running", $Beagle_WP_application_token)); | ||
| 58 | ?> | ||
| 59 | <script> | ||
| 60 | function app_Exist(){ | ||
| 61 | var errorMsg=setTimeout("document.getElementById('errMsg').style.display='none';",4000); | ||
| 62 | } | ||
| 63 | app_Exist() | ||
| 64 | </script> | ||
| 65 | <div class="message"> | ||
| 66 | <p id="errMsg">Test started successfully.</p> | ||
| 67 | </div> | ||
| 68 | <?php | ||
| 69 | |||
| 70 | } | ||
| 71 | } | ||
| 72 | catch(Exception $e) { | ||
| 73 | } | ||
| 74 | } | ||
| 75 | else { | ||
| 76 | |||
| 77 | ?> | ||
| 78 | <script> | ||
| 79 | function app_Exist(){ | ||
| 80 | var errorMsg=setTimeout("document.getElementById('errMsg').style.display='none';",4000); | ||
| 81 | } | ||
| 82 | app_Exist() | ||
| 83 | </script> | ||
| 84 | <div class="errormsg"> | ||
| 85 | <p id="errMsg">Test start failed!</p> | ||
| 86 | </div> | ||
| 87 | <?php | ||
| 88 | } | ||
| 89 | }catch(Exception $e) { | ||
| 90 | } | ||
| 91 | } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
wp-content/plugins/beagle-security-wp-security-advanced-penetration-testing/Admin/stopTest.php
0 → 100644
| 1 | <?php | ||
| 2 | |||
| 3 | //GPL license | ||
| 4 | include sanitize_file_name('gplLicense.php'); | ||
| 5 | |||
| 6 | /*to stop the ongoing test*/ | ||
| 7 | function Beagle_WP_stop_Test() { | ||
| 8 | |||
| 9 | global $wpdb; | ||
| 10 | |||
| 11 | global $apiServerBaseUrl; | ||
| 12 | |||
| 13 | $Beagle_WP_scan_table = $wpdb->prefix."beagleScanData"; | ||
| 14 | |||
| 15 | $getTokenFromTbl = $wpdb->get_results($wpdb->prepare("SELECT * FROM $Beagle_WP_scan_table")); | ||
| 16 | |||
| 17 | foreach ( $getTokenFromTbl as $print ){ | ||
| 18 | $Beagle_WP_access_token = $print->access_token; | ||
| 19 | $Beagle_WP_application_token = $print->application_token; | ||
| 20 | } | ||
| 21 | try { | ||
| 22 | |||
| 23 | if($Beagle_WP_access_token != null || $Beagle_WP_application_token != null) { | ||
| 24 | |||
| 25 | try { | ||
| 26 | |||
| 27 | if(isset($_POST['stopBeagleTest']) || isset($_POST['restartBeagleTest'])){ | ||
| 28 | $_POST = array(); | ||
| 29 | $beaglrURL = $apiServerBaseUrl.'test/stop'; | ||
| 30 | |||
| 31 | $scanStopData = array("access_token" => $Beagle_WP_access_token, "application_token" => $Beagle_WP_application_token); | ||
| 32 | $request = wp_remote_post($beaglrURL, array( | ||
| 33 | 'headers' => array('Content-Type' => 'application/json; charset=utf-8'), | ||
| 34 | 'body' => json_encode($scanStopData), | ||
| 35 | 'method' => 'POST', | ||
| 36 | 'data_format' => 'body', | ||
| 37 | )); | ||
| 38 | |||
| 39 | $stopResponse = json_decode(wp_remote_retrieve_body( $request )); | ||
| 40 | |||
| 41 | try { | ||
| 42 | |||
| 43 | if( $stopResponse->status == "Failed" ) { | ||
| 44 | |||
| 45 | $updateData = $wpdb->query($wpdb->prepare("UPDATE $Beagle_WP_scan_table SET status = %s WHERE application_token = %s",$stopResponse->status, $Beagle_WP_application_token)); | ||
| 46 | |||
| 47 | ?> | ||
| 48 | <script> | ||
| 49 | function app_Exist(){ | ||
| 50 | var errorMsg=setTimeout("document.getElementById('errMsg').style.display='none';",4000); | ||
| 51 | } | ||
| 52 | app_Exist() | ||
| 53 | </script> | ||
| 54 | <div class="errormsg"> | ||
| 55 | <p id="errMsg">Test stop failed!</p> | ||
| 56 | </div> | ||
| 57 | <?php | ||
| 58 | } else { | ||
| 59 | $updateData = $wpdb->query( $wpdb->prepare("UPDATE $Beagle_WP_scan_table SET status = %s, runningStatus = %s WHERE application_token = %s",$stopResponse->status, "notRunning" , $Beagle_WP_application_token)); | ||
| 60 | ?> | ||
| 61 | <script> | ||
| 62 | function app_Exist(){ | ||
| 63 | var errorMsg=setTimeout("document.getElementById('errMsg').style.display='none';",4000); | ||
| 64 | } | ||
| 65 | app_Exist() | ||
| 66 | </script> | ||
| 67 | <div class="message"> | ||
| 68 | <p id="errMsg">Test stopped successfully</p> | ||
| 69 | </div> | ||
| 70 | <?php | ||
| 71 | } | ||
| 72 | }catch (Exception $e) { | ||
| 73 | } | ||
| 74 | } | ||
| 75 | }catch (Exception $e) { | ||
| 76 | } | ||
| 77 | |||
| 78 | }else { | ||
| 79 | ?> | ||
| 80 | <script> | ||
| 81 | function app_Exist(){ | ||
| 82 | var errorMsg=setTimeout("document.getElementById('errMsg').style.display='none';",4000); | ||
| 83 | } | ||
| 84 | app_Exist() | ||
| 85 | </script> | ||
| 86 | <div class="errormsg"> | ||
| 87 | <p id="errMsg">Error!</p> | ||
| 88 | </div> | ||
| 89 | <?php | ||
| 90 | } | ||
| 91 | |||
| 92 | } | ||
| 93 | catch (Exception $e) { | ||
| 94 | } | ||
| 95 | } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
wp-content/plugins/beagle-security-wp-security-advanced-penetration-testing/Admin/style.php
0 → 100644
This diff is collapsed.
Click to expand it.
wp-content/plugins/beagle-security-wp-security-advanced-penetration-testing/Admin/updateVerify.php
0 → 100644
| 1 | <?php | ||
| 2 | |||
| 3 | //GPL license | ||
| 4 | include sanitize_file_name('gplLicense.php'); | ||
| 5 | |||
| 6 | /*Updating database after verifying signature*/ | ||
| 7 | function Beagle_WP_verify_Token_Update(){ | ||
| 8 | |||
| 9 | global $wpdb; | ||
| 10 | |||
| 11 | $Beagle_WP_scan_table = $wpdb->prefix."beagleScanData"; | ||
| 12 | |||
| 13 | $getTokenFromTbl = $wpdb->get_results($wpdb->prepare("SELECT * FROM $Beagle_WP_scan_table")); | ||
| 14 | |||
| 15 | $Beagle_WP_application_token = $getTokenFromTbl[0]->application_token; | ||
| 16 | |||
| 17 | $updateData = $wpdb->query( $wpdb->prepare("UPDATE $Beagle_WP_scan_table SET verified = %d WHERE application_token = %s",1, $Beagle_WP_application_token)); | ||
| 18 | try{ | ||
| 19 | if($updateData) { | ||
| 20 | echo json_encode("succeess"); | ||
| 21 | exit; | ||
| 22 | } else { | ||
| 23 | echo json_encode("failed"); | ||
| 24 | exit; | ||
| 25 | } | ||
| 26 | } catch (Exception $e) { | ||
| 27 | } | ||
| 28 | } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
wp-content/plugins/beagle-security-wp-security-advanced-penetration-testing/Admin/verifyToken.php
0 → 100644
| 1 | <?php | ||
| 2 | |||
| 3 | //GPL license | ||
| 4 | |||
| 5 | include sanitize_file_name('gplLicense.php'); | ||
| 6 | |||
| 7 | /*to verify the signature token*/ | ||
| 8 | function Beagle_WP_verify_Token() | ||
| 9 | { | ||
| 10 | |||
| 11 | global $wpdb; | ||
| 12 | |||
| 13 | global $apiServerBaseUrl; | ||
| 14 | |||
| 15 | $Beagle_WP_scan_table = $wpdb->prefix . "beagleScanData"; | ||
| 16 | |||
| 17 | $getTokenFromTbl = $wpdb->get_results($wpdb->prepare("SELECT * FROM $Beagle_WP_scan_table")); | ||
| 18 | |||
| 19 | foreach ($getTokenFromTbl as $print) { | ||
| 20 | $Beagle_WP_access_token = $print->access_token; | ||
| 21 | $Beagle_WP_application_token = $print->application_token; | ||
| 22 | } | ||
| 23 | |||
| 24 | $beagleVerifyURL = $apiServerBaseUrl . 'test/signature/verify'; | ||
| 25 | |||
| 26 | $verifySignature = array("access_token" => $Beagle_WP_access_token, "application_token" => $Beagle_WP_application_token, "type" => "WORDPRESS"); | ||
| 27 | |||
| 28 | $verifyResponse = wp_remote_post($beagleVerifyURL, array( | ||
| 29 | 'headers' => array('Content-Type' => 'application/json; charset=utf-8'), | ||
| 30 | 'body' => json_encode($verifySignature), | ||
| 31 | 'method' => 'POST', | ||
| 32 | 'data_format' => 'body', | ||
| 33 | )); | ||
| 34 | |||
| 35 | $statusResponse = json_decode(wp_remote_retrieve_body($verifyResponse)); | ||
| 36 | try { | ||
| 37 | echo json_encode($statusResponse); | ||
| 38 | exit; | ||
| 39 | } catch (Exception $e) { | ||
| 40 | } | ||
| 41 | } |
wp-content/plugins/beagle-security-wp-security-advanced-penetration-testing/fileWrightTest.txt
0 → 100644
| 1 | This is a status check file. | ||
| 2 | |||
| 3 | ██████ ███████ █████ ██████ ██ ███████ ██ ██ ████████ | ||
| 4 | ██ ██ ██ ██ ██ ██ ██ ██ █ ██ ██ ██ ██ | ||
| 5 | ██████ █████ ███████ ██ ███ ██ █████ ██ ██ ██ ████████ | ||
| 6 | ██ ██ ██ ██ ██ ██ ██ ██ ██ █ ██ █ █ ██ ██ | ||
| 7 | ██████ ███████ ██ ██ ██████ ███████ ███████ ███ ███ ██ | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | This is a log file. | ||
| 2 | ========================================================================= | ||
| 3 | |||
| 4 | ██████ ███████ █████ ██████ ██ ███████ ██ ██ ████████ | ||
| 5 | ██ ██ ██ ██ ██ ██ ██ ██ █ ██ ██ ██ ██ | ||
| 6 | ██████ █████ ███████ ██ ███ ██ █████ ██ ██ ██ ████████ | ||
| 7 | ██ ██ ██ ██ ██ ██ ██ ██ ██ █ ██ █ █ ██ ██ | ||
| 8 | ██████ ███████ ██ ██ ██████ ███████ ███████ ███ ███ ██ | ||
| 9 | |||
| 10 | ========================================================================= |
| 1 | === Beagle Security - WP Security, Advanced Penetration Testing === | ||
| 2 | Contributors: Jishu Vijayan C K, Dileep Achuthan, Nayana EN | ||
| 3 | Tags: security, security plugin, website security, wordpress security, security testing | ||
| 4 | Donate link: https://beaglesecurity.com/ | ||
| 5 | Requires at least: 5.2 | ||
| 6 | Tested up to: 6.0 | ||
| 7 | Requires PHP: 7.2 | ||
| 8 | Stable tag: 1.0.7 | ||
| 9 | License: GPLv2 | ||
| 10 | License URI: https://www.gnu.org/licenses/gpl-2.0.html | ||
| 11 | |||
| 12 | |||
| 13 | |||
| 14 | == Description == | ||
| 15 | |||
| 16 | ##### SECURE YOUR WEBSITE FROM THE LATEST VULNERABILITIES WITH THE EASY TO USE WEBSITE PENETRATION TESTING TOOL | ||
| 17 | |||
| 18 | **[Beagle Security](https://beaglesecurity.com/ "Beagle Security")** is a web application penetration testing tool that helps you to identify vulnerabilities on your WordPress website before hackers exploit them. | ||
| 19 | |||
| 20 | 35% of the web is built on WordPress and it's a favorite target for hackers. Vulnerabilities in the WordPress core, plugins, and themes can all leave your website prone to a cyber attack leading to loss of critical data and financial losses. | ||
| 21 | |||
| 22 | That is why you need to proactively tackle WordPress website security and make sure you’re secure from common WordPress security vulnerabilities like cross-site scripting (XSS), SQL injection, file inclusion exploits, directory traversal, and many more. | ||
| 23 | |||
| 24 | With Beagle Security, you can find complex attack vectors WordPress vulnerability scanners fail to detect. Vulnerability scanners give you quick scan results, but they are not designed to identify modern security threats. | ||
| 25 | |||
| 26 | By leveraging an AI-powered core, Beagle Security does in-depth penetration tests on your website and discovers all the loopholes in it. With evidence-based vulnerability reporting, you get insights into the occurrence of each vulnerability on your website and actionable recommendations on how to fix the discovered security issues and secure your website. | ||
| 27 | |||
| 28 | ### Beagle Security’s free plugin helps you to: | ||
| 29 | |||
| 30 | * Connect securely to your Beagle Security account | ||
| 31 | * Complete domain verification with just a button’s click | ||
| 32 | * Start/stop tests from your WP admin console | ||
| 33 | * See the progress of running tests | ||
| 34 | * View test results with total vulnerabilities in your website | ||
| 35 | * Understand the classification of vulnerabilities according to the severity | ||
| 36 | * Know the security score of your website | ||
| 37 | |||
| 38 | ### WHY CHOOSE BEAGLE SECURITY | ||
| 39 | |||
| 40 | * Compliant with global security standards like OWASP and SANS | ||
| 41 | * Set up in less than 5 minutes- no coding required | ||
| 42 | * Constantly updated vulnerability database with latest threats and zero-day vulnerabilities | ||
| 43 | * AI-powered core for human-like decision making | ||
| 44 | * Lowest false positives | ||
| 45 | * Authenticated testing for complex websites with login module | ||
| 46 | * Ensure security compliance with continuous vulnerability assessments | ||
| 47 | |||
| 48 | ### GETTING STARTED | ||
| 49 | |||
| 50 | You’ll need to have an account on Beagle Security to use this plugin. You can sign up [here](https://beaglesecurity.com/signup "Beagle Security Signup"). Installing the plugin is easy and all you need is to add the access token and application token from your Beagle Security account to finish the setup. | ||
| 51 | |||
| 52 | == Installation == | ||
| 53 | * Step 1: Search Beagle Security - WP Security, Advanced Penetration Testing in the plugin search bar. | ||
| 54 | * Step 2: Click **Install** to add the plugin to your WordPress website. | ||
| 55 | * Step 3: Go to the Plugins page and activate Beagle Security - WP Security, Advanced Penetration Testing plugin. | ||
| 56 | * Step 4: Provide access token and application token to start the security test. | ||
| 57 | |||
| 58 | == Frequently Asked Questions == | ||
| 59 | For support related articles, kindly visit the **[Help Center](https://help.beaglesecurity.com/category/1/general "Beagle Security Help Center")**. | ||
| 60 | |||
| 61 | == Screenshots == | ||
| 62 | 1. Connect easily by setting up an access token and application token | ||
| 63 | 2. One-click domain verification | ||
| 64 | 3. Start tests from your WP admin console | ||
| 65 | 4. See the progress of running tests | ||
| 66 | 5. Know the security score of your website, view test results and classification of vulnerabilities according to the severity | ||
| 67 | |||
| 68 | == Changelog == | ||
| 69 | Version 1.0.3 | ||
| 70 | *API update. | ||
| 71 | Version 1.0.4 | ||
| 72 | *Bug Fixes | ||
| 73 | Version 1.0.5 | ||
| 74 | *Bug Fixes | ||
| 75 | Version 1.0.6 | ||
| 76 | *Bug Fixes | ||
| 77 | |||
| 78 | == Upgrade Notice == | ||
| 79 | Version 1.0.7 | ||
| 80 |
wp-content/plugins/beagle-security-wp-security-advanced-penetration-testing/wp-beagleSettings.php
0 → 100644
| 1 | <?php | ||
| 2 | |||
| 3 | /** | ||
| 4 | * @link https://beaglesecurity.com/ | ||
| 5 | * @since 1.0.7 | ||
| 6 | * @package Beagle Security | ||
| 7 | * | ||
| 8 | * @wordpress-plugin | ||
| 9 | * Plugin Name: Beagle Security - WP Security, Advanced Penetration Testing | ||
| 10 | * Plugin URI: https://beaglesecurity.com/wordpress-security-testing | ||
| 11 | * Description: Secure your WordPress website from the latest vulnerabilities with automated in-depth penetration testing. | ||
| 12 | * Version: 1.0.7 | ||
| 13 | * Requires at least: 5.2 | ||
| 14 | * Requires PHP: 7.2 | ||
| 15 | * Author: Beagle Security | ||
| 16 | * Author URI: https://beaglesecurity.com/ | ||
| 17 | * License: GPL v2 | ||
| 18 | * License URI: https://www.gnu.org/licenses/gpl-2.0.html | ||
| 19 | * Text Domain: Beagle wordpress scan | ||
| 20 | * Domain Path: /languages | ||
| 21 | */ | ||
| 22 | |||
| 23 | /* | ||
| 24 | Beagle Security - WP Security, Advanced Penetration Testing, 2021 Beagle Security | ||
| 25 | This plugin is distributed under the terms of the GNU GPL | ||
| 26 | |||
| 27 | This program is free software; you can redistribute it and/or modify | ||
| 28 | it under the terms of the GNU General Public License as published by | ||
| 29 | the Free Software Foundation; either version 2 of the License, or | ||
| 30 | (at your option) any later version. | ||
| 31 | |||
| 32 | This program is distributed in the hope that it will be useful, | ||
| 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 35 | GNU General Public License for more details. | ||
| 36 | |||
| 37 | You should have received a copy of the GNU General Public License | ||
| 38 | along with this program; If not, see {License URI}. | ||
| 39 | */ | ||
| 40 | |||
| 41 | /* Basic Securtiy*/ | ||
| 42 | defined('ABSPATH') or die("No Access"); | ||
| 43 | |||
| 44 | |||
| 45 | if (!defined('ABSPATH')) { | ||
| 46 | define('ABSPATH', dirname(__FILE__), '/'); | ||
| 47 | } | ||
| 48 | |||
| 49 | class Beagle_WordPress_Scan | ||
| 50 | { | ||
| 51 | |||
| 52 | function __construct() | ||
| 53 | { | ||
| 54 | add_action('init', array($this, 'Beagle_WP_table_create')); | ||
| 55 | } | ||
| 56 | |||
| 57 | // for plugin activate | ||
| 58 | function activate_Beagle_plugin() | ||
| 59 | { | ||
| 60 | flush_rewrite_rules(); | ||
| 61 | } | ||
| 62 | |||
| 63 | // for plugin deactivate | ||
| 64 | function deactivate_Beagle_plugin() | ||
| 65 | { | ||
| 66 | global $wpdb; | ||
| 67 | |||
| 68 | $Beagle_WP_scan_table = $wpdb->prefix . 'beagleScanData'; | ||
| 69 | |||
| 70 | $sql = "DROP TABLE IF EXISTS $Beagle_WP_scan_table"; | ||
| 71 | $wpdb->query($sql); | ||
| 72 | |||
| 73 | delete_option("my_plugin_db_version"); | ||
| 74 | |||
| 75 | flush_rewrite_rules(); | ||
| 76 | } | ||
| 77 | |||
| 78 | function Beagle_WP_table_create() | ||
| 79 | { | ||
| 80 | flush_rewrite_rules(); | ||
| 81 | global $wpdb; | ||
| 82 | |||
| 83 | $Beagle_WP_scan_table = $wpdb->prefix . "beagleScanData"; | ||
| 84 | |||
| 85 | $charset_collate = $wpdb->get_charset_collate(); | ||
| 86 | |||
| 87 | $sql = "CREATE TABLE IF NOT EXISTS $Beagle_WP_scan_table( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, access_token VARCHAR(50) NOT NULL, application_token VARCHAR(50) NOT NULL, status VARCHAR(50) NOT NULL, result_token VARCHAR(50), verified BOOLEAN NOT NULL,title VARCHAR(20),url VARCHAR(50),runningStatus VARCHAR(10), autoVerify BOOLEAN)DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"; | ||
| 88 | require_once(ABSPATH . "wp-admin/includes/upgrade.php"); | ||
| 89 | dbDelta($sql); | ||
| 90 | } | ||
| 91 | |||
| 92 | } | ||
| 93 | |||
| 94 | if (class_exists('Beagle_WordPress_Scan')) { | ||
| 95 | |||
| 96 | $beagleWPscanStart = new Beagle_WordPress_Scan(); | ||
| 97 | |||
| 98 | // activation hook | ||
| 99 | register_deactivation_hook(__FILE__, array($beagleWPscanStart, 'activate_Beagle_plugin')); | ||
| 100 | |||
| 101 | // deactivation hook | ||
| 102 | register_deactivation_hook(__FILE__, array($beagleWPscanStart, 'deactivate_Beagle_plugin')); | ||
| 103 | } | ||
| 104 | |||
| 105 | add_action('admin_menu', 'Beagle_Menu_Page'); | ||
| 106 | |||
| 107 | /*Adding submenu page of plugin to the main menu*/ | ||
| 108 | function Beagle_Menu_Page() | ||
| 109 | { | ||
| 110 | add_menu_page('Beagle Plugin', 'Beagle Security', 'manage_options', 'Beagle_Plugin', 'Beagle_WP_Page_Content', 'data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJMYXllcl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjE2IiBoZWlnaHQ9IjE4IiB2aWV3Qm94PSIwIDAgMTYgMTgiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDE2IDE4IiB4bWw6c3BhY2U9InByZXNlcnZlIj4gIDxpbWFnZSBpZD0iaW1hZ2UwIiB3aWR0aD0iMTYiIGhlaWdodD0iMTgiIHg9IjAiIHk9IjAiIHhsaW5rOmhyZWY9ImRhdGE6aW1hZ2UvcG5nO2Jhc2U2NCxpVkJPUncwS0dnb0FBQUFOU1VoRVVnQUFBQkFBQUFBU0NBUUFBQUQ0TXBiaEFBQUFCR2RCVFVFQUFMR1BDL3hoQlFBQUFDQmpTRkpOIEFBQjZKZ0FBZ0lRQUFQb0FBQUNBNkFBQWRUQUFBT3BnQUFBNm1BQUFGM0NjdWxFOEFBQUFBbUpMUjBRQS80ZVB6TDhBQUFBSmNFaFogY3dBQUxFb0FBQ3hLQVhkNmRFMEFBQUFIZEVsTlJRZmxBZ1lMTGhvdnhqT2FBQUFCWlVsRVFWUW96MlhRTVV2VkFSaEc4ZC8vZWlXaiBEREZNc1lLa1JOU2kybHFpV1FLaENPb2pKRG0xRkxRVlJOUVUxQllFUWREUUlFUXVJVVFOaWxRUWtxRmxpU0Jva2c2Smx4THYwMkoyIG83T2U4L0xDVXdSbzB1T1lSdXZLWnJ3elp3TUtSYmJwZEZpelJSL00rcWxGdDA2RkdST1dDa1VHclpqdzJacS9GTnIxNnZhaW1DeXIgOXhoMWVqUnQ2bFZmelpzMzc2akpzaldVRExxaWNUTlk5TWdUMHlwUUJxZGMwN0wxSUpyMStXNkRLS2xxYzZORy8zSlhwNm96dW15aiB5SUQ5cmlwcTdqOXBOK0syYmwwaXR6S1YvNm5rYktRakl5Vzc3VlRMRHd0b2NFNmRXY01scmI3OEU2d2J0b3J0NHBCcVNhOHBIMnVDIFpoMUdWVHkxVjUvbkplLzFHL05hZFNzNVljNjRIYTRiTjExeVI4VUZTNGEyeHE0MzVySmxiN3hGaXB6UHR5U3Y4akFMU1pKbjJaWGUgWE1xZW9BaUYwMjQ2WXRwTHJaYmQxMmFmSVl2Rm4yVWlCM012SzFuSXlSelBRUHJTRUZFelhxUSsvUm5OZzF6TWdWcjVHMzRucUZHTyBSOWpIQUFBQUpYUkZXSFJrWVhSbE9tTnlaV0YwWlFBeU1ESXhMVEF5TFRBMlZERXhPalEyT2pJMkt6QXlPakF3U2pPczNRQUFBQ1YwIFJWaDBaR0YwWlRwdGIyUnBabmtBTWpBeU1TMHdNaTB3TmxReE1UbzBOam95Tmlzd01qb3dNRHR1RkdFQUFBQUFTVVZPUks1Q1lJST0iLz4KPC9zdmc+'); | ||
| 111 | } | ||
| 112 | |||
| 113 | |||
| 114 | /*to declare the apis globally*/ | ||
| 115 | global $apiServerBaseUrl; | ||
| 116 | $apiServerBaseUrl = "https://api.beaglesecurity.com/v1/"; | ||
| 117 | |||
| 118 | |||
| 119 | /*calling the option menu to enter access token and application token and to submit it*/ | ||
| 120 | require plugin_dir_path(__FILE__) . 'Admin/optionPageContent.php'; | ||
| 121 | |||
| 122 | /*hooks the post method to start the test when the user clicks 'start test' button*/ | ||
| 123 | if (isset($_POST['startBeagleTest'])) { | ||
| 124 | $_POST = array(); | ||
| 125 | add_action('admin_init', 'Beagle_WP_start_Test'); | ||
| 126 | } | ||
| 127 | |||
| 128 | /*hooks the post method to stop the test when the user clicks 'stop test' button*/ | ||
| 129 | if (isset($_POST['stopBeagleTest'])) { | ||
| 130 | add_action('admin_init', 'Beagle_WP_stop_Test'); | ||
| 131 | } | ||
| 132 | |||
| 133 | /*hooks the post method to restart the test when the user clicks 'start test' button after pressing stop button*/ | ||
| 134 | if (isset($_POST['restartBeagleTest'])) { | ||
| 135 | add_action('admin_init', 'Beagle_WP_stop_Test'); | ||
| 136 | } | ||
| 137 | |||
| 138 | /*erases the data in database when the user wants to delete the test details*/ | ||
| 139 | |||
| 140 | if (isset($_POST['delete'])) { | ||
| 141 | add_action('admin_init', 'Beagle_WP_delete_Test'); | ||
| 142 | } | ||
| 143 | |||
| 144 | /*hooks the post method to verify the domain*/ | ||
| 145 | if (isset($_POST['startVerify'])) { | ||
| 146 | add_action('admin_init', 'Beagle_WP_addDataTo_DB'); | ||
| 147 | } | ||
| 148 | |||
| 149 | if (isset($_POST['verify'])) { | ||
| 150 | add_action('admin_init', 'Beagle_WP_verify_Token'); | ||
| 151 | } | ||
| 152 | |||
| 153 | /*calling startTest.php file to begin test*/ | ||
| 154 | require plugin_dir_path(__FILE__) . 'Admin/startTest.php'; | ||
| 155 | |||
| 156 | /*calling stopTest.php file to stop test*/ | ||
| 157 | require plugin_dir_path(__FILE__) . 'Admin/stopTest.php'; | ||
| 158 | |||
| 159 | /*calling deleteTest.php file to delete the data of test*/ | ||
| 160 | require plugin_dir_path(__FILE__) . 'Admin/deleteTest.php'; | ||
| 161 | |||
| 162 | /*calling insertInToTable.php file to add data to db*/ | ||
| 163 | require plugin_dir_path(__FILE__) . 'Admin/insertInToTable.php'; | ||
| 164 | |||
| 165 | /*calling getStatus.php file to get status of test*/ | ||
| 166 | require plugin_dir_path(__FILE__) . 'Admin/getStatus.php'; | ||
| 167 | |||
| 168 | /*calling getResultData.php file to get result of test*/ | ||
| 169 | require plugin_dir_path(__FILE__) . 'Admin/getResultData.php'; | ||
| 170 | |||
| 171 | /*calling verify.php */ | ||
| 172 | require plugin_dir_path(__FILE__) . 'Admin/verifyToken.php'; | ||
| 173 | |||
| 174 | /*calling updateVerify.php */ | ||
| 175 | require plugin_dir_path(__FILE__) . 'Admin/updateVerify.php'; | ||
| 176 | |||
| 177 | /*calling updateVerifyFailed.php */ | ||
| 178 | require plugin_dir_path(__FILE__) . 'Admin/autoVerifyFailed.php'; | ||
| 179 | |||
| 180 | // for status data | ||
| 181 | add_action('wp_ajax_t4a_ajax_call', 'Beagle_WP_getStatusOf_CurrentTestData'); | ||
| 182 | |||
| 183 | // for result data | ||
| 184 | add_action('wp_ajax_t4a_ajax_call_result', 'Beagle_WP_getResultOf_CurrentTestData'); | ||
| 185 | |||
| 186 | // for delete application | ||
| 187 | add_action('wp_ajax_t4a_ajax_call_delete', 'Beagle_WP_delete_Test'); | ||
| 188 | |||
| 189 | // for verify application | ||
| 190 | add_action('wp_ajax_t4a_ajax_call_verify', 'Beagle_WP_verify_Token'); | ||
| 191 | |||
| 192 | // for update verify application | ||
| 193 | add_action('wp_ajax_t4a_ajax_call_verify_update', 'Beagle_WP_verify_Token_Update'); | ||
| 194 | |||
| 195 | // for update verify failed condition | ||
| 196 | add_action('wp_ajax_t4a_ajax_call_verify_update_failed', 'Beagle_WP_auto_Verify'); |
-
Please register or sign in to post a comment