CAPTCHA Client (Java)

import java.util.*; import java.io.*; import java.net.*; import java.awt.*; import java.awt.image.*; import javax.swing.*; import javax.imageio.*; class ImagePanel extends JPanel { BufferedImage img; ImagePanel(BufferedImage img) { this.img = img; } public void paint(Graphics g) { g.drawImage(img, 0, 0, this); } } class CaptchaClient { static BufferedImage img; public static void main(String args[]) throws Exception { JFrame frame = new JFrame(); Scanner scan = new Scanner(System.in); System.out.println(“Connecting to … Continue reading CAPTCHA Client (Java)

CAPTCHA Server (Java)

import java.util.*; import java.io.*; import java.net.*; import java.awt.*; import java.awt.image.*; import javax.imageio.*; class TimeOutTask extends TimerTask { boolean isTimedOut = false; public void run() { isTimedOut = true; } } class CaptchaServer { static String captcha; static BufferedImage createCaptcha() { BufferedImage bImg = new BufferedImage(200, 200, BufferedImage.TYPE_INT_RGB); Graphics g = bImg.getGraphics(); Random r = new Random(); captcha = new String(); for(int i=0 ; i<6 ; … Continue reading CAPTCHA Server (Java)

Buffer Overflow problem (C)

#include <stdio.h> #include <string.h> int main(void) { char buff[15]; buff[14] = 0; printf(“\n Enter the password : \n”); gets(buff); if(strcmp(buff, “password”)) { printf (“\n Wrong Password \n”); } else { printf (“\n Correct Password \n”); buff[14] = 1; } if(buff[14]) { /* Now Give root or admin rights to user*/ printf (“\n Root privileges given to the user \n”); } return 0; } /* Output: … Continue reading Buffer Overflow problem (C)

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)

All your Engineering Programs at one place

It’s not that easy to complete an experiment in 2 hours’ lab. Sometimes you finish up writing a program within just 15 minutes & sometimes even a whole week’s time is not enough to do so. We’re Engineers, we don’t need to copy everything word by word, but we need that one kick start. Once we get started, it’s tough to stop us. There are … Continue reading All your Engineering Programs at one place