soc-practicals 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,37 @@
1
+ Metadata-Version: 2.5
2
+ Name: soc-practicals
3
+ Version: 0.1.0
4
+ Summary: SOC (Security Operations Center) practical lab notes: encryption, traffic analysis, Snort, syslog, Splunk, ELK, Graylog.
5
+ License-Expression: MIT
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: Topic :: Education
8
+ Classifier: Topic :: Security
9
+ Requires-Python: >=3.8
10
+ Description-Content-Type: text/markdown
11
+
12
+ # soc-practicals
13
+
14
+ SOC (Security Operations Center) practical lab notes.
15
+
16
+ ## Install
17
+
18
+ pip install soc-practicals
19
+
20
+ ## Find the files
21
+
22
+ python -m soc_practicals
23
+
24
+ This prints the folder where the notes are installed. Open them with any text editor.
25
+
26
+ ## Contents
27
+
28
+ - Practical 1 – Encryption, Decryption and Hashing
29
+ - Practical 2 – Network Traffic Analysis and Attack Investigation
30
+ - Practical 3 – Snort, Firewall Rules, PCAP Analysis and DNS Traffic
31
+ - Practical 5 – Attack on a MySQL Database Using a PCAP File
32
+ - Practical 6 – Create Your Own Syslog Server
33
+ - Practical 7 – Configure Linux to Send Syslog Messages to a Syslog Server
34
+ - Practical 8 – Install and Run Splunk on Linux
35
+ - Practical 9 – Install and Configure ELK Stack on Linux
36
+ - Practical 10 – Install and Configure Graylog on Linux
37
+ - HTTPS and Windows System Exploration
@@ -0,0 +1,26 @@
1
+ # soc-practicals
2
+
3
+ SOC (Security Operations Center) practical lab notes.
4
+
5
+ ## Install
6
+
7
+ pip install soc-practicals
8
+
9
+ ## Find the files
10
+
11
+ python -m soc_practicals
12
+
13
+ This prints the folder where the notes are installed. Open them with any text editor.
14
+
15
+ ## Contents
16
+
17
+ - Practical 1 – Encryption, Decryption and Hashing
18
+ - Practical 2 – Network Traffic Analysis and Attack Investigation
19
+ - Practical 3 – Snort, Firewall Rules, PCAP Analysis and DNS Traffic
20
+ - Practical 5 – Attack on a MySQL Database Using a PCAP File
21
+ - Practical 6 – Create Your Own Syslog Server
22
+ - Practical 7 – Configure Linux to Send Syslog Messages to a Syslog Server
23
+ - Practical 8 – Install and Run Splunk on Linux
24
+ - Practical 9 – Install and Configure ELK Stack on Linux
25
+ - Practical 10 – Install and Configure Graylog on Linux
26
+ - HTTPS and Windows System Exploration
@@ -0,0 +1,19 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "soc-practicals"
7
+ version = "0.1.0"
8
+ description = "SOC (Security Operations Center) practical lab notes: encryption, traffic analysis, Snort, syslog, Splunk, ELK, Graylog."
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = "MIT"
12
+ classifiers = [
13
+ "Programming Language :: Python :: 3",
14
+ "Topic :: Security",
15
+ "Topic :: Education",
16
+ ]
17
+
18
+ [tool.hatch.build.targets.wheel]
19
+ packages = ["src/soc_practicals"]
@@ -0,0 +1,9 @@
1
+ """SOC practical lab notes, shipped as plain text files."""
2
+ from pathlib import Path
3
+
4
+ NOTES_DIR = Path(__file__).parent / "notes"
5
+
6
+
7
+ def files():
8
+ """Return the paths of all note files."""
9
+ return sorted(p for p in NOTES_DIR.iterdir() if p.is_file())
@@ -0,0 +1,5 @@
1
+ from soc_practicals import NOTES_DIR, files
2
+
3
+ print(f"Notes folder: {NOTES_DIR}\n")
4
+ for f in files():
5
+ print(" -", f.name)
@@ -0,0 +1,178 @@
1
+ Aim: To examine HTTP and HTTPS network traffic and explore Windows processes, threads, handles and registry entries.
2
+
3
+ Requirements:
4
+ - CyberOps Workstation VM
5
+ - Wireshark
6
+ - tcpdump
7
+ - Windows operating system
8
+ - Windows Sysinternals Suite
9
+ - Process Explorer
10
+
11
+
12
+ A. Using Wireshark to examine HTTP and HTTPS traffic
13
+ Part 1: Capture and view HTTP traffic
14
+
15
+ Step 1: Start the virtual machine
16
+
17
+ Start CyberOps Workstation VM.
18
+
19
+ Login:
20
+ Username: analyst
21
+ Password: cyberops
22
+
23
+ Step 2: Check network interfaces
24
+
25
+ Open Terminal:
26
+ ip address
27
+
28
+ Identify the active network interface. The manual uses enp0s3.
29
+
30
+ Step 3: Start packet capture using tcpdump
31
+ sudo tcpdump -i enp0s3 -s 0 -w httpdump.pcap
32
+
33
+ Enter the password when prompted.
34
+
35
+ Explanation:
36
+ - tcpdump captures network packets.
37
+ - -i enp0s3 selects the network interface.
38
+ - -s 0 captures complete packets.
39
+ - -w httpdump.pcap saves the capture into a file.
40
+ Step 4: Generate HTTP traffic
41
+ 1. Open the browser inside the VM.
42
+ 2. Visit:
43
+ http://www.altoromutual.com/login.jsp
44
+
45
+ 3. Enter the lab credentials specified in the manual:
46
+ Username: Admin
47
+ Password: Admin
48
+
49
+ 4. Click Login.
50
+ 5. Close the browser.
51
+ Step 5: Stop the packet capture
52
+
53
+ Return to Terminal and press:
54
+ Ctrl + C
55
+
56
+ Step 6: Examine the captured HTTP traffic
57
+ 1. Open the home directory.
58
+ 2. Open httpdump.pcap using Wireshark.
59
+ 3. Apply this filter:
60
+ http
61
+
62
+ 4. Locate a POST request.
63
+ 5. Expand:
64
+ HTML Form URL Encoded: application/x-www-form-urlencoded
65
+ You can observe the HTTP form data in the captured traffic.
66
+
67
+ Part 2: Capture and view HTTPS traffic
68
+
69
+ Step 7: Start another packet capture
70
+ sudo tcpdump -i enp0s3 -s 0 -w httpsdump.pcap
71
+
72
+ Step 8: Generate HTTPS traffic
73
+ 1. Open the browser.
74
+ 2. Visit:
75
+ https://www.netacad.com
76
+
77
+ 3. Click Login.
78
+ 4. Close the browser.
79
+ Step 9: Stop the capture
80
+
81
+ Press Ctrl + C in Terminal.
82
+
83
+ Step 10: Examine HTTPS traffic
84
+ 1. Open httpsdump.pcap in Wireshark.
85
+ 2. Apply this filter:
86
+ tcp.port==443
87
+
88
+ 3. Select a relevant packet.
89
+ 4. Expand the Encrypted Application Data section.
90
+ Expected observation:
91
+ - HTTP traffic can expose readable application data.
92
+ - HTTPS encrypts application data, making its contents unreadable in an ordinary packet capture.
93
+
94
+ ---------------------------------------------------------------------------------------------------------------
95
+
96
+ B. Exploring Processes, Threads, Handles and Windows Registry
97
+ Part 1: Exploring processes
98
+
99
+ Step 1: Download Windows Sysinternals Suite
100
+
101
+ Download it from the Microsoft Sysinternals website.
102
+
103
+ Extract the downloaded files.
104
+
105
+ Step 2: Open Process Explorer
106
+ 1. Open the extracted SysinternalsSuite folder.
107
+ 2. Run:
108
+ procexp.exe
109
+
110
+ 3. Accept the license agreement.
111
+ 4. Process Explorer displays currently running processes.
112
+ Step 3: Identify an active process
113
+ 1. Open a web browser.
114
+ 2. In Process Explorer, use the Find Window's Process icon.
115
+ 3. Drag the icon onto the browser window.
116
+ 4. Observe the highlighted browser process.
117
+ You can right-click the selected process and choose Kill Process in the lab exercise.
118
+
119
+ Step 4: Explore another process
120
+ 1. Open Command Prompt.
121
+ 2. Use the Find Window's Process icon on the Command Prompt window.
122
+ 3. Observe the highlighted process.
123
+ The manual identifies:
124
+ Process Meaning
125
+ cmd.exe Command Prompt process
126
+ explorer.exe Parent process
127
+ conhost.exe Child process
128
+
129
+
130
+ Run a ping command in Command Prompt and observe the process activity.
131
+
132
+ Part 2: Exploring threads and handles
133
+
134
+ Step 5: Examine threads
135
+ 1. In Process Explorer, right-click conhost.exe.
136
+ 2. Select Properties.
137
+ 3. Open the Threads tab.
138
+ 4. Examine the active threads.
139
+ Step 6: Examine handles
140
+ 1. In Process Explorer, select View.
141
+ 2. Select Lower Pane View.
142
+ 3. Choose Handles.
143
+ 4. Examine the handles associated with conhost.exe.
144
+ Part 3: Exploring Windows Registry
145
+
146
+ Step 7: Open Registry Editor
147
+
148
+ Press Start and search for:
149
+ regedit
150
+
151
+ Open Registry Editor and allow permission if prompted.
152
+
153
+ Step 8: Understand the five registry hives
154
+ Registry hive Purpose
155
+ HKEY_CLASSES_ROOT File associations and application classes
156
+ HKEY_CURRENT_USER Current user's settings
157
+ HKEY_LOCAL_MACHINE Local computer configuration
158
+ HKEY_USERS Settings of all users
159
+ HKEY_CURRENT_CONFIG Current hardware configuration
160
+
161
+
162
+ Step 9: Locate EulaAccepted
163
+
164
+ Navigate to:
165
+ HKEY_CURRENT_USER
166
+ \Software
167
+ \Sysinternals
168
+ \Process Explorer
169
+
170
+ Find the EulaAccepted registry value.
171
+
172
+ Step 10: Modify the registry value
173
+ 1. Double-click EulaAccepted.
174
+ 2. Observe its current value, which is 1.
175
+ 3. Change the value to 0.
176
+ 4. Click OK.
177
+ 5. Open Process Explorer again and observe the license agreement behavior.
178
+ Result: Successfully examined HTTP/HTTPS traffic, Windows processes, threads, handles and registry settings.
@@ -0,0 +1,139 @@
1
+ Aim: To perform encryption, decryption and hashing of files using ZIP tools and OpenSSL.
2
+
3
+ Requirements:
4
+ - CyberOps Workstation VM
5
+ - Linux Terminal
6
+ - ZIP utility
7
+ - fcrackzip
8
+ - OpenSSL
9
+ A. Encrypting and decrypting data using a ZIP tool
10
+
11
+ Step 1: Create a directory
12
+ mkdir first
13
+ cd first
14
+
15
+ - mkdir creates a directory.
16
+ - cd enters the directory.
17
+
18
+ Step 2: Create three sample files
19
+ echo "This is my first practical 1" > sample1.txt
20
+ echo "This is my first practical 2" > sample2.txt
21
+ echo "This is my first practical 3" > sample3.txt
22
+
23
+ The echo command writes text into files. The > symbol creates a file or overwrites its contents.
24
+
25
+ Step 3: Encrypt the files
26
+ zip -e file1.zip sample1.txt sample2.txt sample3.txt
27
+
28
+ Enter password:
29
+ g
30
+
31
+ Create another ZIP file:
32
+ zip -e file2.zip sample1.txt sample2.txt sample3.txt
33
+
34
+ Enter password:
35
+ w1
36
+
37
+ Step 4: Decrypt the ZIP file
38
+ unzip file1.zip
39
+
40
+ Enter password g when prompted.
41
+
42
+ Step 5: Crack the ZIP passwords using fcrackzip
43
+
44
+ First, view the help menu:
45
+ fcrackzip --help
46
+
47
+ Try cracking the first ZIP:
48
+ fcrackzip -vul 1-2 file1.zip
49
+
50
+ Try cracking the second ZIP:
51
+ fcrackzip -vul 1-2 file2.zip
52
+
53
+ Command explanation:
54
+ Option Meaning
55
+ -v Verbose mode
56
+ -u Test password by attempting to unzip
57
+ -l 1-2 Password length between 1 and 2 characters
58
+
59
+
60
+ Expected result:
61
+ - file1.zip → Password g
62
+ - file2.zip → Password w1
63
+ Use password-cracking tools only on your own lab files.
64
+
65
+ -------------------------------------------------------------------------------------------
66
+
67
+ B. Encrypting and decrypting data using OpenSSL
68
+ Step 1: Create a text file
69
+ echo "hello world" > text1.txt
70
+
71
+ Step 2: Encrypt the file
72
+ openssl aes-256-cbc -a -in text1.txt -out text2.txt
73
+
74
+ Enter and confirm a password.
75
+
76
+ Step 3: View encrypted content
77
+ cat text2.txt
78
+
79
+ You will see unreadable encrypted text.
80
+
81
+ Step 4: Decrypt the file
82
+ openssl aes-256-cbc -a -d -in text2.txt -out text3.txt
83
+
84
+ Enter the same password.
85
+
86
+ Step 5: View decrypted content
87
+ cat text3.txt
88
+
89
+ Expected output:
90
+ hello world
91
+
92
+ Step 6: Create and encrypt a custom file
93
+ nano letter_to_grandma.txt
94
+
95
+ Enter some text, then save using Ctrl + O, Enter and Ctrl + X.
96
+
97
+ Encrypt it:
98
+ openssl aes-256-cbc -a -in letter_to_grandma.txt -out msg.enc
99
+
100
+ Step 7: Decrypt the custom file
101
+ openssl aes-256-cbc -a -d -in msg.enc -out text4.txt
102
+
103
+ View the decrypted content:
104
+ cat text4.txt
105
+
106
+ Expected result: The contents of the original and decrypted files should match.
107
+
108
+ --------------------------------------------------------------------------------------------------
109
+
110
+ C. Hashing files using OpenSSL
111
+ Step 1: Create a text file
112
+ nano letter_to_grandma.txt
113
+
114
+ Enter some text and save it.
115
+
116
+ Step 2: Generate SHA-256 hash
117
+ openssl sha256 letter_to_grandma.txt
118
+
119
+ Step 3: Generate SHA-512 hash
120
+ openssl sha512 letter_to_grandma.txt
121
+
122
+ Copy both hash values.
123
+
124
+ Step 4: Modify the original file
125
+ nano letter_to_grandma.txt
126
+
127
+ Change a word, for example, change delicious to amazing.
128
+
129
+ Save the file.
130
+
131
+ Step 5: Generate hashes again
132
+ openssl sha256 letter_to_grandma.txt
133
+ openssl sha512 letter_to_grandma.txt
134
+
135
+ Step 6: Compare the hashes
136
+
137
+ The new hash values will be different from the original values because the file content has changed.
138
+
139
+ Result: Successfully performed ZIP encryption, OpenSSL encryption/decryption and SHA-256/SHA-512 hashing.
@@ -0,0 +1,192 @@
1
+ Aim: To install and configure Graylog on Linux for centralized log management, monitoring and analysis.
2
+
3
+ Requirements:
4
+ - Ubuntu Linux
5
+ - Internet connection
6
+ - Terminal
7
+ - Java
8
+ - MongoDB
9
+ - Elasticsearch
10
+ - Graylog Server
11
+ Step 1: Install prerequisites
12
+ Update the package repository:
13
+ sudo apt-get update
14
+
15
+
16
+ Install the required packages:
17
+ sudo apt-get install apt-transport-https openjdk-11-jre-headless uuid-runtime pwgen
18
+
19
+
20
+ These packages provide Java and utilities required by Graylog.
21
+ Step 2: Install MongoDB
22
+ sudo apt-get install mongodb-server
23
+
24
+
25
+ MongoDB is used by Graylog to store configuration and metadata.
26
+ Step 3: Install Elasticsearch
27
+ Add the Elasticsearch GPG key:
28
+ wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
29
+
30
+
31
+ Add the repository:
32
+ echo "deb https://artifacts.elastic.co/packages/oss-7.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-7.x.list
33
+
34
+
35
+ Update packages:
36
+ sudo apt-get update
37
+
38
+
39
+ Install Elasticsearch:
40
+ sudo apt-get install elasticsearch-oss
41
+
42
+
43
+ Step 4: Configure Elasticsearch
44
+ Open its configuration file:
45
+ sudo nano /etc/elasticsearch/elasticsearch.yml
46
+
47
+
48
+ Add the following settings:
49
+ cluster.name: graylog
50
+ action.auto_create_index: false
51
+
52
+
53
+ Save the file.
54
+ Step 5: Start Elasticsearch
55
+ Reload systemd:
56
+ sudo systemctl daemon-reload
57
+
58
+
59
+ Enable Elasticsearch:
60
+ sudo systemctl enable elasticsearch
61
+
62
+
63
+ Start Elasticsearch:
64
+ sudo systemctl start elasticsearch
65
+
66
+
67
+ Step 6: Install Graylog
68
+ Download the Graylog repository package:
69
+ wget https://packages.graylog2.org/repo/packages/graylog-4.3-repository_latest.deb
70
+
71
+
72
+ Install the repository:
73
+ sudo dpkg -i graylog-4.3-repository_latest.deb
74
+
75
+
76
+ Update the package list:
77
+ sudo apt-get update
78
+
79
+
80
+ Install Graylog Server:
81
+ sudo apt-get install graylog-server
82
+
83
+
84
+ Step 7: Generate Graylog password secret
85
+ Execute:
86
+ pwgen -N 1 -s 96
87
+
88
+
89
+ This generates a secure random password secret.
90
+
91
+ Copy the generated value.
92
+
93
+ Generate the administrator password hash:
94
+ echo -n "your_password" | sha256sum | cut -d" " -f1
95
+
96
+
97
+ Replace your_password with your desired administrator password.
98
+
99
+ Copy the generated hash.
100
+ Step 8: Configure Graylog
101
+ Open the configuration file:
102
+ sudo nano /etc/graylog/server/server.conf
103
+
104
+
105
+ Add or modify the following settings:
106
+ password_secret = YOUR_GENERATED_SECRET
107
+ root_password_sha2 = YOUR_GENERATED_HASH
108
+ http_bind_address = 0.0.0.0:9000
109
+
110
+
111
+ Replace the placeholders with your actual generated values.
112
+
113
+ Save the file.
114
+ Step 9: Start Graylog Server
115
+ Reload systemd:
116
+ sudo systemctl daemon-reload
117
+
118
+
119
+ Enable Graylog:
120
+ sudo systemctl enable graylog-server
121
+
122
+
123
+ Start Graylog:
124
+ sudo systemctl start graylog-server
125
+
126
+
127
+ Step 10: Check service status
128
+ Check Elasticsearch:
129
+ sudo systemctl status elasticsearch
130
+
131
+
132
+ Check MongoDB:
133
+ sudo systemctl status mongodb
134
+
135
+
136
+ Check Graylog:
137
+ sudo systemctl status graylog-server
138
+
139
+
140
+ Expected result: The services should be running successfully.
141
+ Step 11: Configure the firewall
142
+ If UFW is enabled, allow the required ports:
143
+ sudo ufw allow 9000/tcp
144
+
145
+
146
+ sudo ufw allow 12201/udp
147
+
148
+
149
+ sudo ufw allow 12201/tcp
150
+
151
+
152
+ Port explanation:
153
+ Port Purpose
154
+ 9000 Graylog web interface
155
+ 12201 UDP GELF UDP
156
+ 12201 TCP GELF TCP
157
+
158
+ Step 12: Access Graylog
159
+ Open a browser and visit:
160
+ http://YOUR_SERVER_IP:9000
161
+
162
+
163
+ Login:
164
+ Username: admin
165
+ Password: Your configured password
166
+
167
+
168
+ Expected result: Graylog web interface opens successfully.
169
+ Additional configuration (as given in the manual)
170
+ Increase Elasticsearch memory limits
171
+ sudo nano /etc/elasticsearch/jvm.options
172
+
173
+
174
+ Modify:
175
+ -Xms2g
176
+ -Xmx2g
177
+
178
+
179
+ Configure system limits
180
+ sudo nano /etc/security/limits.conf
181
+
182
+
183
+ Add:
184
+ elasticsearch soft nofile 65536
185
+ elasticsearch hard nofile 65536
186
+
187
+
188
+ View Graylog logs
189
+ sudo tail -f /var/log/graylog-server/server.log
190
+
191
+
192
+ Result: Successfully installed and configured Graylog Server and accessed its web interface for centralized log management.