Month: May 2021

How to install Wi-Fi driver in Linux if the computer is offline

If you cannot connect to Wi-Fi because the wireless card driver is not yet installed in your Linux and there is no wired connection, then you get a vicious circle: it is impossible to install the driver because there is no Internet.

There is a way out of the situation – for this you only need an Android phone. Moreover, you do not need to use mobile data, you can use a Wi-Fi connection via your phone.

How to use an Android phone as a USB tethering

It's pretty simple. Start by connecting your phone to your computer with a USB cable.

Then go to settings. The name of the settings items may differ on different phone models, but the essence will be the same everywhere.

Go to the “Connections” section.

Find the item “Mobile Hotspot and Tethering” there.

Turn on “USB tethering”.

Everything is ready – now your computer is online and can connect to the Internet. You can install Wi-Fi drivers or perform other actions you want on the network.

Please note that if the phone is not connected to Wi-Fi, then mobile data will be used – if you do not have an unlimited tariff, then it will cost you money. But you can connect your phone to a Wi-Fi network and still use it as a USB modem. As a result, it turns out that your computer is using Wi-Fi over the phone, and not mobile data.

Intel disabled undervolting on 11th gen Tiger Lake CPUs

Owners of new computers, as well as users updating the BIOS of their laptops and computers, may have noticed that manufacturers have a tendency to disable undervolting. 10th Gen processors ship with undervolting disabled by default. To enable it, you need to find the appropriate setting in the depths of the BIOS.

If you have previous generations of central processors and after updating the BIOS, you notice that the undervolting has stopped working, then the matter is in this update.

And not everyone is lucky: sometimes manufacturers block the possibility of undervolting and do not offer any options to re-enable it. The only option in such a situation is to rollback BIOS to the previous version.

And now, in Intel 11th generation processors, undervolting is completely disabled, at the hardware level. There is no other way to turn it on.

The official reason? Vulnerability allowing Plundervolt attack.

How dangerous is a Plundervolt attack? All of the following conditions must be met:

1. Physical access (!) to a computer with an Intel processor

2. Elevated privileges (root rights) (!)

3. 3. Sophisticated software that drastically (-200-300mV range) lowering the voltage in a bizarre way causes malfunctions in calculations and access to the SGX…

4. This vulnerability is only possible on Intel Software Guard Extensions (SGX). Do you know what this is? I do not know either. This is something complex and very rarely (never?) used by regular users.

You may ask, why does this attack even need undervolting if you already have physical access and already have root rights? After all, even using one of these, you can get full access over the computer and do anything with it. The only reason people talk about this vulnerability is the possibility of an attack on SGX. But the site itself says:

If you do not use SGX, you do not need to do anything.

That is the attack does not apply to your computer.

The question is, how reliable are attacks with a strong decrease in voltage in general, if the computer in such cases prefers to simply freeze or go into a reboot?

Why for an attack that is impossible in real conditions and is not exploited by anyone due to the fact that it is pointless/impossible to exploit, it was necessary to completely block the possibility of undervolting? Why not give the “risky guys” an opportunity to turn on undervolting if they are willing to accept non-existent risk?

All these unanswered questions suggest that Intel wants users to buy more expensive processors if they lack the power or TDP.

First of all, owners of laptops, especially ultrabook models, will lose from the prohibition of undervolting. It is difficult to provide good cooling in them and undervolting was the Holy Grail for them. Especially unpleasant for the owner of powerful (gaming) laptops.

Undervolting allows you to use central processors more efficiently, thanks to it they overheat less, consume less energy, keep high frequencies longer (throttling happens less often), and more productive generally. It is a pity that 11th generation Intel processors are deprived of all this due to some phantom danger.

Moreover, it is written on the Plundervolt site, Intel has already released a patch that eliminates this vulnerability.

Where else to look for apartments for purchase and rent in Thailand

