package com.ardikars.test.jxnet;
import java.nio.ByteBuffer;
import com.ardikars.jxnet.Jxnet;
import com.ardikars.jxnet.Pcap;
public class SendingPacket {
public static void main(String[] args) {
StringBuilder errbuf = new StringBuilder();
String source = Jxnet.PcapLookupdev(errbuf);
if(source == null) {
System.err.println(errbuf.toString());
return;
}
Pcap pcap = Jxnet.PcapOpenLive(source, 65535, 1, 2000, errbuf);
if(pcap == null) {
System.err.println(errbuf.toString());
return;
}
ByteBuffer bb = ByteBuffer.allocateDirect(14);
bb.put(new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff});
bb.put(new byte[] {(byte) 0xde, (byte) 0xad, (byte) 0xbe, (byte) 0xef, (byte) 0xc0, (byte) 0xfe});
bb.put((byte) 0x0806); // ARP
if(Jxnet.PcapSendPacket(pcap, bb, bb.limit()) == 0) {
System.out.println("OK");
} else {
System.err.println(Jxnet.PcapGetErr(pcap));
}
Jxnet.PcapClose(pcap);
}
}
Server yang akan dijadikan repository bisa Ubuntu/Debian/Raspbian/dll Install wget # apt-get install wget Install Apache2 # apt-get install apache2 Download packages # wget -r --no-parent --reject "index.html*" http://downloads.openwrt.org/barrier_breaker/14.07/ar71xx/generic/packages/ # mv downloads.openwrt.org/ /var/www # chown -Rf www-data:www-data /var/www/downloads.openwrt.org # chmod -Rf a+rwx /var/www/downloads.openwrt.org # /etc/init.d/apache2 restart Menggunakan repository OpenWrt yang telah dibuat. # vi /etc/opkg.conf Ganti downloads.openwrt.org dengan IP Server yang dijadikan repository tadi. Catatan: Untuk versi lain (Chaos Calmer atau yang lainnya) tinggal disesuaikan saja.
Comments
Post a Comment