Setting Up A Hack Focused Linux System: ZNNK ZNNK
Setting Up A Hack Focused Linux System: ZNNK ZNNK
Setting Up A Hack Focused Linux System: ZNNK ZNNK
[HACK+OS]
Setting up a hack focused Linux system
xmpp: znnk@xabber.de
email: znnk@tuta.io
www.znnk.gq
[Hack+OS] 2
INDEX
SETUP
I Making a Live USB 3
II Booting into Lubuntu 4
III Installing Lubuntu 5
IV Securing your Host 6
Software
V John the Ripper 7
VI Nmap 8
Vii CHKROOTKIT 13
VII WireShark 14
VIII AirCrack-NG 15
IX HYDRA 22
X Metasploit Framework 23
[Hack+OS] 3
1. Open Rufus with elevated privileges, by default it’ll appear blank until you
connect a USB stick.
2. Now connect your USB to your computer, the fields in Rufus should populate
and this indicates that Rufus is ready for an ISO.
3. Select the highlighted icon as shown below and browse to the Lubuntu ISO
you downloaded earlier. If the ISO you have selected is too large for your USB
stick you will get the error “The image is too big for the selected target”.
4. If your USB has enough capacity for the ISO then Rufus will proceed to tell you
that any data or partitions on the USB will be destroyed. This is permanent.
Backup anything from the USB that you might want to keep and when you’re
ready, push OK.
Rufus may give you some additional warnings about necessary files for download, if it
does, allow Rufus to download them and it will proceed to install Lubuntu to your USB.
Once Rufus has finished and says “READY” again, you are done and your USB contains
a bootable Lubuntu operating system.
[Hack+OS] 4
3. Lubuntu will now boot. You’ll see a lot of text and if this is your first time seeing
a Linux system, do not panic, this is normal. Leave your computer to boot until
you are logged into the test Lubuntu account. If you’re not logged in and instead
see a black and white menu: Choose your language, ensure that “Try Lubuntu
without Installing” is selected and hit Enter.
[Hack+OS] 5
INSTALLING LUBUNTU
If you’ve had enough playing around with the USB trial of Lubuntu, you should proceed
to installing it to your HDD.
1. There is an icon on your desktop where you can start the installation. On the
first screen, select your language and hit Continue.
2. On this screen, if you choose to Download updates and Install the third party
software, your installation process will take considerably longer (depending on
your internet connection). However, you should install all updates anyway and
there is no reason why you should not do so now. Select your options and
continue.
3. On the third screen you will be presented with a few options. Please read very
carefully before proceeding as not correctly following procedure may result in
permanent loss of data.
VERY IMPORTANT: If you are going to hit Install Now while you are on the above screen, you are
going to install Lubuntu's Boot Loader (GRUB2) to the MBR of your HDD which is sda. By performing
this action, you are overwriting your MBR (sda) and all its contents. This may lead to some un-
bootable systems, other systems which are installed in your machine. If you have a machine that
has multiple disks and you want to install a bootloader to an internal disk other than sda please
select something else but be careful not to install the bootloader on you usb drive as then you will
be unable to boot once you take the usb drive out.
Please be advised that you can leave everything as it's like the above screen (install
Lubuntu's Boot Loader to the MBR of your HDD) ONLY if you want Lubuntu to take care of
the whole booting process in your machine.
4. When Prompted, click your country of residence on the map and type in the
name of your City and click Continue.
5. When Prompted, select your keyboard layout and click Continue.
6. On this page you are presented with the opportunity to create an alias for
yourself. I advise that you make one now and do not tie this alias to yourself in
any way at all. Do not post it anywhere. Do your absolute best to keep it between
yourself and fellow hackers. The purpose of an alias is to mask the identity of the
holder. It’d be redundant if you were to post it everywhere! Fill in the details on
this page, ensuring that the data is unique.
7. If you are given the chance to import accounts, don’t. Just skip to the next step.
8. Now let the slideshow run through. Even though it looks like it’s doing nothing,
Lubuntu is installing. All you have to do now is wait!
9. As soon as the sideshow closes, reboot your computer. Lubuntu should now be
installed on your HDD.
[Hack+OS] 6
You should only need to do this if you chose not to update while installing earlier
in the guide. However, it can’t hurt to do it again.
sudoedit /etc/fstab
By default, the shared memory space (/run/shm) is mounted read/write, with the
ability to execute programs. This has been noted in the security community as
vulnerable, with many exploits available where “/run/shm” is used while attacking
running services.
1. Installation
Installing John the Ripper on Lubuntu is very simple. Execute the following
command in a terminal.
2. Tutorial
/usr/sbin/john --test
Now, let's create a text file in password format (<user>:<hash>) with a valid
hash, of course, and get John to work. You can simply copy a user from
/etc/shadow, but we recommend something simpler, because we presume you
want to see the results as fast as you can. So create a file named password.txt
somewhere inside your /home and put this in it:
myuser:AZ1.zWwxIh15Q
/usr/sbin/john password.txt
Nmap
Nmap ("Network Mapper") is a free and open source (license) utility for network
discovery and security auditing. Many systems and network administrators also find it
useful for tasks such as network inventory, managing service upgrade schedules, and
monitoring host or service uptime.
1. Installation
2. Basic use
First of all, you’ll want to scan your target for an operating system. To do so,
execute the following command in a terminal.
nmap -O target.host.com
Note that nmap requires root privileges to run this type of scan and may take a
minute or so. When it finishes, you’ll see something like this:
As you can see, Nmap provides a lot of data. Here it takes a guess at the
operating system that might be running on the system. I ran this particular scan
against an Apple Airport Extreme router. As an added bonus, Nmap tells me that
the device is one hop away, the MAC address of the device and manufacturer of
the NIC, the open ports, and how long the scan took.
Here's the result of another scan, against a desktop machine running Ubuntu
9.10:
3. Multiple Hosts
If you need to scan multiple hosts you can specify a range like 10.0.0.1-6 or a
range like 10.0.0.0/24. The 10.0.0.1-6 would scan hosts 10.0.0.1, 10.0.0.2,
10.0.0.3 through 10.0.0.6. Using the /24 notation would scan the whole range of
hosts from 10.0.0.0 to 10.0.0.255. For example, to scan 10.0.0.1 through
10.0.0.42 to learn what OS they might be running I'd use:
nmap -O 10.0.0.1-42
If you have hostnames instead of IP addresses, you can separate them with a
space on the command line, like so:
Here you can see that there are three ports open: 22, 80, and 3306 which run
SSH, HTTP, and MySQL respectively. Nmap recognizes six states: open, closed,
filtered, unfiltered, open|filtered, and closed|filtered. These are mostly self-
explanatory. See the Nmap docs for more on these states. If Nmap can tell what
service is running, it will report it under the SERVICE column.
If you'd like a little more information, crank it up a notch by adding one or two -v
options to the command. For example, using nmap -vv host.target.com would
produce something like this:
5. Service scans
If you're really curious about what services a host might be running, try the -sV
options. This will do a more aggressive scan to try to figure out what versions of
services are running on a given host, and also might help determine more
specifically what OS a host is running. For instance, I ran nmap -sV against a test
server and got this in response:
As you can see, Nmap can "fingerprint" the packets and identify the versions of
the software running on the SSH and HTTP ports. Here you can see that the
system being pinged is a Ubuntu box with Apache 2.2.8 and OpenSSH 4.7p1. This
can be useful for a number of reasons. A quick Nmap scan can identify systems
that are running unpatched systems and therefore ones that might be vulnerable
to known exploits.
6. What’s on My Network?
Not quite sure what might be running on your network? Try using nmap -sP,
which will run a ping scan on the specified network. For instance, nmap -sP
10.0.0.0/24 will scan the 256 hosts from 10.0.0.0 through 10.0.0.255 to see if
they're available, and report back. You can also use a range, such as nmap -sP
10.0.0.1-15.
[Hack+OS] 12
7. Zenmap
Finally, if all this command line fun is not your bag, Nmap has a GUI that you can
use to build and execute commands. Called Zenmap, the GUI will let you specify
targets, run scans, display the results and even save and compare them against
one another.
When you open Zenmap, you can give it a target to scan and select one of the
profile scans to get started. It includes your basic ping scan, quick scans, some
more intense scans that include UDP services, and so forth. The Zenmap GUI is a
good way to get acquainted with Nmap, but it's also a good idea to know how to
use Nmap from the command line if you're going to be working with it often.
In a future tutorial we'll take a more in-depth look at Nmap and specific tasks you
might want to do with Nmap. I hope this overview gave a good sense what Nmap
can do and helps you get started working with Nmap.
[Hack+OS] 13
CHKROOTKIT
chkrootkit is a tool to locally check for signs of a root kit. You should run it regularly.
1. Installation
Installing nmap on Lubuntu is very simple. Execute the following command in a
terminal.
2. BASIC TUTORIAL
To start looking for rootkits with chkrootkit, execute the following command in a
terminal:
sudo chkrootkit
To start looking for rootkits with chkrootkit, execute the following command in a
terminal:
You need to specify the path for the external commands used by chkrootkit such
as awk, grep and others. Mount /mnt/safe using nfs in read-only mode and
set /mnt/safe binaries PATH as a trusted one, enter:
WireShark
Wireshark is the world's foremost network protocol analyzer. It lets you see what's
happening on your network at a microscopic level. It is the de facto (and often de jure)
standard across many industries and educational institutions.
1. Installation
1. Open a terminal (Ctrl + Alt + t) and add the wireshark PPA to to your keyring:
You’ll be taken through a configuration process. The window will go blue and ask
you if super-users can capture packets. Highlight “<yes>” and push Enter.
Wireshark will now complete the installation automatically.
2. Capturing Packets
After downloading and installing Wireshark, you can launch it and click the name
of an interface under Interface List to start capturing packets on that interface.
For example, if you want to capture traffic on the wireless network, click your
wireless interface. You can configure advanced features by clicking Capture
Options, but this isn’t necessary for now.
As soon as you click the interface’s name, you’ll see the packets start to appear
in real time. Wireshark captures each packet sent to or from your system. If
you’re capturing on a wireless interface and have promiscuous mode enabled in
your capture options, you’ll also see other the other packets on the network.
Click the stop capture button near the top left corner of the window when you
want to stop capturing traffic.
[Hack+OS] 15
3. Color Coding
You’ll probably see packets highlighted in green, blue, and black. Wireshark uses
colors to help you identify the types of traffic at a glance. By default, green is TCP
traffic, dark blue is DNS traffic, light blue is UDP traffic, and black identifies TCP
packets with problems — for example, they could have been delivered out-of-
order.
4. Sample Captures
If there’s nothing interesting on your own network to inspect, Wireshark’s wiki has
you covered. The wiki contains a page of sample capture files that you can
load and inspect.
Opening a capture file is easy; just click Open on the main screen and browse for
a file. You can also save your own captures in Wireshark and open them later.
5. Filtering Packets
If you’re trying to inspect something specific, such as the traffic a program sends
when phoning home, it helps to close down all other applications using the
network so you can narrow down the traffic. Still, you’ll likely have a large amount
of packets to sift through. That’s where Wireshark’s filters come in.
The most basic way to apply a filter is by typing it into the filter box at the top of
the window and clicking Apply (or pressing Enter). For example, type “dns” and
you’ll see only DNS packets. When you start typing, Wireshark will help you auto-
complete your filter.
You can also click the Analyze menu and select Display Filters to create a new
filter.
Another interesting thing you can do is right-click a packet and select Follow TCP
Stream. You’ll see the full conversation between the client and the server. Close
the window and you’ll find a filter has been applied automatically — Wireshark is
showing you the packets that make up the conversation.
[Hack+OS] 16
6. Inspecting Packets
Click a packet to select it and you can dig down to view its details. You can also
create filters from here — just right-click one of the details and use the Apply as
Filter sub-menu to create a filter based on it.
7. Final Note
Wireshark is an extremely powerful tool, and this tutorial is just scratching the
surface of what you can do with it. Professionals use it to debug network protocol
implementations, examine security problems and inspect network protocol
internals.
[Hack+OS] 17
AIRCRACK-NG
Aircrack-ng is a network software suite consisting of a detector, packet sniffer, WEP
and WPA/WPA2-PSK cracker and analysis tool for 802.11 wireless LANs. It works with any
wireless network interface controller whose driver supports raw monitoring mode and
can sniff 802.11a, 802.11b and 802.11g traffic. The program runs under Linux, FreeBSD,
OS X, OpenBSD, and Windows; the Linux version is packaged for OpenWrt and has also
been ported to the Android, Zaurus and Maemo platforms; and a proof of concept port
has been made to the iPhone.
1. Installation
Installing aircrack-ng on Lubuntu is very simple. Execute the following command
in a terminal.
2. IWCONFIG
Before getting started, we must first ensure that your version of linux recognizes
your Wireless adapter. You can do so by executing the following command in a
terminal (Ctrl + Alt + t):
iwconfig
3. airmon-ng
The first tool we will look at and need in nearly ever WiFi hack is airmon-ng,
which converts our wireless card into a promiscuous mode wireless card. Yes, that
means that our wireless card will hookup with anyone!
Well, that's almost correct. When our network card is in promiscuous mode, it
means that it can see and receive all network traffic. Generally, network cards will
only receive packets intended for them (as determined by the MAC address of the
NIC), but with airmon-ng, it will receive all wireless traffic intended for us or not.
[Hack+OS] 18
We can start this tool by typing airmon-ng, the action (start/stop), and then the
interface (replace wlan1 with the name of your wireless adapter):
Airmon-ng responds with some key information on our wireless adapter including
the chipset and driver. Most importantly, note that it has changed the designation
for our wireless adapter from wlan1 to mon0.
4. airodump-ng
The next tool in the aircrack-ng suite that we will need is airodump-ng, which
enables us to capture packets of our specification. It's particularly useful in
password cracking.
We activate this tool by typing the airodump-ng command and the renamed
monitor interface (mon0):
Airodump-ng mon0
airodump-ng displays all of the APs (access points) within range with their BSSID
(MAC address), their power, the number of beacon frames, the number of data
packets, the channel, the speed, the encryption method, the type of cipher used,
the authentication method used, and finally, the ESSID.
For our purposes of hacking WiFi, the most important fields will be the BSSID and
the channel. Write these down somewhere.
5. aircrack-ng
Aircrack-ng is the primary application with the aircrack-ng suite, which is used
for password cracking. It's capable of using statistical techniques to crack WEP
and dictionary cracks for WPA and WPA2 after capturing the WPA handshake.
[Hack+OS] 19
6. aireplay-ng
The next tool in the aircrack-ng suite that we will need is airodump-ng, which
enables us to capture packets of our specification. It's particularly useful in
password cracking.
We activate this tool by typing the airodump-ng command and the renamed
monitor interface (mon0):
Airodump-ng mon0
The pcap file is the standard file type associated with packet capture tools like
libpcap and winpcap. If you've ever used Wireshark, you've most likely worked
with pcap files. The following screenshots are from aireplay-ng –help.
We can see in the screenshot above of the first half of the aireplay-ng help
screen, that aireplay can filter by the BSSID of the access point, the MAC address
of either source or destination, the minimum and maximum packet length, etc.
[Hack+OS] 20
If we scroll down the help screen, we can see some of the attack options using
aireplay-ng:
These include deauth, fake deauth, interactive, arpreplay (necessary for fast WEP
cracking), chopchop (a form of statistical technique for WEP packet decrypting
without cracking the password), fragment, caffe latte (attacking the client side),
and others.
These four tools in the aircrack-ng suite are our Wi-Fi hacking work horses. We'll
use each of these in nearly every Wi-Fi hack. Some of our more hack-specific tools
include airdecap-ng, airtun-ng, airolib-ng and airbase-ng. Let's take a brief look at
each of these.
7. airDecap-ng
Airdecap-ng enables us to decrypt wireless traffic once we have cracked the key.
In other words, once we have the key on the wireless access point, not only can
we use the bandwidth on the access point, but with airdecap-ng we can decrypt
everyone's traffic on the AP and watch everything they're doing (the key is used
for both access and for encryption).
[Hack+OS] 21
8. airTun-ng
Airtun-ng is a virtual tunnel interface creator. We can use airtun-ng to set up an
IDS on the wireless traffic to detect malicious or other traffic on the wireless
access point. So, if we're looking to get an alert of a particular type of traffic (see
my tutorial on creating a PRISM-like spy tool), we can use airtun-ng to set up a
virtual tunnel that connects to an IDS like Snort to send us alerts.
9. airolib-ng
Airolib-ng stores or manages ESSID's (the name of the access point) and
password lists that will help speed up WPA/WPA2 password cracking.
10. airbase-ng
Airbase-ng enables us to turn our laptop and wireless card into an AP. This can
be especially useful when doing a rogue access point or evil twin attacks.
Basically, airbase-ng allows us to attack the clients, rather than the AP, and
encourages the clients to associate with us rather than the real AP.
[Hack+OS] 22
HYDRA
When you need to brute force crack a remote authentication service, Hydra is often the
tool of choice. It can perform rapid dictionary attacks against more than 50 protocols,
including telnet, ftp, http, https, smb, several databases, and much more.
As Hydra 7.5 is in the Official Ubuntu Repository, It’s one line to install:
Hydra 8.0 is not in the Official Ubuntu Repository so you need to add the
Launchpad repository to your cache, and install it from there:
Metasploit frame.wk
Knowing the adversary's moves helps you better prepare your defenses. Metasploit,
backed by a community of 200,000 users and contributors, gives you that insight. It's
the most impactful penetration testing solution on the planet. With it, uncover
weaknesses in your defenses, focus on the highest risks, and improve your security
outcomes.
1. Installing MetaSploit
wget http://downloads.metasploit.com/data/releases/metasploit-
latest-linux-x64-installer.run
32bit
wget http://downloads.metasploit.com/data/releases/metasploit-
latest-linux-installer.run
64bit
chmod +x /path/to/metasploit-latest-linux-x64-installer.run
32bit
chmod +x /path/to/metasploit-latest-linux-installer.run
[Hack+OS] 24
sudo /path/to/metasploit-latest-linux-x64-installer.run
32bit
sudo /path/to/metasploit-latest-linux-installer.run
5. When the setup window appears, click Forward to start the installation process.
6. Accept the license agreement and click Forward.
7. Choose an installation folder and click Forward.
8. Select Yes to register Metasploit as a service (recommended). Click Forward to
continue.
9. When the Disable Anti-virus and Firewall window appears, verify that your
machine does not have anti-virus software or firewall applications running. When
done, click Forward.
10. Enter the port number that you want the Metasploit service to use. The
default port is 3790. After entering it, click Forward to continue.
11. Enter the server name that will be used to generate the SSL certificate. Also
enter the number of days that you want the SSL certificate to remain valid.
12. Click Forward to continue.
13. The Metasploit installation begins.
Once the installation is complete, a window appears and prompts you to launch
the Metasploit Web UI. Here, you should go to https://localhost:3790 to launch the
Metasploit Web UI to create a user account and to activate your Metasploit license
key.
[Hack+OS] 25
Sources
[+] Rufus [+] Lubuntu support
[+] TechRepublic [+] MakeTechEasier
[+] Linux BEginners [+] Cyberciti
[+] howtogeek [+] sourcedigit