In the article “How to choose an apartment in Thailand to buy: the cheapest condos” I evaluated the apartments in Thailand, which are presented on the site https://www.thailand-property.com, but this is not the only site with apartments in Thailand, and the Internet is is not the only source with an offer for the buy/sell/rent of apartments. Let's consider other options for finding apartments in Thailand.

1. Websites with advertisements for the sale of apartments in Thailand

Websites with ads for the sale of apartments in Thailand:

It is difficult to say which site has the most complete list of apartments. Also, there is no complete certainty that all information is up-to-date.

You can google the condo you are interested in and find sites that advertise the sale of apartments.

2. Contact the managers of the condominium you are interested in

Each condominium has an administration, managers who manage the condo. You can contact them with a question about the apartments for sale.

3. Information on the doors of apartments

While visiting the condominium you are interested in, walk through the floors – often on the doors of apartments for sale and rent there are corresponding announcements with phone numbers.

4. Ads in shopping malls

In large shopping centers on the first floor there is sometimes a stand with advertisements. It can be located on the way to the shopping center toilet, for example.

There are a few examples of ads in this article – the quality of the photos is poor as the ads are laminated and glare.

The cheapest offers targeted at Thais can be written in Thai.

5. Facebook

Facebook is perhaps the most popular classifieds site in Thailand. I do not use social networks, so I cannot give any details. Perhaps your Thai friends will help you.

6. Outdoor advertising

In addition to “Sell / Rent” signs on condominiums, you can find other outdoor advertising options, one example:

How to block by Referer, User Agent, URL, query string, IP and their combinations in mod_rewrite

As part of the fight against the influx of bots to the site (see the screenshot above), I had to refresh my knowledge of mod_rewrite. Below are examples of mod_rewrite rules that allow you to perform certain actions (such as blocking) for users who meet a large number of criteria at once – see the most recent example to see how flexible and powerful mod_rewrite is.

See also: How to protect my website from bots

Denying access with an empty referrer (Referer)

The following rule will deny access to all requests in which the HTTP Referer header is not set (in Apache logs, "-" is written instead of the Referer line):

RewriteEngine	on
RewriteCond	%{HTTP_REFERER}	^$
RewriteRule	^.*	-	[F,L]

Blocking access on the part of the user agent

When blocking bots by User Agent, it is not necessary to specify the full name – you can specify only part of the User Agent string to match. Special characters and spaces must be escaped.

For example, the following rule will block access for all users whose User Agent string contains “Android 10”:

RewriteEngine	on
RewriteCond	%{HTTP_USER_AGENT}	"Android\ 10"
RewriteRule	^.*	-	[F,L]

