Skip to main content

How To Share Files between Windows and Linux Over Network | Samba

 




No matter how good you are at CTF Challenges, you may not know how to edit a text file in Powershell. In reality, I don’t not a good score in Windows CTF challenges but these days I am learning more about windows. it is another matter that I can’t run Linux in this new Laptop. I mean, I can but with Virtualization.

PowerShell is a task automation and configuration management framework from Microsoft, consisting of a command-line shell and the associated scripting language. PowerShell supports aliases to refer to commands by alternate names. Aliasing allows users with experience in other shells to use common command names that they already know for similar operations in PowerShell. basically, it means that you can use cd command instead of Set-Locationcd will be read as Set-Location by the Powershell. Powershell scripting is mostly related to PHP and Linux shell scripting. all you have to learn new is cmdlets.

We are going to use two methods to edit a text file in Powershell. Both of the methods are going to be super simple. you won’t need to read or watch anything else but this article.

POWERSHELL

The first method we are going to look at is WSL. WLS stands for Windows subsystem for Linux. Windows Subsystem for Linux is a compatibility layer for running Linux binary executables natively on Windows 10 and Windows Server 2019. but this method won’t help you during a CTF. because WSL doesn’t come pre-installed in Windows. You will need to install it through Microsoft Store.

Screenshot:


You can install Ubuntu Linux, Kali Linux and many more Linux systems into your Windows10. once you have it installed, run it easily with a command prompt or any other terminal.

Screenshot:

As you know me, I am a Kali lover. so, I installed Kali. Now you can run nano command while you are in Kali’s terminal. if you want to edit a file which is a file of windows, you can find the file in the /mnt directory. you will find all of your windows drive there.

Screenshot:

you can find your files there. but that might be frustrating, right? well, you can use the nano command without going into the Kali Linux shell. To do that you can use this command:

bash -c 'nano demo.txt'

Screenshot:

 

 

The next method we are going to use is Powershell cmdlets. we will use cmdlets in Powershell and edit a text file. so, open up your Powershell window. use this command to see all the files in the current folder:

Get-ChildItem

Screenshot:

 

 

 

Now, you choose the file to edit. there are basically two commands that you can use to edit a file. The first one is Set-Content or you can use its alias sc. it can be used when you want to overwrite a file with your given values. it will remove all the content of the file and then it will write your string value in that file.  But To add string, type this command:

Add-Content -Path .\demo.txt -value "`n Nice And Easy"

Screenshot:

 

-Path is to specify the path of the text file and -Value is the string value that you want to insert into the text file. And another important thing to notice here is that I have used `n to add a new line before adding the string to a file. you can use Set-Content too in your case.

 

 

Thanks For Visiting.

Comments

Popular posts from this blog

What is Bug Bounty in Cyber Security 2022?

Task 1 | What is Penetration Testing? Before teaching you the technical hands-on aspects of ethical hacking, you'll need to understand more about what a penetration tester's job responsibilities are and what processes are followed in performing pentests (finding vulnerabilities in a client's application or system).   The importance and relevancy of cybersecurity are ever-increasing and can be in every walk of life. News headlines fill our screens, reporting yet another hack or data leak.   Cybersecurity is relevant to all people in the modern world, including a strong password policy to protect your emails or to businesses and other organizations needing to protect both devices and data from damages.   A Penetration test or pentest is an ethically-driven attempt to test and analyze the security defenses to protect these assets and pieces of information. A penetration test involves using the same tools, techniques, and methodologies that someone with malicio...

WHAT IS SESSION HIJACKING?

  What is Session Hijacking? A session is the period of time when you as a user are actively accessing an application, website, or other online service. Each user session begins when you log into a website or app and ends when you log out of it. For example, when you type your username and password into a banking application, that begins your session on that online application. When you log into an online application, for example, amzon.com, their server typically generates a temporary session cookie in your browser. This cookie tells your browser that you are logged in and have been authenticated on the server by Amazon. Each temporary session cookie is marked by a unique session ID, or key. If a hacker is able to access your unique session ID, they can access your session. Let us take the example of Facebook. For example, when you log into Facebook, a session begins. This allows you to keep using Facebook (even if you close and reopen the web browser) until you click on ‘log out’...