Skip to content

Instantly share code, notes, and snippets.

@Estella
Created April 14, 2019 18:48
Show Gist options
  • Save Estella/b2a11fcab481265feb2d78c4aa3b2b71 to your computer and use it in GitHub Desktop.
Save Estella/b2a11fcab481265feb2d78c4aa3b2b71 to your computer and use it in GitHub Desktop.
// c++ udp6_rpc_tester.c -ldnet -lpcap -lusi++
#include <stdlib.h>
#include <iostream>
#include <usi++/usi++.h>
using namespace usipp; using namespace std;
int main(int argc, char **argv) {
if (argc < 3) { cout << arg[0] << "<source ipv6> <destination ipv6> [interface]\n"; exit(1); }
UDP6 udp(argv[2]);
if (argc == 4) {
usipp::pcap *rx = reinterpret_cast<usipp::pcap *>(udp.raw_rx());
if (rx->init_device(argv[3], 1, usipp::max_packet_size < 0) { cerr << udp.why() << endl; return 1; }
TX_pcap_eth *tx = new TX_pcap_eth(rx); tx_set_l2src("01:02:03:04:05:06"); tx_set_l2dst("11:22:33:44:55:66"); tx->set_type(numbers::eth_p_ipv6); udp.register_tx(tx);
}
udp.set_srcport(52888); udp.set_proto(17); udp.set_dstport(111); udp.set_src(argv[1]); udp.sendpack("\xFF\xFF");
return 0;
}
@paigeadelethompson
Copy link

packets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment