· 5 years ago · Jan 13, 2020, 05:58 AM
1
2Practical No.1
3
4Aim: Working with Sniffers for monitoring network communication (Wireshark).
5
6Step 2: On menu bar select Capture. Select interfaces.
7
8
9--
10
11Step 3: Select Once you click on start, then Wireshark starts to capture the packets on that interface.
12
13
14--
15
16Step 4: Filter packets with HTTP protocol.
17
18
19--
20
21Step 5: A file with only text: http://www.mu.ac.in/ppe/LIBRARY%20SCIENCE- (SEM.I)-SH-2014.pdf
22
23
24--
25
26Step 6: Applying different filters using expressions.
27
281) Filtering HTTP POST request
29
30--
31
322) Filtering 404 not found error
33
34
35--
36
37
383) Filtering using HTTP Content Length
39
40
41
42
43
44Practical No. 2
45
46Aim: Using GNU PGP
47
48Step 1: Open Gpg4win software. Wizard will be opened.
49
50 Step 2: Generate private key to encrypt.
51
52Step 3: Enter passphrase
53Step 4: create text file.
54
55Step 5: Sign And Encrypt Text File.
56
57Step 6: Select Sign and Encrypt (OpenPGP only)
58Step 7: Create email id to encrypt.
59Step 8: Signing and encryption succeeded message will be displayed.
60Step 9: encrypted file will be displayed.
61Step 10: Now decrypt the file you encrypted.
62Step 11: enter passphrase you created.
63Step 12: Decrypted text file will be displayed.
64
65Practical No.3
66
67Aim: Using Iptables on Linux and Setting the filtering rules.
68
69Step 1: List your current filter rules in iptables using –L and –F is used to flush previous command
70
71
72Step 2: To check Current and Established connections
73
74Step 3: Allow incoming traffic on specific port
75
76Step 4: To allow access to port 80 on the firewall
77
78Step 5: To Block traffic
79
80Step 6: To insert connection state
81
82Step 7: To insert new Rules in iptables
83Step 8: To insert Loopback interface in iptables
84
85Step 9: Sudo iptables –L –v
86
87Step 10: For Logging the dropped packets
88
89Step 11: To jump the packets on created chain
90
91
92Step 12: To Log the packets with prefix
93
94Step 13: For saving the iptables
95
96
97--
98
99Practical No. 4
100
101Aim: Working with S/MIME with MS outlook
102
1031)Configure MS outlook by providing the required credentials
104
105
106
107
108Goto Tools ->trust centre->email security
109
110
111Select the required options under the heading Encrypted mail.
112
113To proceed with we will require a digital certificate, if you don’t have one click on the button Get a digital ID
114
115This will navigate to the following web page, which has links to provide free digital certificate.
116
117
118
119
120
121
122Sign up and you will get the certificate through registered email
123
124
125
126
127
128Navigate to your email inbox
129
130Install the certificate
131
1322) Assigning your Certificate to your email account:
133
1341. Open Outlook
135
1362. Select Tools from menu
137
1383. Select Options from drop down menu
139
1404. In dialog box that appears select Security tab
141
1425. Enter a name for your security setting into the Security Settings Name box
143
1446. Ensure S/MIME is selected on the Secure Message Format box
145
1467. Check the Default Security Setting for this Secure Message Format
147
1488. In Certificates and Algorithms section click the Choose button in the
149Signing Certificate section
150
1519. Select your Secure Email Certificate from the Select Certificate dialog box
152
153--
154
15510. Outlook should automatically choose the same Secure Email Certificate as your Signing Certificate for the Encryption Certificate. If not, click the Choose button in the Encryption Certificate and select your Secure Email Certificate from the Select Certificate dialog box
156
15711. Ensure Send These Certificates with Signed Messages is selected
158
15912. Click OK to return to Options dialog box
160
16113. Click OK to return to Outlook
162
1633) Setting up buttons for easy signing / encryption abilities from a New Message toolbar:
164
165Following these steps will display digital sign and encrypt buttons on your New Message toolbar:
166
1671. Click New Message button
1682. Select Tools from menu
1693. Select Customize from drop down menu
1704. Select the Commands tab
1715. Select the Standard from the Categories listings
1726. Scroll down the Commands list on the right to locate Encrypt Message Contents and Attachments. Click on the entry.
1737. Using your mouse, drag the highlighted Encrypt Message Contents and Attachments listing onto your Toolbar. We recommend placing it next to the Send button.
1748. Repeat the steps 6 & 7 to also add the Digitally Sign Message listing.
1759. Click Close to return to composing your message
176
1774) Signing an Email:
178Signing an email ensures the recipient knows the email has come from you and informs him / her if it has been tampered with since being signed.
1791. Compose your email and attach files as usual
1802. Click Sign button
1813. Click Send button
182The recipient of your email must have a copy of your Certificate in order to verify your signed email is legitimate. Ensure you have completed Step 11 in the Assigning your Certificate to your email account section above.
183
1845) Encrypting an Email:
185Encrypting an email ensures that only the recipient may view the email content and any attachments. Note: in order to encrypt an email for the recipient you must have the recipient's Digital Certificate, and their digital certificates must be assigned to the relevant entry in your address book
1861. Compose your email and attach files as usual
1872. Ensure the recipient has a Digital Certificate and you have assigned the Certificate to their entry in your Outlook contacts area
1883. Click Encrypt button
1894. Click Send button
190
191--
192
193Practical No. 5
194
195Aim: Understanding the buffer overflow and format string attacks
196
197Step 1: Open Ubuntu application.
198
199
200--
201
202Step 2: write code for buffer overflow.
203#include <stdio.h> #include <string.h>
204
205int main(void)
206{
207char buff[15]; int pass = 0;
208printf("\n Enter the password : \n"); gets(buff);
209if(strcmp(buff, "thegeekstuff"))
210{
211
212
213}
214else
215{
216
217
218}
219if(pass)
220{
221
222
223}
224
225printf ("\n Wrong Password \n");
226
227
228
229printf ("\n Correct Password \n"); pass = 1;
230
231
232
233/* Now Give root or admin rights to user*/ printf ("\n Root privileges given to the user \n");
234
235return 0;
236}
237
238Step 3: Output buffer overflow.
239
240
241--
242
243Practical No. 6
244Aim: Using NMAP for ports monitoring
245
246Step 1: Install and open Zen map.
247
248Step 2: Insert the target www.gmail.com and select intense scan and press scan.
249
250Step 3: Report will generated. Report for Nmap output.
251
252Step 5: Topology of scanning report.
253
254Step 6: Some host details
255
256Step 7: List of scanning report.
257
258Step 8: Start with second scan to check reports.
259
260Step 9: Ports/protocols.
261
262Step 10: Topology.
263
264Step 11: Host details of second host.
265
266Step 12: Scanning list.
267
268Step 13: One more scanning report between two different web address to check range
269
270Step 14: Scanning list.
271
272
273
274
275
276Practical No. 7
277
278Aim: Socket Programming
279
280Code: DateServer.java
281import java.io.IOException; import java.io.PrintWriter; import java.net.ServerSocket; import java.net.Socket; import java.util.Date;
282
283public class DateServer {
284
285public static void main(String[] args) throws IOException {
286ServerSocket listener = new ServerSocket(9090); try {
287while (true) {
288Socket socket = listener.accept(); try {
289PrintWriter out =
290new PrintWriter(socket.getOutputStream(), true); out.println(new Date().toString());
291} finally
292{
293socket.close();
294}
295}
296}
297finally {
298listener.close();
299}
300}
301}
302
303--
304
305DateClient.java
306
307import java.io.BufferedReader; import java.io.IOException;
308import java.io.InputStreamReader; import java.net.Socket;
309import javax.swing.JOptionPane; public class DateClient {
310public static void main(String[] args) throws IOException {
311String serverAddress = JOptionPane.showInputDialog( "Enter IP Address of a machine that is\n" + "running the date service on port 9090:");
312
313Socket s = new Socket(serverAddress, 9090); BufferedReader input = new BufferedReader(new
314InputStreamReader(s.getInputStream()));
315
316String answer = input.readLine(); JOptionPane.showMessageDialog(null, answer); System.exit(0);
317}
318}
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334Practical No. 8
335
336Aim: Exposure to Client server concept using TCP/IP, Blowfish
337
338Code: TCPSE.java
339import java.io.*; import java.net.*;
340
341class TCPSE
342{
343
344public static void main(String argv[]) throws Exception {
345String fromclient; String toclient;
346ServerSocket Server = new ServerSocket (5000); System.out.println ("TCPServer Waiting for client on port 5000"); while(true)
347{
348Socket connected = Server.accept();
349
350System.out.println( " THE CLIENT"+" "+connected.getInetAddress() +":"+connected.getPort()+" IS CONNECTED ");
351
352BufferedReaderinFromUser = newBufferedReader(new InputStreamReader(System.in));
353
354BufferedReaderinFromClient = newBufferedReader(new InputStreamReader (connected.getInputStream()));
355
356PrintWriteroutToClient = newPrintWriter(connected.getOutputStream(),true);
357
358while ( true )
359{
360
361--
362
363
364System.out.println("SEND(Type Q or q to Quit):"); toclient = inFromUser.readLine();
365
366if ( toclient.equals ("q") || toclient.equals("Q") )
367{
368
369
370
371
372}
373else
374{
375
376}
377
378outToClient.println(toclient); connected.close();
379break;
380
381
382
383outToClient.println(toclient);
384
385
386fromclient = inFromClient.readLine();
387
388if ( fromclient.equals("q") || fromclient.equals("Q") )
389{
390
391
392
393}else
394{
395
396}
397}
398}
399}
400}
401
402connected.close(); break;
403
404
405System.out.println( "RECIEVED:" + fromclient );
406
407
408
409
410TCPCL.java
411
412import java.io.*; import java.net.*;
413
414class TCPCL
415{
416public static void main(String argv[]) throws Exception {
417String FromServer; String ToServer;
418Socket clientSocket = new Socket("localhost", 5000); BufferedReaderinFromUser = newBufferedReader(new
419InputStreamReader(System.in));
420
421PrintWriteroutToServer = new PrintWriter(clientSocket.getOutputStream(),true);
422
423BufferedReaderinFromServer = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
424
425while (true)
426{
427
428FromServer = inFromServer.readLine();
429
430if ( FromServer.equals("q") || FromServer.equals("Q"))
431{
432
433
434
435}
436
437else
438
439{
440
441clientSocket.close(); break;
442
443
444
445
446System.out.println("RECIEVED:" + FromServer); System.out.println("SEND(Type Q or q to Quit):");
447
448ToServer = inFromUser.readLine();
449
450if (ToServer.equals("Q") || ToServer.equals("q"))
451
452--
453
454{
455outToServer.println (ToServer) ; clientSocket.close();
456break;
457}
458
459
460else
461{
462
463}
464}
465}
466}
467}
468
469
470
471outToServer.println(ToServer);
472
473--
474
475Output: SERVER
476
477
478CLIENT
479
480
481--
482
483
484Aim: Implementing Blowfish
485
486Code:
487
488import javax.crypto.Cipher;
489import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; import javax.swing.JOptionPane;
490
491public class Blowfish
492{
493public static void main(String[] args) throws Exception {
494KeyGenerator keygen = KeyGenerator.getInstance("Blowfish");
495
496// create a key
497
498
499SecretKey secretkey = keygen.generateKey(); Cipher cip = Cipher.getInstance("Blowfish");
500
501// initialise cipher to with secret key cip.init(Cipher.ENCRYPT_MODE, secretkey);
502String inputText = JOptionPane.showInputDialog(" Give Input: "); byte[] encrypted = cip.doFinal(inputText.getBytes()); cip.init(Cipher.DECRYPT_MODE, secretkey);
503byte[] decrypted = cip.doFinal(encrypted);
504
505JOptionPane.showMessageDialog(JOptionPane.getRootFrame(), "encrypted : " + new String(encrypted) + "\n" + "decrypted : " + new String(decrypted));
506
507System.exit(0);
508}
509}
510
511--
512
513
514Output: