Day 11,12,13 Notes of 75 Days Ethical Hacking Course by Cybersecurityghost
Day 11,12,13 Notes of 75 Days Ethical Hacking Course by Cybersecurityghost
DAY 11 OF 75 DAYS
ETHICAL H4CKING
COURSE
Processes
Processes are the programs that are running on your machine. They are managed by the kernel, where each process will have an ID associated with it, also known as its PID. The PIDincrements for the order In which
the process starts. I.e. the 60th process will have a PIDof 60.
Viewing Processes
We can use the friendly ps command to provide a list of the running processes as our user's session and some additional information such as its status code, the session that is running it, how much usage time of the
CPUit is using, and the name of the actual program or command that is being executed:
Note how in the screenshot above, the second process ps has a PIDof 204, and then in the command below it, this is then incremented to 205.
To see the processes run by other users and those that don't run from a session (i.e. system processes), we need to provide aux to the ps command like so: ps aux
Note we can see a total of 5 processes -- note how we now have "root" and "cmnatic"
Another very useful command is the top command; top gives you real-time statistics about the processes running on your system instead of a one-time view. These statistics will refresh every 10 seconds, but will also
refresh when you use the arrow keys to browse the various rows. Another great command to gain insight into your system is via the top command
Managing Processes
You can send signals that terminate processes; there are a variety of types of signals that correlate to exactly how "cleanly" the process is dealt with by the kernel. To kill a command, we can use the appropriately
named kill command and the associated PID that we wish to kill. i.e., to kill PID 1337, we'd use kill 1337.
Below are some of the signals that we can send to a process when it is killed:
• SIGTERM - Kill the process, but allow it to do some cleanup tasks beforehand
• SIGKILL - Kill the process - doesn't do any cleanup after the fact
• SIGSTOP - Stop/suspend a process
Let's start off by talking about namespaces. The Operating System (OS) uses namespaces to ultimately split up the resources available on the computer to (such as CPU, RAMand priority) processes. Think of it as
splitting your computer up into slices -- similar to a cake. Processes within that slice will have access to a certain amount of computing power, however, it will be a small portion of what is actually available to every
process overall.
Namespaces are great for security as it is a way of isolating processes from another -- only those that are in the same namespace will be able to see each other.
We previously talked about how PID works, and this is where it comes into play.
The process with an ID of 0 is a process that is started when the system boots. This process is the system's init on Ubuntu, such as systemd, which is used to provide a way of managing a user's processes and sits in
between the operating system and the user.
introduction Page 1
Namespaces are great for security as it is a way of isolating processes from another -- only those that are in the same namespace will be able to see each other.
We previously talked about how PID works, and this is where it comes into play.
The process with an ID of 0 is a process that is started when the system boots. This process is the system's init on Ubuntu, such as systemd, which is used to provide a way of managing a user's processes and sits in
between the operating system and the user.
For example, once a system boots and it initialises, systemd is one of the first processes that are started. Any program or piece of software that we want to start will start as what's known as a child process of
systemd. This means that it is controlled by systemd, but will run as its own process (although sharing the resources from systemd) to make it easier for us to identify and the likes.
Some applications can be started on the boot of the system that we own. For example, web servers, database servers or file transfer servers. This software is often critical and is often told to start
during the boot-up of the system by administrators.
In this example, we're going to be telling the apache web server to be starting apache manually and then telling the system to launch apache2 on boot.
Enter the use of systemctl -- this command allows us to interact with the systemd process/daemon. Continuing on with our example, systemctl is an easy to use command that takes the following formatting: systemctl
[option] [service]
For example, to tell apache to start up, we'll use systemctl start apache2. Seems simple enough, right? Same with if we wanted to stop apache, we'd just replace the [option] with stop (instead of start like we
provided)
We can do four options with systemctl:
• Start
• Stop
• Enable
• Disable
\\
introduction Page 2
These services and logs are a great way in monitoring the health of your system and protecting it. Not only that, but the logs for services such as a web server contain information about every single request - allowing
developers or administrators to diagnose performance issues or investigate an intruder's activity. For example, the two types of log files below that are of interest:
• access log
• error log
There are, of course, logs that store information about how the OSis running itself and actions that are performed by users, such as authentication attempts.
introduction Page 3
introduction Page 4
Day 12 network security
27 April 2024 21:31
Day 12 of
75 days Ethical
Hacking Course
Network Scanning - Discovering systems on the network (can be hosts, switches, servers, routers, firewalls and so on) and looking at what ports are open as well as
applications/services and their respective versions that may be running.
Connection-Oriented Communication - TCP packets require a connection due to the size of the data being transmitted and to ensure deliverability(in wireless
networks)
Scanning Methodology
• Check for live systems - Ping or other type of way to determine live hosts
• Check for open ports - Once you know live host IPs, scan them for listening ports
• Scan beyond IDS - If needed, use methods to scan beyond the detection systems; evade IDS using proxies, spoofing, fragmented packets and so on(means
bypassing their farewall etc whoever is stopping us to scan that system)
• Perform banner grabbing - Grab from servers as well as perform OS fingerprinting (versions of the running services(means running apps and os)
• Scan for vulnerabilities - Use tools to look at the vulnerabilities of open systems
• Draw network diagrams - Shows logical and physical pathways into networks
• Use proxies - Obscures efforts to keep you hidden
• Pentest Report - Document everything that you find
Identifying Targets
• It has it's shortcomings and is sometimes blocked on hosts that are actually live.
namp
• The hacker above sends an ACK segment/packet on the first interaction (without three-way handshake).
○ If server returns no response means that might have a stateful firewall handling proper sessions
○ If server returns RST packet means that have no stateful firewall
Nmap
➢ For scanning any ip address or domain name
Nmap ip addrr(192.168.84.129)
Nmap domain name(howshorts.com)
➢ If you want to do random scan means jitni bhi internet p machine on h sbka scan karega or open ports batayega illegal h y
➢ If you want to do random scan means jitni bhi internet p machine on h sbka scan karega or open ports batayega illegal h y
➢ Nmap -iR 100(you can write the maxhines number you want now I want just 100 machines should be scanned)
➢ If know the service name only and don’t rember port numver then you scan by writing service name see
➢ Namp -p telnet 192.168.43.129
Why we use this, suppose we a wide network and in that network there 1000-2000 systems and they have their firewall and ids and ips etc
So will use t5 insane scan its offers highest speed means it can scans in just no time but there some disadvantge of it sometimes shows us incorrect result because the firewall and ids and ips device will detect frm
where this much req are coming in no time then we use T0 Paranoid it’s a slow scan and it dcrease the speed of flags however now a days technology can detect this too but in some cases this works
• Paranoid
○ Paranoid (0) Intrusion Detection System evasion
○ nmap <target> -T0
• Sneaky
○ Sneaky (1) Intrusion Detection System evasion
○ nmap <target> -T1
• Polite
○ Polite (2) slows down the scan to use less bandwidth and use less target machine resources
○ nmap <target> -T2
• Normal
○ Normal (3) which is default speed(what ever scans we do in nmap that’s is T3 So wedont need to set this)
○ nmap <target> -T3
• Agressive
○ Aggressive (4) speeds scans; assumes you are on a reasonably fast and reliable network
○ nmap <target> -T4
• Insane
○ Insane (5) speeds scan; assumes you are on an extraordinarily fast network
○ nmap <target> -T5
List of Switches
Switch Description
-sA ACK scan
-sF FIN scan
-sI IDLE scan(firewall se bachne ke liye humara ip address nhi jayega)
-sL DNS scan (list scan)
-sN NULL scan(y hume anonymous rakhta h achha output deta ha)
-sO Protocol scan (tests which IP protocols respond)
-sP or -sn Ping scan
1. Passive Reconnaissance
2. Active Reconnaissance
In passive reconnaissance, you rely on publicly available knowledge.
Active reconnaissance, on the other hand, cannot be achieved so discreetly. It requires direct engagement with the target. Th ink of it like you check the locks on the doors and windows, among other potential entry points.
Who is
WHOIS is a request and response protocol that follows the RFC3912 specification. A WHOIS server listens on TCPport 43 for incoming requests. The domain registrar is responsible for maintaining the WHOIS r ecords for the
domain names it is leasing. The WHOIS server replies with various information related to the domain requested. Of particular interest, we can learn:
NSLOOKUP
Find the IP address of a domain name using nslookup, which stands for Name Server Look Up. You need to issue the command nslo okup DOMAIN_NAME,
DNSDumpster
DNSlookup tools, such as nslookup and dig, cannot find subdomains on their own. The domain you are inspecting might include a different subdomain that can reveal much information about the targe
SHODAN/CENSYS
ACTIVE
• If it is saying host seems down means there is firewall active then
• Nmap -p 21( port number you want to scan) 192.168.84.129 -Pn ( it will scan port not the host and will tell us the host it up but it will show port filttered then we will use wire sha rk to determaine wheather its
open and close
• We will use half or stealth scan through linux
• Nmap -sS -p 21 172.20.10.2
• Then we will go to wire shark and after that is we are getting syn -ack packet from another machine then the port is open
• And if we getting rst flag then the port is closed and if we are getting nothing then the there is firewall on on the system that is block our requests and there can be ips and ids device too
Spoofing
It fw r ’t w tt r rt t r tw f t r t r spoofing number 3rd
• Decoy:
○ nmap -Pn -D <spoofed IP> <target> (we can send packets from multiple ip addr)
○ There are two methods
○ 1] we will use RND means it will send packet from random ip from internet suppose if we want to send packet from 4 random ip then we use RND:4 AND IF we want send from 20 then RND:20 > nmap -sS -D RND:4 192.168.84.129
○ 2] WE will use custom ip addr it will profit us like there are many device connect with one system (10.10.0.1) then can send packet from its own ip means we can create custom ip see > nmap -sS -D 10.10.0.2,10.10.0.3,10.10.0.9
192.168.84.129
▪ This will perform a spoofed ping scan.
• Source Address Spoofing:
○ nmap -e <network interface> -S <IP source> <target>
▪ Example --> nmap -e eth0 -S 10.0.0.140 10.0.0.165
• MAC Address Spoofing:(In this case we actually hav three options
• 1] we can write 0 and it will generate random mac addr
• Nmap --spoof-mac 0 -p 21( or your choice) 192.168.46.129
• 2] we can write our own mac addr
• Nmap --spoof-mac mac addr here 192.168.43.129
• 3] we can write company name so it will make addr itself
• Nmap --spoof-mac dell -p 24 192.168.84.131
3. OS Detection
-A nmap -A 192.168.1.1 Enables OS detection, version detection, script scanning, and traceroute(litterally is tells everything avout the target)