Tryhackme:CC: PenTesting(PART-2)

A crash course on various topics in penetration testing

[Section 4 — Hash Cracking]: hashcat:

hashcat is another one of the most popular hash cracking tools. It is renowned for its versatility and speed. Hashcat does not have auto detection for hashtypes, instead it has modes. For example if you were trying to crack an md5 hash the “mode” would be 0, while if you were trying to crack a sha1 hash, the mode would be 100.

A full list of all modes can be found here.

1.What flag sets the mode.


2.What flag sets the “attack mode”


3.What is the attack mode number for Brute-force


4.What is the mode number for SHA3–512


5.Crack This Hash


Type: MD5

#command:hashcat -a 3 -m 0 md5.hash ?a?a?a?a?a


6.Crack this hash:


Type: MD4

#command:hashcat -a 0 -m 900 md4.hash rockyou.txt


[Section 4 — Hash Cracking]: John The Ripper:

John The Ripper(jtr) is one of the best hash cracking tools available. It supports numerous formats of hashes and is extremely easy to use, while having a lot of options for customization.

Note: There are multiple variations of jtr out there. For this task the version that comes pre-installed on kali will be used

Note 2: All hashes can be cracked with rockyou.txt

1.What flag let’s you specify which wordlist to use?

A: — wordlist

2.What flag lets you specify which hash format(Ex: MD5,SHA1 etc.) to use?

A: — format

3.How do you specify which rule to use?

A: — rules

4.Crack this hash:


Type: MD5

command:sudo john — format=RAW-MD5 — wordlist=rockyou.txt md5.txt , john — format=RAW-MD5 md5.txt


5.Crack this hash:


Type: SHA1

command:sudo john — format=RAW-SHA1 — wordlist=rockyou.txt md5.txt , john — format=RAW-SHA1 md5.txt


[Section 5 — SQL Injection]: Intro:

SQL injection is the art of modifying a SQL query so you can get access to the target’s database. This technique is often used to get user’s data such as passwords, emails etc. SQL injection is one of the most common web vulnerabilities, and as such, it is highly worth checking for

Section 5 — SQL Injection]: sqlmap:

Sqlmap is arguably the most popular automated SQL injection tool out there. It checks for various types of injections, and has plenty of customization options.

1.How do you specify which url to check?


2.What about which google dork to use?


3.How do you select(lol) which parameter to use?(Example: in the url the parameter would be test.)


4.What flag sets which database is in the target host’s backend?(Example: If the flag is set to mysql then sqlmap will only test mysql injections).

A: — dbms

5.How do you select the level of depth sqlmap should use(Higher = more accurate and more tests in general).

A: — level

6.How do you dump the table entries of the database?

A: — dump

7.Which flag sets which db to enumerate?

(Case sensitive)


8.Which flag sets which table to enumerate?

(Case sensitive)


9.Which flag sets which column to enumerate?

(Case sensitive)


10.How do you ask sqlmap to try to get an interactive os-shell?

A: — os-shell

11.What flag dumps all data from every table

A: — dump-all

Section 5 — SQL Injection]: A Note on Manual SQL Injection:

Occasionally you will be unable to use sqlmap. This can be for a variety of reasons, such as a the target has set up a firewall or a request limit. In this case it is worth knowing how to do basic manual SQL Injection, if only to confirm that there is SQL Injection. A list of ways to check for SQL Injection can be found here.

Note: As there are various ways to check for sql injection, and it would be difficult to properly convey how to test for sqli given each situation, there will be no questions for this task.

[Section 5 — SQL Injection]: Vulnerable Web Application:

To demonstrate how to use sqlmap to check for vulnerabilities and dump table data, I will be walking you through an example web app. Deploy the machine and let’s get started!

Note: This task will be using sqlmap, however you are welcome to try to exploit it manually. It outputs the full SQL query on every attempt, so you can know what mysql is trying to do!

command:sqlmap -u <target-ip> — forms — level=1 — dbs

1.Set the url to the machine ip, and run the command

A:no answer need

2.How many types of sqli is the site vulnerable to?


3.Dump the database.

A:no answer need

4.What is the name of the database?


5.How many tables are in the database?


6.What is the value of the flag?


[Section 6 — Samba]: Intro:

Most of the pentesting techniques and tools you’ve seen so far can be used on both Windows and Linux. However, one of the things you’ll find most often when pen testing Windows machines is samba, and it is worth making a section dedicated to enumerating it.

Note: Samba is cross platform as well, however this section will primarily be focused on Windows enumeration; some of the techniques you see here still apply to Linux as well.

[Section 6 — Samba]: smbmap:

Continuing with the trend of tools having “map” in the name being extremely popular, smbmap is one of the best ways to enumerate samba. smbmap allows pen-testers to run commands(given proper permissions), download and upload files, and overall is just incredibly useful for smb enumeration.

1.How do you set the username to authenticate with?


2.What about the password?


3.How do you set the host?


4.What flag runs a command on the server(assuming you have permissions that is)?


5.How do you specify the share to enumerate?


6.How do you set which domain to enumerate?


7.What flag downloads a file?

A: — download

8.What about uploading one?

A: — upload

9.Given the username “admin”, the password “password”, and the ip “”, how would you run ipconfig on that machine

A:smbmap -u “admin” -p “password” -H -x “ipconfig”

[Section 6 — Samba]: smbclient:

smbclient allows you to do most of the things you can do with smbmap, and it also offers you and interactive prompt.

1.How do you specify which domain(workgroup) to use when connecting to the host?


2.How do you specify the ip address of the host?


3.How do you run the command “ipconfig” on the target machine?

A:-c “ipconfig”

4.How do you specify the username to authenticate with?


5.How do you specify the password to authenticate with?


6.What flag is set to tell smbclient to not use a password?


7.While in the interactive prompt, how would you download the file test, assuming it was in the current directory?

A:get test

8.In the interactive prompt, how would you upload your /etc/hosts file

A:put /etc/hosts

[Section 6 — Samba]: A note about impacket:

impacket is a collection of extremely useful windows scripts. It is worth mentioning here, as it has many scripts available that use samba to enumerate and even gain shell access to windows machines. All scripts can be found here.

Note: impacket has scripts that use other protocols and services besides samba.

[Miscellaneous]: A note on privilege escalation:

privilege escalation is such a large topic that it would be impossible to do it proper justice in this type of room. However, it is a necessary topic that must be covered, so rather than making a task with questions, I shall provide you all with some resources.

General: (A bunch of tools and payloads for every stage of pentesting)

Linux: (a bit old but still worth looking at) (One of the most popular priv esc scripts) (Another popular script) (A Script that’s dedicated to searching for kernel exploits) (I can not overstate the usefulness of this for priv esc, if a common binary has special permissions, you can use this site to see how to get root perms with it.)

Windows: (Dictates some very useful commands and methods to enumerate the host and gain intel) (A bit old but still an incredibly useful script) (A general enumeration script)

[Section 7 — Final Exam]: Good Luck :D:

Throughout this course, you have learned many tactics and tools to pentesting. This is where it all gets put to the test, I have put together a beginner level ctf, that contains 2 flags. Good luck and have fun

1.What is the user.txt


2.What is the root.txt


please everyone join my telegram channel :

please everyone join my youtube channel :

Change the world

happy hacking……….

CTF-PLAYER, security analyst, Pentesting, vapt, digital forensics