Modern methods for protecting direct access to plugin files?

Is the following even still necessary, and if so, is it still the standard? Or does WordPress automatically protect plugins files from abuse nowadays?

if ( ! defined( 'ABSPATH' ) ) {     exit; } 

But, if we do still need to use it, I’m of the mind that the more secure solution is to not give the bad guys any hints at all if they’re sniffing around. That is, rather than showing an error message or white screen of death, which only verifies for them that the plugin they’re sniffing out vulnerabilities for does in fact exist on the installation, how about throwing a 404 as though it doesn’t exist at all?

The following is the closest I’ve gotten to so far:

if ( ! defined( 'ABSPATH' ) ) {     header( 'Location: 404' );     die(); } 

This is pretty good, but not completely ideal, in that even tagging a 404 onto the attempted URL like this is an irregular pattern, that gives away a clue. Otherwise, it does exactly what I want it to.

But my other attempts with combinations of:

http_response_code( 404 );

or status_header( 404 );

and

get_404_template();

or wp_safe_redirect( get_stylesheet_directory_uri() . '/404.php', 404 );

or header( get_stylesheet_directory() . '/404.php' );

had no effect.

Finally, in this context, die(); vs exit;, are either of them better than the other or do they work exactly the same way here?

Difference between methods – onClick.AddListener and On Click under UI button inspector?

Within my Unity Project in my code, (see below), I have a button called Check which executes when CheckPress() function is called. I read two approaches by which this can be done.

Appraoch 1: Using Check.onClick.AddListener(CheckPress); and then attaching script to Canvas. When I press run and click the Check button, this works.

Approach 2: The other approach I read is that, I can attach my script to Canvas. From there I select the button Check from hierarchy, then under inspector I see On Click(), I click + sign and then drag the Canvas and place it in Object (see the attached image), then under No Function I select the CheckButtonBehaviour Script and select the CheckPress(). When I press run and click the Check button, this also works as intended.

I wanted to know if these two approaches are same or different. If they are different, then in which context either approach should be implemented.

