Search This Blog

Saturday, May 27, 2023

Telnet: A quick overview

Overview

Telnet is a tool for administrating servers remotely. The name stands for Teletype Network and was invented pre-internet. As a consequence it is also an unencrypted way of communicating with a server. It should therefore not be used over the internet as the traffic may be intercepted, for example using Wireshark. 

Apart from servers it can also talk to other equipment such as network switches and routers. If the equipment is old, it might only be able to use Telnet instead of the encrypted tool called SSH (Secure Shell).

It is a command line tool that you can run on Windows, Mac and Linux which communicates bidirectionally. 

From a technical point of view it is a client/server type of protocol. The terminal captures keystrokes, the client converts it to a universal language that then goes through the TCP/IP protocol and through a network virtual terminal which sets a mutual standard for both machines.

It then goes through the TCP/IP stack on the receiving server side, the Telnet server converts/reverses the universal language to a language that the receiving system understands. The pseudoterminal then executes the commands and runs the applications.

Activating and deactivating Telnet Client

On a Windows machine you can activate it by going to the control panel, then select programs and features, then press "turn Windows features on or off".


Another way of activating Telnet is by using an elevated PowerShell prompt.

You can run the following commands to either activate or deactivate Telnet.

Enable-WindowsOptionalFeature -Online -FeatureName TelnetClient

Disable-WindowsOptionalFeature -Online -FeatureName TelnetClient


Using Telnet commands

If you write telnet followed by a target address followed by a space and a port number, you will use a different Telnet version. It can look like this if you try to connect to your local gateway:

telnet 192.168.0.1 23 

If you get stuck on "Connecting to 192.168.0.1..." it means that the port is closed and that Telnet won't work. Use the escape key to cancel. On a US keyboard it is Ctrl + ], on a Swedish keyboard your Telnet escape key is Ctrl + ¨.

Use telnet /? to open some the related help text.

You might experience lag when sending the commands, this is because the keystrokes has to travel back and forth over the network once you are connected via Telnet.


If only you write Telnet, you will instead open the Microsoft Telnet context.

To open a connection:
o google.com 443

To close a connection:
c google.com 443

To quit the Telnet context that you opened, simply use the command quit.

For more commands check the Microsoft page.

Summary

Telnet is an old and insecure way of communicating with servers, routers and switches. It is a text based tool run in the command prompt or PowerShell. Use SSH as a better alternative unless you work with legacy equipment that only can handle Telnet. Telnet is and should be disabled by default unless you have reasons to keep it active.


Thursday, May 18, 2023

ChatGPT: Making YouTube videos

A while back ago I wrote a blogpost in which I laid out a structure for a five part series of YouTube videos that I choose to call PowerShell for Beginners. 

These videos have now been published and looking back at the experience I wanted to write a few lines about it.

First of all, the plan was to set a goal that I knew was possible to reach. One series containing five videos was reasonable and achievable. I also didn't want to let AI do all the creative work so to speak, I still wanted to record a voiceover, create slides and write the manuscript myself.

Instead I let ChatGPT create the topics for each video, with only the content keywords that I then could build manuscripts around.

The process of creating the first video was slow since I was unused to it and was figuring out the way. At the end when I had figured and polished my workflow it looked something like this:

1. Read the chapter guidelines to find out what it needs to encapsulate.

2. Divide the content into chapters while creating the manuscript, so that it is clear what slide contains what information. Make sure to include an intro and an outro text.

3. Create slides using PowerPoint, boiling down the text from the manuscript. Also a chance to make final corrections in the manuscript text as you step through it. Export each slide as a .PNG. At this stage I had created a simple PowerPoint theme to easily reuse the colors and fonts that I like.

4. Record voiceovers, one recording per slide, by reading from the manuscript and make sure it matches the slides. Make any final corrections if you notice any errors. By having one recording per slide you get the chance to rerecord any faulty files without having to redo everything.

5. Using OpenShot video editor I added the images and the sound recordings. Then after some editing I exported it as a video .

6. Upload to YouTube Studio and use the right settings for your content.

Sunday, May 7, 2023

VPN: Adding Proton VPN to Windows manually

The basics of VPN

The idea behind a VPN (Virtual Private Network) is partly to connect computers over a virtual network, in a business setting it could mean that you can access your company resources from outside the dedicated network. While you are at home or when traveling for example.

Today VPN:s are also sold to the average user as a magical defense against the cyber dark arts, but it's not entirely true. While it redirects your traffic and also encrypts data, it's not a one size fits all solution. Alternatives such as HTTPS will also encrypt your traffic and browsers like TOR (The Onion Router) redirects your connection through different nodes three times so that you become anonymized.

When you use a VPN you also entrust your information to another company than your Internet Service Provider (ISP).

The benefit of a VPN is that you can control what country you appear to browse the internet from. It can for example make you appear as an Italian user, thus allowing you to browse material restricted to Italy. Such as media sites and news websites. The downside is that some VPN:s messes your search experience up, putting you through annoying recaptchas. 

This post is not intending to guide you to a choice of VPN or to recommend one over the other. The simple fact is that I'm using Proton VPN when I need to use a VPN and I'm reasonably happy using their service and I trust them enough. All that aside, this is a guide on how to use Windows 11:s built-in VPN service by setting up a connection to a Proton VPN server. For a beginner I would simply recommend their downloadable app, it's available for Mac, PC and Linux. I even think I got it working on my Raspberry Pi 4 (Kali Linux).

Setting up a connection to a Proton VPN server manually in Windows 11

1. You need to create an account on the Proton VPN website if you aren't already registered. Then continue by login into the dashboard.


2. Take note of your login credentials if you need them again, if you are going to download their app you will need it to log in there as well.


3. When you are logged into their website go to https://account.protonvpn.com/account

At this page, make sure to copy your OpenVPN/IKEv2 username and password. These aren't the same as you use to log into the website/VPN app.


4. You are also going to copy a specific server address for the country/server that you want to use.

Go to https://account.protonvpn.com/downloads and scroll down to OpenVPN configuration files.

Pick a country and server, press the arrow key next to download to get the server address.

It can look like this for a Japanese server: jp-free-11.protonvpn.net



5. At this stage you have prepared your login details and a server address of your choice.

Time to install drivers.

Go to https://protonvpn.com/download/ProtonVPN_ike_root.der and download the certificate.

Open the file and click install certificate

Choose local machine and next

Choose to place all certificates in the following store, navigate and select the folder "Trusted Root Certification Authorities" and continue

Make sure that the installation is finished.


6. Now it's time to create a VPN connection in Windows.

Navigate to Settings -> Network & internet -> VPN. You can go there with PowerShell "start-process ms-settings:network-vpn" or by doing run "ms-settings:network-vpn".

Click "Add VPN"



Fill in the following:

VPN provider = Windows (built-in)

Connection name = Choose a suitable name for the connection

Server name or address = The server address you got from Proton VPN website, see step 4.

VPN type = IKEv2

Type of sign-in info = Username and password

Username = IKEv2 username, see step 3

Password = IKEv2 password, see step 3


7. Your connection should show up in the list. 

Test it out directly to see if you get any errors.


Fixing policy match error with Proton VPN

1. If you get a policy match error you can fix it in the registry

2. Create a .reg file with the following text:

Windows Registry Editor Version 5.00


[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\RasMan\Parameters]

"NegotiateDH2048_AES256"=dword:00000002


3. Run the .reg file when you have created it 

4. Try connecting your VPN again

5. Confirm that your IP has changed by visiting a "what is my IP" site for example