networking – How to set static ip on Hyper-V vm when host has one network card?

I am running Hyper-V on Windows 10 and created an Ubuntu server vm running postgresql. My pc has a single nic card.
There is a single network adapter on the VM that is connected to the Default switch in Hyper-V. I am able to connect to the internet from the vm and can connect to the instance of Postgresql on the VM from the host and everything works fine.
But each time I reboot the VM it gets a new IP address so everyday I have to reconfigure the connection string on my app that makes calls to the Postgresql instance on the vm.
How can I configure the ip addresses that are assigned to the devices on the vlan (not sure if that is the correct term) that are sitting behind the Default Switch? I am guessing there is a DHCP server somewhere but I can’t find anything.

I just want to have the same ip always assigned to the VM or be able to set the ip manually and know that it is not going to be assigned to another VM, but am at a loss as to how to do what seems like should be a super simple thing.

files – How can I restrict access to a static HTML page served from a subfolder of my site to authenticated users only?

I have a Drupal 8 site that has all roles and permissions necessary for authenticated users. One of the new requirements is to serve a static microsite (like a campaign site, totally different design compare to Drupal site) which is a single folder with all the static assets (HTML, CSS, JS , images). We have to serve this site under the same domain drupal is hosted and should be accessed ONLY by authenticated users.

I tried to host it under sites/default/files/ directory, but it means it is public and anyone can access it.

command line – Error configuring static routing using cli

I’m trying to add a static route on my Ubuntu Desktop 16.04 machine with the cli, but with no success. I’m using the classic ip route command: ip route add x.x.x.0/24 via y.y.y.y dev eno1 (hid the actual addresses here), and I receive the following error: RTNETLINK answers: Network is unreachable. My machine will access y.y.y.y through its default gateway. The actual routing from the default gateway to y.y.y.y which will route to x.x.x.x is already set and working.

The error received is fine by me, as it is actually reachable (tested myself), as must be a false error caused by network components (such as FW).

My question is: is there a way to ignore that error? This error is causing the static routing not to be saved, and I want it to be saved even though the command thinks it is unreachable.
My route command shows only my default and link-local acquired by the dhcp and also shows my vmnet.

Why am I using the cli?

I know Ubuntu 16.04 should use /etc/network/interfaces, and Ubuntu 18.04 and above versions use /etc/netplan, but my /etc/network/interfaces file is absolutely empty (probably because of the dhcp method).

Lighting – Unit – Global lighting no longer appears to be applied to static objects at runtime

First of all, I'm a newcomer to Unity. Please forgive me if the answer to this question is obvious to an experimented developer.

In one of my projects I have this result while I'm running the project in the editor:
Enter the image description here

At runtime, however, I get the following result:
Enter the image description here

As you can see, several objects in the scene are no longer illuminated. In fact, I have found that ALL of my static objects have lost their lighting at runtime. I tried using Windows and WebGL as the target to get the same result.

As a hobbyist, I can provide information on project configuration. Better, I can provide my project's Git link:
https://github.com/Jeanmilost/Unity/tree/master/Survival%20Demo%20Scene

This is a demo project, but I am interested in building more serious projects in the future, so I need to understand why this problem occurs. If anyone can show me what I am doing wrong, I would be very grateful because I have already spent a few hours trying to find the solution without success.

Network – How can a network device with a static IP address and a faulty gateway be restored?

In short, I made a stupid mistake.

I had set up my QNAP NAS to use the IP addresses 192.168.1.1/24 and 192.168.1.254 as the default gateway.

I then switched from this network to another via the web configuration interface and first changed the static IP to 192.168.123.1/24. Unfortunately, the default gateway setting is not available in the same place, so I just thought I would change it after setting the new IP and netmask.

This excluded me from the NAS: if I try to reach him over HTTP on his new IP address, the packets are forwarded correctly, but the NAS never responds (I think that's because it is instructed to use 192.168. 1.254 to route what is enabled is a different subnet than its network interface so that the packets never leave the NAS).

Is there any way to get it back over HTTP? I've tried various things with Wireshark for debugging and for multiple interface settings on my computer, but I never get responses to the TCP packets sent to the NAS.

Interesting fact: ping works. It doesn't know ICMP very well, so I don't understand how the responses are sent to my computer, but they are safe!

As a side note, I cannot reset the network configuration of the NAS because I had disabled the quick reset using the reset button. The final step would be to extract the hard drives, copy the data, and start a new configuration from scratch.

Plugins – Get the shortcode output for static post_content into the database

My simple shortcode retrieves a list of articles as text files from a folder. These articles are in HTML format (with h2, p …). I use a plugin that quickly creates the pages I need to insert my shortcode into.
The shortcode works well and the HTML rendering is fine in the articles, BUT:

the problem: The shortcode is updated every time the page is loaded and creates different content each time.

What do you think is the method to "fix" this because I can't? I tried to write the content of the shortcode to the database in post_content. Remove the shortcode from the articles so that you can edit them later in WordPress. I have tried several times, but nothing, thanks for your help

function my_shortcode(){

    $path_to_myplugin = WP_PLUGIN_DIR . '/my_plugin_name/';
    $thema_folder = "themafolder";
    $passage = fopen($path_to_myplugin.'nbr-init.txt', 'r+');//Stock passage, Start to 0
    $number_passage = fgets($passage); // Read the first line
    $number_passage += 1; // +1
    fseek($passage, 0); // cursor at start of file
    fputs($passage, $number_passage); // Rewrite the new number
    fclose($passage);
    @$file_name = $thema_folder."/"."art-".$thema_folder."-".$number_passage.".txt";
    $content = file_get_contents($path_to_myplugin.$file_name);// Ok it works 

// I try to write the shortcode to the post_content but not working:
    global $wpdb;
    $wpdb->insert{
        $args = array(
            'post_content' => $content
        )
    };
$content = wp_insert_post( $args );

    return $content;
}

add_shortcode ('myshortcode', 'my_shortcode');

Reverse engineering – static detection of PE

Can a PE file contain two or more executable sections?

Yes, it can, but it is atypical. Typically, the compiler creates a section called ".text" with the correct permissions for executable code. However, PE files can generally contain several executable sections of code. A tool like PE Bear can tell you about the sections and their properties.

How can we tell if it's injected or not?

I don't know what you mean by "inject it". Do you mean that the PE tries to insert code into another process? If you mean this, this can only be determined by reverse engineering and understanding the functionality of the PE. You could look at the imports first. For example, if an attempt is made to inject into another process, WriteProcessMemory, VirtualAllocEx, and other API functions related to reading and writing memory across process boundaries may be imported. Of course, these could be generally veiled, so imports may not be obvious.

node.js – Where are the images stored on the server side and not in the static folder and how are they accessed on request?

You have many options, I recommend you look at online services. You can save the preview images in an Amazon S3 bucket and access them via CDN. This has the advantage that your server does not have to bear the burden of all image requests, which base64 converts for the transfer, does not have to keep your server running, etc. If someone orders, you can do all the processing – size in drop box -Delivery using Amazon's Lamda service and sending a notification with a delivery link.

Or you can save the images in the database. Remember that you need to read them from the database with your backend, possibly encode them in Base-64, and then render them with a custom front-end.

Since this is a software engineering forum, I have to ask why you chose NodeJS. Did you design the solution first? The reason I'm asking is that NodeJS is not suitable for high capacities and images can have a high capacity depending on the target audience.

If I know as little about your problem as I do, I would still suggest something serverless for your backend, depending on how complex your application will be, Angular or Vue.