Thursday, December 28, 2023

LVM Partition.

After installing a new SSD or hard disk, you need to partition it first. A drive requires at least one partition to format it and store files on it. Linux offers several tools for creating partitions, with fdisk being the most popular one. fdisk is a command-line utility that provides a menu-driven interface for creating and modifying partition tables on a hard disk. fdisk is a powerful tool that requires careful usage. Only users with root or sudo privileges can access and alter the partition tables.

List Partitions:
To display the partition table and partitions of a device, use the fdisk command with the -l option and the device name. For example, to show the /dev/sda partition table and partitions, run:
Command: fdisk /dev/sda.
If no device is specified as an argument, fdisk will show the partition tables of all devices in the /proc/partitions file.
Command: fdisk -l.
FIGURE-1
The above output displays the partition tables of all devices connected to your system. SATA device names usually have the format /dev/sd[a-z], while NVMe device names have the format /dev/nvme[1-9]n[1-9].

Creating Partition Table:
To partition the drive, use fdisk with the device name. For example, to work on /dev/sda, run:
Command: fdisk /dev/sda.
The command prompt will change to the fdisk dialogue, where you can enter commands.
fdisk (util-linux 2.34) started.
Changes are not written to disk until confirmed.
Use the write command with caution.
Enter command (m for help):
The partition table changes are not applied until confirmed with the w command. To quit the fdisk dialogue without saving the changes, use the q command.
To see all the command, enter m.
FIGURE:2
I selected 'n' to create a new partition and 'p' to make it a primary partition type. I set the partition number and the first and last sector of the partition. It displayed the new partition type as Linux. If the LVM had a signature, I chose 'y' to remove it.
FIGURE-3
I entered 't' to change the partition type and 'L' to list all the Hex codes. I chose '8e' for Linux LVM.
FIGURE-4
I confirmed the partition type change by entering 'w'. This wrote the table to disk and exited fdisk.
FIGURE-5
I listed the block devices using the 'lsblk' command. It displayed the sda2 partition that I created in the previous steps.
FIGURE-6

Create Physical Volume:
To create physical volumes on the newly partitioned disks, use the 'pvcreate' command.
Command: pvcreate /dev/sdb1.
To view information about the physical volumes on the system, use the 'pvdisplay' command. Optionally, specify a volume to see its details.
Command: pvdisplay.
FIGURE-7
Creating a Virtual Group:
Create a volume group named vol1 that contains the /dev/sda1 partition as a physical volume. Use the following command:
Command: vgcreate vol1 /dev/sda1
To display information about the volume groups, use the vgdisplay command.
Command: vgdisplay.
FIGURE-8

Create Logical Volume:
Now we can move on to create logical volumes. It may help to think of our virtual group as a "big cake," from which we can cut "pieces" (logical volumes) that will get treated as partitions on our Linux system.
The following command will create a logical volume named vol1 with a size of 1Gb.
FIGURE-9
Use the 'lvdisplay' command to display the created logical volumes.
FIGURE-10
The 'vgdisplay' command shows that the volume group vol1 has 1GB of free space left.
FIGURE-11

Create a filesystem on Logical volume:
The logical volume is almost ready to use. All we need to do is to create a filesystem on it with the 'mkfs' command.
Command: mkfs.ext4 /dev/vol1/LV1.
FIGURE-12

Mount Logical volume:
Before using the new volumes, create a mount point and mount the volumes to it. Then, use the 'lsblk' command to verify the mount status of the directory.
Command: mount /dev/vol1/LV1 /path of the directory.
FIGURE-13

Removing a Logical Volume:
To remove logical volumes using the 'lvremove' command, ensure that the volumes are unmounted and deactivated, and that no critical data is stored on them.
Command: lvremove /dev/vol1/LV1.
Now removing the mount point by using 'umount' command as shown below.
Command: umount /dev/vol1/LV1 /home/dir. 
FIGURE-14

Delete Partition:
Before deleting a partition, back up your data. All data is automatically deleted when a partition is deleted.
To delete partition, run the 'd' command in the fdisk command-line utility.
The partition is automatically selected if there are no other partitions on the disk. If the disk contains multiple partitions, select a partition by typing its number.
The terminal prints out a message confirming that the partition is deleted. Then run the 'w' command to write and save changes made to the disk.
Command: fdisk /dev/sda.
FIGURE-15










Thursday, December 7, 2023

Data Recovery.

How to Recover Data from Windows OS using EaseUS Data Recovery Wizard Tool.