Examples of User Agents blocked by this rule:

  • Mozilla/5.0 (Linux; Android 10; SM-G970F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Mobile Safari/537.36
  • Mozilla/5.0 (Linux; Android 10; Redmi Note 7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Mobile Safari/537.36

How to block access by exact match User Agent

If you need to block access to the site by a certain User Agent with an exact match of the name, then use the If construct (this does not apply to mod_rewrite, but do not forget about this possibility):

<If "%{HTTP_USER_AGENT} == 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)'">
	Require all denied
</If>

<If "%{HTTP_USER_AGENT} == 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0'">
	Require all denied
</If>

<If "%{HTTP_USER_AGENT} == 'Mozilla/5.0 (Windows NT 6.1; rv:45.0) Gecko/20100101 Firefox/45.9.0'">
	Require all denied
</If>

If is available since Apache 2.4.

Denying access to certain pages

The %{REQUEST_URI} variable includes everything that goes after the hostname in the request (but does not include what comes after the question mark in the URL), using it you can filter requests by URL, query string, file names or parts of them. For example:

RewriteEngine	on
RewriteCond	%{REQUEST_URI}	"query-string"
RewriteRule	^.*	-	[F,L]

Despite the fact that in the logs of the Apache web server some characters, including Cyrillic, are displayed in URL encoding, you can specify Cyrillic or other letters of national alphabets in these rules. For example, the following rule will block access to an article with the URL https://site.ru/how-to-find-which-file-from/:

RewriteEngine	on
RewriteCond	%{REQUEST_URI}	"how-to-find-which-file-from"
RewriteRule	^.*	-	[F,L]

If you wish, you can specify several URLs (or their parts) at once. Each search string must be enclosed in parentheses; the parenthesized strings must be separated by | (pipe), for example:

RewriteEngine	on
RewriteCond	%{REQUEST_URI}	"(windows-player)|(how-to-find-which-file-from)|(how much-RAM)|(how-to-open-folder-with)|(7-applications-for)"
RewriteRule	^.*	-	[F,L]

Since %{REQUEST_URI} does not include what comes after the question mark in the URL, use %{QUERY_STRING} to filter by the query string that follows the question mark.

How to filter by the query string following the question mark

The %{QUERY_STRING} variable contains the query string that follows the ? (question mark) of the current request to the server.

Note that the filtered value must be URL encoded. For example, the following rule:

RewriteCond %{QUERY_STRING} "p=5373&%D0%B7%D0%B0%D0%B1%D0%BB%D0%BE%D0%BA%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D1%82%D1%8C"
RewriteRule ^.* - [F,L]

blocks access to the page https://suay.ru/?p=5373&заблокировать, but will not deny access to the page https://suay.ru/?p=5373.

Denying IP and Ranges Access

With mod_rewrite, you can block individual IPs from accessing the site:

RewriteEngine	on
RewriteCond	"%{REMOTE_ADDR}"	"84.53.229.255"
RewriteRule	^.*	-	[F,L]

You can specify multiple IP addresses to block:

RewriteEngine	on
RewriteCond	"%{REMOTE_ADDR}"	"84.53.229.255" [OR]
RewriteCond	"%{REMOTE_ADDR}"	"123.45.67.89" [OR]
RewriteCond	"%{REMOTE_ADDR}"	"122.33.44.55"
RewriteRule	^.*	-	[F,L]

You can also use ranges, but remember that in this case, strings are treated as regular expressions, so the CIDR notation (for example, 94.25.168.0/21) is not supported.

Ranges must be specified as regular expressions – this can be done using character sets. For example, to block the following ranges

  • 94.25.168.0/21 (range 94.25.168.0 - 94.25.175.255)
  • 83.220.236.0/22 (range 83.220.236.0 - 83.220.239.255)
  • 31.173.80.0/21 (range 31.173.80.0 - 31.173.87.255)
  • 213.87.160.0/22 (range 213.87.160.0 - 213.87.163.255)
  • 178.176.72.0/21 (range 178.176.72.0 - 178.176.75.255)

the rule will work:

RewriteEngine	on
RewriteCond	"%{REMOTE_ADDR}"	"((94\.25\.1[6-7]])|(83\.220\.23[6-9])|(31\.173\.8[0-7])|(213\.87\.16[0-3])|(178\.176\.7[2-5]))"
RewriteRule	^.*	-	[F,L]

Note that the range 94.25.168.0 - 94.25.175.255 cannot be written as 94.25.1[68-75], it will be interpreted as the string “94.25.1” and a character set including character 6, range 8-7 and character 5. Due to the range of 8-7, this entry will cause an error on the server.

Therefore, to write 94.25.168.0 - 94.25.175.255, “94\.25\.1[6-7]” is used. Yes, this record does not accurately convey the original range – to increase the precision, you can complicate the regular expression. But in my case, this is a temporary hotfix, so it will do just that.

Also note that the last octet 0-255 can be skipped, since part of the IP address is enough to match the regular expression.

Combining access control rules

Task: block users who meet ALL of the following criteria at once:

1. Empty referrer

2. The user agent contains the string “Android 10”

3. Access was made to a page whose URL contains any of the strings

  • windows-player
  • how-to-find-which-file-from
  • how much-RAM
  • how-to-open-folder-with
  • 7-applications-for

4. The user has an IP address belonging to any of the ranges:

  • 94.25.168.0/21 (range 94.25.168.0 - 94.25.175.255)
  • 83.220.236.0/22 (range 83.220.236.0 - 83.220.239.255)
  • 31.173.80.0/21 (range 31.173.80.0 - 31.173.87.255)
  • 213.87.160.0/22 (range 213.87.160.0 - 213.87.163.255)
  • 178.176.72.0/21 (range 178.176.72.0 - 178.176.75.255)

The following set of rules will match the specified task:

RewriteEngine	on
RewriteCond	"%{REMOTE_ADDR}"	"((94.25.1[6-7]])|(83.220.23[6-9])|(31.173.8[0-7])|(213.87.16[0-3])|(178.176.7[2-5]))"
RewriteCond	%{HTTP_REFERER}	^$
RewriteCond	%{HTTP_USER_AGENT}	"Android\ 10"
RewriteCond	%{REQUEST_URI}	"(windows-player)|(how-to-find-which-file-from)|(how much-RAM)|(how-to-open-folder-with)|(7-applications-for)"
RewriteRule	^.*	-	[F,L]

Please note that rules that are logical OR must be collected into one large rule. That is, you cannot use the [OR] flag with any of the rules, otherwise it will break the logic of the entire rule set.

By the way, I overcame the bots.

How to disable autostart of programs and services in Windows

Auto-loading programs and services that you are not using is a waste of system resources. The automatic launch of a large number of programs can slow down your computer.

This article will show you how to check which programs start automatically when you turn on your computer and disable those you don't need.

In addition to programs, we will also consider services. In fact, services are exactly the same programs that may or may not be needed in startup, but for some reason, many people forget about them.

How to disable automatic launch of programs

Enter in the system search “Startup Apps” and open this settings window.

The Startup App setting will open.

Here you can move the sliders and disable those applications that you do not need to start automatically every time you turn on your computer.

How to disable services from startup

Services are a kind of programs that run in the background and do not require user input.

Services can either be native for Windows operating system or be third-party applications. Examples of services that the user can install himself: web server, VNC remote desktop server, SSH server, MySQL server.

To open the service manager, type “Services” into the system search and press Enter:

In the window that opens, pay attention to the “Startup Type” column.

Many of these services are part of the operating system and should not be disabled, otherwise computer performance problems may arise. However, some of these services can be safely removed from startup. This primarily concerns third-party services.

In fact, I would not recommend disabling Windows services. But how can you quickly filter out third-party services from Windows services?

This can be done in the “System Configuration” window.

Go to the Services tab and click the checkbox next to “Hide all Microsoft services”.

You need to pay special attention to these services – some of them can be safely excluded from startup.

Related article: How to manage services on Windows

Can't find exactly how the unwanted program is launched? Then use the Autoruns program.

libpcap-dev for Cygwin

When compiling programs from source in Cygwin, an error may occur containing the line “when searching for -lwpcap”.

The essence of the error is that the headers of the pcap library are searched.

These header files are present in the libpcap-dev package (Debian and derivatives). This package may also be called libpcap (for example, on Arch Linux). There are no such packages in the Cygwin repositories, since their functioning is closely related to the operating system drivers and libpcap is intended for Linux, while Cygwin runs on Windows.

When traversing the file system looking for the correct header files, the following messages may be displayed:

/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../lib/libwpcap.a when searching for -lwpcap
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../lib/libwpcap.a when searching for -lwpcap
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /lib/../lib/libwpcap.a when searching for -lwpcap
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /lib/../lib/libwpcap.a when searching for -lwpcap
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/../lib/libwpcap.a when searching for -lwpcap
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/../lib/libwpcap.a when searching for -lwpcap
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../libwpcap.a when searching for -lwpcap
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../libwpcap.a when searching for -lwpcap
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/libwpcap.a when searching for -lwpcap
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/libwpcap.a when searching for -lwpcap
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../lib/libwpcap.a when searching for -lwpcap
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /lib/../lib/libwpcap.a when searching for -lwpcap
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/../lib/libwpcap.a when searching for -lwpcap
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../libwpcap.a when searching for -lwpcap
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/libwpcap.a when searching for -lwpcap
/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lwpcap
collect2: error: ld returned 1 exit status

As an alternative to libpcap for Windows (and therefore also for Cygwin) you can use:

  • WinPCAP – popular software, but no longer developed and maintained
  • Npcap – based on WinPCAP and is actively developing at the present time

To compile programs that require the libpcap library, you need source files, WinPCAP or Npcap headers.

The WinPCAP header files are in the Developer's Pack, and the Npcap header files can be found in the Npcap SDK.

WinPCAP for Cygwin

Follow the steps below to install WinPCAP headers in Cygwin.

Go to https://www.winpcap.org/devel.htm and download the developer pack.

Unpack the downloaded archive.

Copy the libraries:

  • WpdPack\Lib\libpacket.a in cygwin\lib\
  • WpdPack\Lib\libwpcap.a in cygwin\lib\

Copy headers from WpdPack\Include to cygwin\usr\include\.

Make sure you have the Winpcap libraries installed and that they are available in the PATH by running the commands:

which Packet.dll
which wpcap.dll

They should be in /cygdrive/c/WINDOWS/system32/.

Npcap for Cygwin

Go to https://nmap.org/npcap/ and download the Npcap SDK.

Unpack the downloaded archive.

Copy headers from Include to cygwin\usr\include\.

Make sure you have the Npcap libraries installed and that they are available in the PATH by running the commands:

which Packet.dll
which wpcap.dll

They should be in /cygdrive/c/WINDOWS/system32/.

How to manage services on Windows

What are services

Services are a kind of programs that run in the background and do not require user input.

Services can either be specific to the Windows operating system or be third-party applications. Examples of services that the user can install himself: web server, VNC remote desktop server, SSH server, MySQL server.

You can manage services:

  • in the graphical interface
  • in command line
  • in PowerShell

Configuring services in the GUI

To open the service manager, search for “Services” and press Enter:

Another way to open this window is to press Win+r and enter:

services.msc

Here, in the Name column, you will see a list of the services running on your system, along with their Description. You will also be able to see their Status – whether they are running or stopped, as well as Startup Type and Log On As.

Windows service startup types

Windows 10 offers the following startup types:

  • Automatic
  • Automatic (Delayed Start)
  • Manual
  • Manual (Trigger Start)
  • Disabled

Start, stop, disable Windows services

To start, stop, pause, resume, or restart any Windows service, select the service and right-click it. You will be presented with these options.

If you want to manage additional options, double-click the Service to open its properties window.

Here, in the Startup Type drop-down menu, you will be able to select the startup type for the Service.

In the Service Status section, you will see the Start, Stop, Pause, Resume buttons.

In the Properties window, you will also see other tabs, such as Log On, Recovery, and Dependencies, which offer additional options and information.

After making the changes, you will need to click “Apply” button.

Managing Services Using the Command Line

You can also use command prompt to start, stop, pause, resume service. To use the console, open a Command Prompt or PowerShell with administrator rights and run one of the following commands.

To start the service:

net start SERVICE

For example, to start the mysql service:

net start mysql

To stop the service:

net stop SERVICE

For example, to stop the mysql service:

net stop mysql

To pause a service (not all services can be paused!):

net pause SERVICE

To resume the service:

net continue SERVICE

To disable autostart of a service:

sc config "SERVICE_NAME" start=disabled

For example, to disable subsequent starts of the mysql service:

sc config "mysql" start=disabled

To enable autostart of the service:

sc config "SERVICE_NAME" start=auto

For example, to enable autostart of the mysql service:

sc config "mysql" start=auto

Enumerating the states of active services and drivers

sc query

Enumerating Win32 Services Only

sc query type=service

To view the status of a specific service:

sc query SERVICE_NAME

For example, to see the status of an Apache2.4 service:

sc query Apache2.4

Managing Windows Services with PowerShell

PowerShell is Microsoft's task automation and configuration management framework. In this section, we will walk you through how to manage Windows services through PowerShell, as it is much faster and more efficient than other methods.

As you probably know, one of the most important parts of every operating system is the service that runs through it, and in general, it can be said that every part of the operating system that starts has a specific service that can be controlled and monitored.

Here's a comprehensive guide to using PowerShell to manage Windows services.

Launch PowerShell Terminal as Administrator. To do this, press Win+x and select Windows PowerShell (Admin):

First, you should get a list of available services using the following command:

Get-Service

This is the sample output you will receive.

In the default output, you will see 3 main sections: Status, Name and DisplayName. Now, if you want to find and list a specific service, you can filter out any of the parameters.

Examples

Show all services with names starting with wi:

Get-Service -Name wi*

Show all services whose display names start with win:

Get-Service -DisplayName win*

Note: if you want to access another computer over the network, you can view the list of services for that system using this command:

Get-Service -ComputerName SERVER1

An important part of service management is the management of dependent services.

To access the list of DependentServices for a specific service, we can use the following command:

Get-Service -Name SERVICE_NAME -DependentServices

For example:

Get-Service -Name WSearch -DependentServices

You can also use the RequiredServices parameter to get a list of service prerequisites.

Get-Service -Name SERVICE_NAME -RequiredServices

For example:

Get-Service -Name WSearch -RequiredServices

So with the commands above, we can find the name of the service you want, see the status and associated services or their dependencies. Now let's look at the commands for managing services.

To stop the service using PowerShell, you can use the following command:

Stop-Service -Name SERVICE_NAME

For example:

Stop-Service -Name Apache2.4

The following examples will be shown on the Apache2.4 service. That is, in the following commands, replace “Apache2.4” with the name of the service you are interested in.

To start a service in PowerShell, you can use this command:

Start-Service -Name Apache2.4

One of the most commonly used commands for working with services is the restart service command. The structure of the service restart command is as follows:

Restart-Service -Name Apache2.4

Finally, the following command is used to temporarily suspend a service.

Suspend-Service -Name Apache2.4

To change the startup mode of the service, use a command of the form:

Set-Service -Name SERVICE_NAME -StartupType START_TYPE

The START_TYPE can be:

  • Automatic – the service will be started or was started by the operating system at system startup. If an auto-start service depends on a manually-started service, the manually-started service also starts automatically at system startup.
  • AutomaticDelayedStart – Runs shortly after the system boots.
  • Disabled – the service is disabled and cannot be started by the user or application.
  • InvalidValue – Has no effect. The cmdlet does not return an error, but the StartupType of the service is not changed.
  • Manual – the service is started only manually, by the user, using the service control manager or application.

These are the most commonly used commands for managing services in PowerShell. For more information on PowerShell commands and how they work, use the Get-Help command.

For example:

Get-Help *-Service
Get-Help New-Service

Configuring Apache Web Server to Run Perl Programs on Windows

Perl scripts can be run in the Apache environment in the same way as PHP scripts. To do this, you need to make a small setting.

I installed the web server according to this instruction, if you installed according to a different instruction, then edit the paths to suit your values.

1. Installing Perl on Windows

Download Perl for Windows from https://www.activestate.com/products/activeperl/downloads/

Run the downloaded .exe file – installation can be done with default options.

2. Configuring Apache to run Perl CGI

Now open the httpd.conf file for editing, I have it located along the path C:\Server\bin\Apache24\conf\httpd.conf.

Find the line there

Options Indexes FollowSymLinks

and add ExecCGI to it. You should get the following line (ATTENTION: you may have a different set of options):

Options Indexes FollowSymLinks ExecCGI

Now find the line:

#AddHandler cgi-script .cgi

Uncomment it, that is, remove the # at the beginning of the line and add .pl to the end of the line. The new line will look something like this:

AddHandler cgi-script .cgi .pl

3. Restart Apache

c:\Server\bin\Apache24\bin\httpd.exe -k restart

4. Run the Perl CGI test page

In the folder for your sites (mine is C:\Server\data\htdocs\) create a file test.pl and copy into it:

#!C:\Perl64\bin\perl.exe
print "Content-type: text/html; charset=iso-8859-1\n\n";
print "<phtml>";
print "<body>";
print "Test Page";
print "</body>";
print "</html>";

Pay attention to the line #!C:\Perl64\bin\perl.exe – if you have a different path to the perl.exe file, then edit the line accordingly.

Open this page in a web browser: http://localhost/test.pl

The inscription should appear

Test Page

As shown in the screenshot below:

How to install John the Ripper and Johnny on Windows with GPU support

John the Ripper is a password cracking program that can brute-force passwords for many types of files: archives, office documents, can crack network protocol hashes, and much more.

John the Ripper is a command line utility, so using it requires command line skills and knowledge of John the Ripper options.

Johnny is a graphical interface for John the Ripper that makes it easy to use the popular password cracker.

John the Ripper is portable; to install it, just unpack the downloaded archive with this program. Johnny is also a portable program distributed in an installer file. Johnny requires John the Ripper to work, which means both programs need to be installed.

The installation of these programs is simple, but John can only use the CPU to brute force the password, but it cannot use the GPU. Cracking a password on a video card is many times faster than on a central processor, so I would like to add support for a graphics card, especially since it is possible.

This tutorial will show you how to install John the Ripper and Johnny on Windows so that you can crack passwords on your video card.

How to install John the Ripper on Windows with GPU support (OpenCL)

Install Cygwin first – just go to the official website https://www.cygwin.com/, download the setup-x86_64.exe file and install.

Download the winX64_1_JtR.7z file from https://github.com/openwall/john-packages/releases/tag/jumbo-dev.

Unzip the contents of this archive into the C:\cygwin64\home\<USERNAME> folder, for example, my username is MiAl, so I unpack it to C:\cygwin64\home\MiAl\. Please note that you need to create a folder and copy files into it on behalf of a regular user, because during its work John the Ripper will try to write data to a .pot file in the same folder where the program is running. If you copied the JtR folder in the file manager with elevated rights, then this folder will belong to the Administrator and it is impossible to write anything into it or change the rights to it.

Now in the folder C:\cygwin64\home\<USERNAME>\JtR\run\ find cygOpenCL-1.dll file and rename it to cygOpenCL-1.dll.bac.

Then in the c:\Windows\System32 folder find the OpenCL.dll file and copy it to the C:\cygwin64\home\<USERNAME>\JtR\run\ folder.

Then, in the C:\cygwin64\home\<USERNAME>\JtR\run\ folder, rename the OpenCL.dll file to cygOpenCL-1.dll.

Then the same procedure must be repeated for the file in the C:\cygwin64\bin\ folder. That is, in the C:\cygwin64\bin\ folder, find cygOpenCL-1.dll and rename it to cygOpenCL-1.dll.bac. Then find the OpenCL.dll file in the c:\Windows\System32 folder and copy it to the C:\cygwin64\bin\ folder. Finally, in the C:\cygwin64\bin\ folder, rename the OpenCL.dll file to cygOpenCL-1.dll.

So that you understand why we are doing all this, take a look at the cracking speed on the central processor:

And on the speed of hacking on the video card, which became available thanks to the actions shown above with the substitution of files:

Open Cygwin console to execute commands.

Run test:

~/JtR/run/john --test=0

Run your system benchmark:

~/JtR/run/john --test

How to install Johnny on Windows with GPU support (OpenCL)

Open Cygwin – we'll be compiling Johnny from source.

Install apt-cyg:

curl https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg
install apt-cyg /bin

See also: apt-cyg – apt for Cygwin

Install dependencies:

apt-cyg install gcc-g++ git libQt5Core-devel make libQt5Gui-devel libGL-devel xorg-server xinit

Download the source code and compile the program:

git clone https://github.com/shinnok/johnny && cd johnny
export QT_SELECT=qt5
qmake-qt5 && make -j$(nproc)

By default the X server is not running in Cygwin, start Cygwin/X:

startxwin &

Press Enter to see the command line prompt.

Let's set the value of the DISPLAY variable:

export DISPLAY=:0.0

You can now start Johnny:

./johnny

Start Johnny, go to the Settings tab and point to the john.exe executable, for example /home/MiAl/john/run/john.exe.

The following screenshot is taken in Windows after successfully cracking password using Johnny and the video card.

Look for instructions for use on the pages-cards of these programs:

Redirect to HTTPS not working in WordPress

This is not an obvious problem, because for some pages the redirect to HTTPS works, but for some it does not. I ran into this problem on WordPress quite by accident. Therefore, if you are a webmaster with WordPress sites, then I would recommend that you check your sites too.

Redirecting from HTTP to HTTPS is quite simple, you need to add the following lines to the .htaccess file:

RewriteEngine on
RewriteCond %{HTTPS} !on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI}

This is how I redirect to HTTPS on most of my sites.

To test the redirect to HTTPS, it is advisable to look at the HTTP response headers, since web browsers tend to open the site over HTTPS even if you explicitly specified the HTTP protocol in the URL, at least I noticed this with pages already opened over HTTPS.

In Linux, the response HTTP headers can be viewed with a command of the form (it will show both the headers and the response body):

curl -v 'URL'

And this command will show only headers:

curl -I 'URL'

If you run Windows, then you can use an online service to display HTTP headers.

We enter the site address http://site.ru/

Received HTTP redirect code:

HTTP/1.1 302 Found

We were redirected to the HTTPS version:

Location: https://site.ru/

Is everything working as it should?

We continue to check. We enter the site address http://site.ru/page-on-site

And… we get the code 200, that is, the page would be shown to us at the specified address, without redirecting to HTTPS.

This behavior can be observed on sites with beautiful (sometimes referred to as SEO) page URLs. In WordPress, this can be selected in Control Panel → Settings → Permalinks. Examples:

 Day and name	https://suay.site/2021/05/21/sample-post/
 Month and name	https://suay.site/2021/05/sample-post/
 Numeric	https://suay.site/archives/123
 Post name	https://suay.site/sample-post/

The point is that in order for any of these options to work, WordPress adds the following lines to the .htaccess file:

# BEGIN WordPress
# Директивы (строки) между `BEGIN WordPress` и `END WordPress`
# созданы автоматически и подлежат изменению только через фильтры WordPress.
# Сделанные вручную изменения между этими маркерами будут перезаписаны.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

These lines contain conditions and a rule for mod_rewrite with the [L] flag, which means that the check should be aborted according to the mod_rewrite rules. As a result, the HTTP to HTTPS redirect rule does not reach the queue.

That is, the redirect lines must be placed before the fragment that is generated by WordPress. Let's try:

Found
The document has moved here.

Additionally, a 302 Found error was encountered while trying to use an ErrorDocument to handle the request.

The situation has changed but has not improved.

It is necessary to add the [L] flag to the rewrite rule, and place these rules in the .htaccess file before the fragment from WordPress:

RewriteEngine on
RewriteCond %{HTTPS} !on
RewriteCond %{REQUEST_URI} !^/.well-known/
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L]

# BEGIN WordPress
# Директивы (строки) между `BEGIN WordPress` и `END WordPress`
# созданы автоматически и подлежат изменению только через фильтры WordPress.
# Сделанные вручную изменения между этими маркерами будут перезаписаны.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

After that, everything will work exactly as you expect. All URLs, both the Front Page and other posts, starting with http:// will be redirected to https://

By default, the code will be “302 Moved Temporarily”. If you wish, you can select the code “301 Moved Permanently”:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Loading...
X