using System.Collections.Generic; using System.Collections; using UnityEngine; using UnityEngine.UI; using System.IO; using System.Threading; using UnityEditor; using System.Text; using System.Net; using System.Net.Sockets; using System; using System.Linq;   public class CheckButtonBehaviour : MonoBehaviour {  public Button Check; public Button Play; public Button NextSignal;  public List<string> signals = new List<string> {"Speech1", "Speech2", "Speech3", "Speech4"}; public List<string> shuffledSignals = new List<string>(); public int index = 1; public int counter = 3;   private static int localPort; private string IP;   public int port = 8050; IPEndPoint remoteEndPoint; UdpClient client;   void Start() {          var rndr = new System.Random();     shuffledSignals = signals.OrderBy(i => rndr.Next()).ToList();      IP = "127.0.0.1";     port = 8050;     remoteEndPoint = new IPEndPoint(IPAddress.Parse(IP), port);     client = new UdpClient();     Play.gameObject.SetActive(false);     NextSignal.gameObject.SetActive(false);      Check.onClick.AddListener(CheckPress);  }  public void CheckPress()     {           byte[] data0 = Encoding.ASCII.GetBytes("starting"); ///OLD CODE part     client.Send(data0, data0.Length, remoteEndPoint);     Debug.Log("<color=blue>Something is sent to MAX</color> : starting");      Check.gameObject.SetActive(true);     Check.interactable = false;     Check.enabled = false;      Play.gameObject.SetActive(true);     NextSignal.gameObject.SetActive(true);      } 

Show/Hide specific shipping methods based on postcode and cart subtotal

I would like to show or hide specific shipping options based on postcode and cart subtotal amount. Here is my code:

add_filter( 'woocommerce_package_rates', 'unset_shipping_when_free_is_available', 10, 2 );     function unset_shipping_when_free_is_available( $  rates, $  package ) {      $  excluded_postcode = array( 1000,1030,1040,1050,1060,1070,1080,1081,1082,1083,1090,1140,1150,1160,1170,1180,1190,1200,1210 );     if(WC()->cart->get_cart_subtotal() >= '50' && !in_array(WC()->customer->get_shipping_postcode(), $  excluded_postcode )){         if ( isset( $  rates['free_shipping:4'] ) ) {             unset( $  rates['flat_rate:2'] );             unset( $  rates['flat_rate:26'] );             unset( $  rates['flat_rate:27'] );         }     }elseif(WC()->cart->get_cart_subtotal() >= '50' && in_array(WC()->customer->get_shipping_postcode(), $  excluded_postcode )){         if ( isset( $  rates['free_shipping:16'] ) ) {             unset( $  rates['flat_rate:13'] );             unset( $  rates['flat_rate:28'] );             unset( $  rates['flat_rate:29'] );         }     }     return $  rates; } 

What I want to do is when the customer’s postcode meets one of the list: array $ excluded_postcode(Brussels’s postcode), there will be 2 options: free collective shipping(free_shipping:16) (the customer need to choose a date) or flat rate based on weight, but if the cart subtotal is >=50€, then the shipping fee will be free, there will be also 2 options (both free), one is free collective shipping (need to choose a date) and the other is free shipping when the minimum amount is 50€(free_shipping:4); if the customer’s postcode is different from the array (not from Brussels), the shipping rate is based on weight, but if the subtotal amount is >=50€, then it will be free shipping. So if subtotal greater or equals 50€, only free options will be shown (if postcode=Brussels, 2 free shipping options: free_shipping:4 and free_shipping:16, if not Brussels: only free_shipping:4), if subtotal less than 50€, 2 options if Brussels: free_shipping:16 and flat rate based on weight, if not Brussels: only flat rate based on weight. (Brussels flat rates: flat_rate:2=0-2kg, flat_rate:26=2-5kg, flat_rate:27=5-10kg, No Brussels flat rates: flat_rate:13=0-2kg, flat_rate:28=2-5kg, flat_rate:29=5-10kg)

It works fine except when the subtotal is less than 50€ and from Brussels, only one free shipping option is showing: free_shipping:16, I would like to have both free options to be displayed.

This is the checkout page: https://www.labeerepoque.be/en/checkout/

I would be greatful if you could help me with this, thank you!

Which class has access to the best ‘stay at home’ adventuring methods?

Assuming a 20th level character, which class would allow them to remotely assist a party of adventurers without ever leaving a well-warded personal sanctum? In 3.5e/PF, there existed a plethora of spells mostly based around the Wizard to support this kind of ‘off-site meddling’ but I know less about 5E and what Wizards and their ilk can accomplish there (especially at higher levels).

For the purposes of this question, assume the following;

  • The character is completely unwilling to leave their sanctum unless they have some inherent way to cheat death that is 100% reliable (paying a powerful cleric to resurrect you after X time doesn’t count for our paranoid and suspicious protagonist).
  • Class features that are mobile (such as Familiars or Animal Companions) can leave the sanctum, as can summoned or bound creatures.
  • They have intentionally chosen their class and even found some way of acquiring reasonable magic items towards this goal – they are a purpose-built ‘remote assistance’ character.

‘Best’ is not simply damage-per-round but overall quality of assistance – a battery of divinations doesn’t directly do damage but does allow the party to bypass encounters, effectively doing all the damage of the enemy hp of that encounter. Remote healing is not damage but can keep party members alive to do more damage, so on. In this case I am not looking at any specific character level for the party being assisted, but rather at spells, techniques, or class features that would apply to the widest range of parties successfully. Consider this less ‘bob stays at home and still helps the party’ but more ‘Mordenkainen’s Magical Assist (MMA) Incorporated’.

Are communication methods for Intelligent Items cumulative?

So I’ve been looking at the rules for Intelligent Magic Items because I have a Bladebound magus in my group, and it looks as though Empathy -> Speech -> Telepathy is almost like an upgrade path of communication methods for intelligent items.

My question is, does a magic item that can communicate via telepathy also have the ability to speak and communicate empathically, or is each type of communication a separate ability and it would have to have BOTH telepathy and speech in order to speak?

Methods to Prove Data Authenticity from Potentially Compromised Sources?

I’ve been thinking about this problem for some time and I wanted to ask if there are any known methods, or research papers, about how to prove "authenticity" or correctness of data originating from a potentially compromised source (remote server, process, etc). Specifically what I’ve been imagining is say you have service A and service B, service B sources data from A but is worried that A has been compromised such that even if data is signed by A, B can’t trust that it was generated by code written by A‘s developers. Is it possible for B to prove to itself that data from A is authentic, that it was indeed generated by the expected code and not injected or generated by an attacker who has compromised A?

One solution I’ve been thinking about is using a sort of distributed ledger or blockchain so that multiple nodes compute the same data, and in doing so raises the bar such that an attacker would have to compromise N% of the services producing the needed data, this provides naturally replication and I can use an appropriate consensus protocol, but ofc introduces some overhead, efficiency concerns, and I would need to think hard about side-effects being performed more than once.

If there is only one node possible of generating data, such as a sensor node, and it is compromised, I’d imagine all hope is lost, but I also wouldn’t be surprised if there is some clever crypto scheme that attempts to solve this problem as well.

I hope it’s clear as to what the question is, thank you.

Destroying data on storage drives via overwrite methods really doesn’t work?

I’m going to sell a computer hard drive on the Internet, it’s a 500GB SATA hard drive, I really used it 3 or 2 years ago, I never used it again, I used about 20 or 40% of the space.

I have read about various tools and used Hardwipe, first I deleted the volume and recreated it, then with the program (option to clean free space) I used the GOST R 50739-95 method, when it finished then I did it again with the random method (both It took about 6 hours, in total I spent 2 days on this task, and I had several interruptions so I had to disconnect and continue the overwrite).

I have read an article on the internet (I shouldn’t believe everything I read on the internet, but that’s why I am asking this question), where it mentions that overwriting these random bytes is not enough and even if I used the DoD 5220.22-M method the data could To be recoverable, it mentions that a good method is degaussing (but this is really crazy, that is, a disk that used so little space), is this information really true? Should I use a Gutmann method?

Thanks

Did I understand how thin-blood alchemy distilation methods work right?

Long ago, I prepared a Vampire the Masquerade 5e and ask a lot of questions about thin-blood. After a short time, my players decide to play non thin-blood characters. Now, I want to play a campaign with only thin-blood characters.

Thin-blood alchemy have three distilation methods. Athanor corporis, Calcinatio and Fixatio. I understand them in a way that look strange for me (mostly Athanor corporis and Calcinatio):

  • Athanor corporis: You make your formulas with your own body, and you can keep them indefinitely. But you can use only one at a time, and you have to concentrate for 3 turn to switch formulas. But something that I don’t understand is "does you keep the previous formula in your body, and just have to switch to have it again, or did you need to re-distill it later to have it again?"
  • Calcinatio: You make your formulas with kine. They have the formula in them until they have an emotional shift. If you drink there blood, you have the power. But what I don’t understand is "Is the formula is still in the human after drinking?" and "What happend if someone else drink the formula?"
  • Fixatio: Classic rpg alchemy. You make a potion, it give you powers for a short time if you drink it. The only question that I have is "can you share your formula with another thin-blood, so they can use the power too?"

related: How do thin-bloods and thin-blood alchemy work?

Discrepancy between the results of NIntegrate with different methods and options

I am trying to perform a numerical integration on a function defined through a sum of exponential terms. The summation is given by:

sum[z_, z0_, t_, nmax_] :=   1/Sqrt[4 t]*Sum[ Exp[-(z - z0 - 2 n)^2/(4 t)] + Exp[-(z + z0 - 2 n)^2/(4 t) ], {n, -nmax, nmax}]; 

and we define

f[z_, zp_, y_, yp_, z0_, t_] =    ( Exp[-(y - yp)^2/(8t)]/Sqrt[8t] )*D[sum[z, z0, t, 20]*sum[zp, z0, t, 20], t, z, zp]; 

where I have chosen nmax=20.

I wish to perform numerical integration on f. I define

int1[a_] :=   NIntegrate[ f[zp, zpp, 0, ypp, z0, t]*( ypp (zp - zpp) )/( a (zp - zpp)^2 + ypp^2 )^(3/2),  {z0, 0., 1.}, {t, 0., 10.}, {zp, 0., 1.}, {zpp, 0., 1.}, {ypp, 0., Infinity}] 

Based on which I get the following table (no errors generated)

tab1 = Table[{a, int[a]}, {a, 1., 5., .5}]  (* {{1., 0.00135643}, {1.5, 0.000734155}, {2., -0.000611633},  {2.5, 0.0000596739}, {3.,0.0359735}, {3.5, 0.0292143},  {4., 0.01122}, {4.5, 0.00889722}, {5., 0.00649666}} *) 

To check, I tried AccuracyGoal-> 30 and PrecisionGoal -> 30 and got the same results. However, as soon as I include WorkingPrecision, the integrated gives 0 all the time. For example:

intwrk[a_] :=   NIntegrate[ f[zp, zpp, 0, ypp, z0, t]*(ypp (zp - zpp))/(a (zp - zpp)^2 + ypp^2)^(3/2),  {z0, 0, 1}, {t, 0, 10}, {zp, 0, 1}, {zpp, 0, 1}, {ypp, 0, Infinity},  AccuracyGoal -> 30, PrecisionGoal -> 30, WorkingPrecision -> 100] 

Gives all zeros – which I can’t seem to understand. Am I doing something wrong here?

Then I also performed the calculation using LocalAdaptive method:

int2[a_] :=   NIntegrate[ f[zp, zpp, 0, ypp, z0, t]*(ypp (zp - zpp))/(a (zp - zpp)^2 + ypp^2)^(3/2), {z0, 0., 1.}, {t,0., 10.}, {zp, 0, 1}, {zpp, 0., 1.}, {ypp, 0., Infinity }, Method -> "LocalAdaptive"] 

which gives

tab2 = Table[{a, int2[a]}, {a, 1., 5., .5}]  (*  {{1., 1.75934*10^-29}, {1.5, -8.79671*10^-30}, {2., 8.7967*10^-30},  {2.5, -8.7967*10^-30}, {3., 8.7967*10^-30}, {3.5, -2.80635*10^-51},  {4., -8.79671*10^-30}, {4.5, -9.78474*10^-37}, {5., -9.78474*10^-37}} *) 

which is a very different result. This one also runs much faster than the int1. I guess these numbers here are not reliable, but how can I check them?

PS: based on the answer to my previous post, I tried Method -> "GaussKronrodRule" and Method -> {"MultidimensionalRule", "Generators" -> 9}, but they run forever and I couldn’t get any outcome.