EaseUS Data Recovery Wizard is a powerful PC data recovery software that enables you to easily recover data from a laptop, regardless of the cause of data loss, such as accidental deletion, formatting, virus attack, etc.
FIGURE-1: EaseUs Data Recovery Wizard.
EaseUS Data Recovery Wizard is a software that recovers deleted or lost files from your computer by scanning the unused data sectors. It is a reliable and fast Windows data recovery software that supports various data loss scenarios, such as accidental deletion, formatting, virus attack, etc. It can recover data from PC, laptop, server, digital devices, and storage media. You can download it for free from [their website] and choose from three recovery modes: Deleted File Recovery, Complete Recovery, and Partition Recovery.
FIGURE-2: Data.
I have created some files and folders in my Drive (E).
FIGURE-3: Deleting permanently.
I am about to permanently delete this date and subsequently recover it using the EaseUS Date Recovery Wizard tool.
FIGURE-4: Start EaseUS Recovery.
When you initiate EaseUS Data Recovery Wizard by double-clicking on it, the software will commence and display a notification. In order to proceed, it is necessary to click on the affirmative option "Yes".
FIGURE-5: Select Types of lost files.
After selecting "Yes," the following page will be displayed. Here, we are required to choose the file types we intend to recover using the EaseUS Data Recovery Wizard software. This remarkable software enables us to recover a variety of file formats such as images, documents, emails, audio files, videos, and archives. In my case, I will be selecting all file types to ensure comprehensive recovery. Once the desired file types are selected, we can proceed by clicking on the "Next" button.
FIGURE-6: Select location.
In order to proceed, we must designate a specific location from which to initiate the search for intentionally or accidentally deleted data. Once the location has been determined, click on the "scan" function to commence the process.
FIGURE-7: Recover deleted data.
Now, all of the deleted data will be displayed. If you are unable to see your deleted data, you can opt for the Deep Scan option. However, since our deleted data is already visible, we can proceed by selecting the relevant data and clicking on the recover button to restore the deleted information.
FIGURE-8: Browse the path.
To proceed, please designate the desired recovery directory and click "OK."
FIGURE-9: Data Recovered. 
I am pleased to inform you that the recovery process for our previously deleted data has been completed successfully. By diligently examining the path, we have confirmed its restoration.
















Tuesday, December 5, 2023

How to use Proxy Chaining in Kali Linux.

Proxychains is a Linux-based tool that enables anonymous and secure web browsing using various proxy protocols, such as socks4, socks5, HTTP, and https. Although proxychains is easy to set up, it may cause some errors for some users. For instance, some users may face issues with tor installation or DNS leaks. To prevent these errors, users need to follow certain steps to configure proxychains properly.

How to setup Proxychains?

The first step to set up our proxychain is to update and upgrade our Linux machine.
Command: sudo apt-get update && apt-get upgrade


FIGURE-1: Updating and Upgrading Linux.
To setup proxychains you need to setup the tor service in your machine, most of the time the service is preinstalled. To check if there is tor service available or not just use this command.
Command: service tor status

FIGURE-2: Tor service status.
If you get any error after using "service tor status" command, then it means tor service is not available in your operating system, to install tor service use the following command.
Command: sudo apt-get install

FIGURE-3: Installing Tor service.
Since I have already installed tor service, you may have to modify some settings to run proxychains smoothly. If you face any error during this process, please check the steps provided later in this article. Once you have installed tor service, the next step is to install configure proxychains. You can use this command to install that.
Command: sudo apt-get install proxychains

FIGURE-4: Installing proxychains.
You have the option to select any editor that you like. For this example, we are using nano, but there are other alternatives such as vim, gedit, leafpad, or sublime.
Command: nano /etc/proxychains.conf

FIGURE-5: Using nano text editor.

FIGURE-6: Using nano for editing.
The configuration file has “#” symbols, which mark comments in bash language. To edit the file, you can use the arrow keys to navigate and make these changes:

1- Remove the “#” symbol from the line that says `dynamic_chain`.
2- Add the “#” symbol to the lines that say `strict_chain` and `random_chain`.
3- Remove the “#” symbol from the line that says `proxy_dns`.
4- Append the line `socks5 127.0.0.1 9050` to the proxy list.

FIGURE-7: nano Editor.

FIGURE-8: Editing socks5 using nano.
After saving the `proxychains.conf` configuration file, you need to open the `proxychains4.conf` file, which is located in the /etc directory. You can use this command to do so:
Command: nano /etc/proxychains4.conf

You have the option to select any editor that you like. For this example, we are using nano, but there are other alternatives such as vim, gedit, leafpad, or sublime.

FIGURE-9: Editing proxychains4.conf file.

FIGURE-10: Using nano for editing.
The configuration file has “#” symbols, which mark comments in bash language. To edit the file, you can use the arrow keys to navigate and make these changes:

1- Remove the “#” symbol from the line that says `dynamic_chain`.
2- Add the “#” symbol to the lines that say `strict_chain` and `random_chain`.
3- Remove the “#” symbol from the line that says `proxy_dns`.
4- Append the line `socks5 127.0.0.1 9050` to the proxy list.


FIGURE-11: nano Editor.

FIGURE-12: nano editor.
After saving the configuration file, you can exit the terminal and finish the proxychains setup. The next step is to restart the tor service.
I have initiated the Tor service by executing the command `service tor start`. To verify that the Tor service is running, I have used the command `service tor status`.
Command: service tor restart
Command: service tor status

FIGURE-13: Tor service.
The following commands will launch `Firefox` and load `www.bing.com`. The commands should run without any errors and Bing should load successfully. Please close all Firefox tabs before executing the commands.
Command: proxychain firefox www.bing.com

FIGURE-14: Start proxychains.


FIGURE-15: Bing open.
As you can see, after executing the proxychains command. Now, let's perform a DNS leak test by searching for "DNS leak test" and opening any website that offers this service.

FIGURE-16: DNS leak test.
As you can see, my location has changed from India to New York, United States and the proxychains tool dynamically changes my IP address to provide better anonymity.







DC1 VULNHUB.

DC-1 Penetration Testing Lab Overview. Objective: Gain experience in penetration testing through a purposely built vulnerable lab. Target Au...