How to Use Cygwin to Run Linux Apps on Windows
You'll see a lot of Linux action going down here at Null Byte. We use Linux for hacking-related stuff because it provides a more relaxed programming environment, making it easy to write exploits and tools. Linux has many features Windows is lacking, such as full control over the OS right down to the Kernel and massive availability of mature, open source (read: free & tweakable) tools & projects.
So Windows users might be wondering, "How do I use Linux applications & commands on Windows?", whether it be because you don't want to install a Virtual Machine, or simply because you don't know how to use Linux.
Cygnus Solution has a tool that can remedy this issue, called Cygwin. Cygwin uses its own DLL (Dynamic Link Library), which acts as a Linux API. It does not emulate Linux. It is a compatibility-layer (Linux-users, think Wine). You have to compile all of the Linux apps from source, no pre-compiled packages.
In this Null Byte, I'm going to show you how to install, and run a demonstration program in Cygwin.
Step 1 Download and Install Cygwin
- Download Cygwin from the official website.
- Double-click the setup.exe file from where you saved it (likely, Downloads).
- Click on "Install from Internet".
- Install Cygwin for your user only, unless you plan on everyone using it.
- Hit "Next" until you get to the part with the mirror selection (this selects what server you wish to download Cygwin packages from).
- For the sake of things working the same, you can use my mirror, as in this image below, but the choice probably doesn't matter.
- Wait for install to complete.
You should be at the package installation screen now. If you look at the word "All" at the top, to the right of it you will see "Default". By clicking on that you will see: "Default", "Update", "Install", and "Uninstall". The setup.exe acts not only as an installer for Cygwin, but a package manager and updater as well. With this, you can control all of Cygwin, and its install software. If you don't want anything in these packages, just install the "Default" method- it only installs the minimum packages to allow Cygwin to run.
Simply hit "Next >" a few more times to install the base-packages.
By now you should be all installed and ready to go. Just navigate through the Start-menu to find Cygwin and run it.
Step 2 Using Cygwin and Installing Packages
Now, I'm going to go over how to use a few basic commands, and install a package from source in Cygwin.
You can navigate the terminal, just as you would in Linux. You have access to "cd" "cat" "gcc" and all of the other commands, just like a normal Linux rig.
To get a feel for the terminal, I'm going to just install Eggdrop, an IRC bot, to show you how a normal install goes. Linux uses different compression archives than Windows (.zip, .7z, .rar).
- Download Eggdrop source code (tar.gz).
- Move the source into C:\cygwin\home\Owner.
- Switch back to your Cygwin terminal and type "ls". You should see your package listed as a sub file/directory.
- To extract the package type:
tar -zxvf eggdrop1.6.20.tar.gz
- After the text is done scrolling, change to the Eggdrop directory with this command:
- Now we have to "compile" the code into code the computer can understand (binary executable):
./configure && make && make install
- Now the program should be installed and run-able!
Now you shouldn't feel left out when it comes to Linux applications, because you can run them, too. I hope this was an informative Null Byte. Come visit the Forums and chat!