1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-23 02:35:57 +01:00

PacketSender now throws on error. Fixed the documentation on several header files.

This commit is contained in:
Matias Fontanini
2012-10-19 12:01:34 -03:00
parent 15b58b4f37
commit abaa2bf926
20 changed files with 251 additions and 176 deletions

View File

@@ -19,7 +19,7 @@ portscan:
$(CXX) portscan.cpp -o portscan $(CXXFLAGS) $(LDFLAGS) -lpthread
traceroute:
$(CXX) traceroute.cpp -o traceroute -std=c++0x $(CXXFLAGS) $(LDFLAGS)
$(CXX) traceroute.cpp -o traceroute -std=c++0x $(CXXFLAGS) $(LDFLAGS) -lpthread
.cpp.o:
$(CXX) $(CXXFLAGS) $(INCLUDE) $< -o $@

View File

@@ -80,8 +80,8 @@ int do_arp_spoofing(NetworkInterface iface, IPv4Address gw, IPv4Address victim,
EthernetII to_victim(iface, victim_hw, info.hw_addr, victim_arp);
while(true) {
// Just send them once every 5 seconds.
if(!sender.send(to_gw) || !sender.send(to_victim))
return 7;
sender.send(to_gw);
sender.send(to_victim);
sleep(5);
}
}
@@ -114,6 +114,12 @@ int main(int argc, char *argv[]) {
cout << ex.what() << endl;
return 3;
}
return do_arp_spoofing(iface, gw, victim, info);
try {
return do_arp_spoofing(iface, gw, victim, info);
}
catch(std::runtime_error &ex) {
std::cout << "Runtime error: " << ex.what() << std::endl;
return 7;
}
}

View File

@@ -76,6 +76,7 @@ private:
// ICMPs are icmp-requests by default
IP ip(addr, iface.addresses().ip_addr, new ICMP());
// We'll find at most 10 hops.
for(auto i = 1; i <= 10; ++i) {
// Set this "unique" id
ip.id(i);