google-site-verification=Ob4bKoeqSfwCxusijmOIG1yFGPBhdxoJWBwcZu9KXRk

How to Install Lcrafter In Ubuntu 16.04 / 18.04




Installation Steps

The installation of the library in your system should be quite simple. First download the latest release of the library from here


Extract the source code:

$ tar xfvz crafter-0.3.tar.gz $ cd crafter-0.3 

Before configuring and compiling libcrafter you need lipcap installed in your system. On debian based distros, you should execute:

$ sudo apt-get install libpcap0.8 libpcap0.8-dev

Configure:

got to the extracted file location
for example - champ96k@champ96k:~/Downloads/crafter-0.3$ 

$ ./configure

Compile:

$ make

Install on your system:

$ sudo make install $ sudo ldconfig

Finally, you can download some examples of codes and test them

wget http://libcrafter.googlecode.com/files/examples-0.2.tar.gz

If you want to use the cutting edge version (i.e. HEAD) of libcrafter you should have Autoconf and lib tool installed in your system

$ sudo apt-get install autoconf libtool

Clone the repository and compile the library :

$sudo apt install git

$ git clone http://code.google.com/p/libcrafter/ # or git clone https://github.com/pellegre/libcrafter $ cd libcrafter/libcrafter $ ./autogen.sh $ make $ sudo make install $ sudo ldconfig


to check here is code

Write a program to analyze the following packet/header formats captured through Wireshark for the wired network.  1. IP 2.TCP 3. UDP


Code

?
1
2
3
4
5
6
7
#include <iostream> #include <crafter.h> /* Collapse namespaces */ using namespace std; using namespace Crafter; int main() { int ch; string iface = "eth0"; /* Set the interface */ /* Get the IP address associated to the interface */ string MyIP = GetMyIP(iface); cout << "[@] My IP address is : " << MyIP << endl; do { cout<<"1. IP Header"<< endl; cout<<"2. TCP Header"<< endl; cout<<"3. UDP Header"<< endl; cout<<"Enter your Choice"<< endl; cin>>ch; switch(ch) { case 1 : { // Create an IP header IP ip_header; //Set the Source and Destination IP address ip_header.SetSourceIP(MyIP); //ip_header.SetDestinationIP("www.google.com"); ip_header.SetDestinationIP("172.16.15.62"); RawLayer payload("Payload using IP"); Packet ip_packet = ip_header / payload; cout << endl << "IP: " << endl; ip_packet.Print(); ip_packet.Send(); } break; case 2 : { //Create an TCP - SYN header IP ip_header; //Set the Source and Destination IP address ip_header.SetSourceIP(MyIP); //ip_header.SetDestinationIP("www.google.com"); ip_header.SetDestinationIP("172.16.15.62"); TCP tcp_header; tcp_header.SetSrcPort(11); tcp_header.SetDstPort(8011); tcp_header.SetSeqNumber(RNG32()); tcp_header.SetFlags(TCP::SYN); RawLayer payload("Payload using TCP"); Packet tcp_packet = ip_header / tcp_header / payload; cout << endl << "TCP: " << endl; tcp_packet.Print(); tcp_packet.Send(); } break; case 3 : { IP ip_header; //Set the Source and Destination IP address ip_header.SetSourceIP(MyIP); //ip_header.SetDestinationIP("www.google.com"); ip_header.SetDestinationIP("172.16.15.62"); UDP udp_header; udp_header.SetSrcPort(11); udp_header.SetDstPort(8012); RawLayer payload("Payload using UDP"); Packet udp_packet = ip_header / udp_header / payload; cout << endl << "UDP: " << endl; udp_packet.Print(); udp_packet.Send(); } break; default: break; } }while(ch<4); return 0; }


Steps To run
g++ tcp1.cpp -lcrafter
sudo ./a.out
password:- siem123

Thank you for reading
          -Champ96k  

No comments:

Post a Comment

Pages