diff --git a/.gitignore b/.gitignore index 545ee1d0..455098d7 100644 --- a/.gitignore +++ b/.gitignore @@ -58,3 +58,6 @@ dSploit/build/ # PDT-specific .buildpath /obj + +#logs +*.log diff --git a/plugins/cm-mitm/JArpPoison/META-INF/MANIFEST.MF b/plugins/cm-mitm/JArpPoison/META-INF/MANIFEST.MF index 7090c1a3..4253ef3e 100644 --- a/plugins/cm-mitm/JArpPoison/META-INF/MANIFEST.MF +++ b/plugins/cm-mitm/JArpPoison/META-INF/MANIFEST.MF @@ -3,4 +3,8 @@ Bundle-ManifestVersion: 2 Bundle-Name: JArpPoison Bundle-SymbolicName: JArpPoison Bundle-Version: 1.0.0.qualifier +Export-Package: jarppoison +Import-Package: jpcap, + jpcap.api, + jpcap.packet Bundle-RequiredExecutionEnvironment: JavaSE-1.7 diff --git a/plugins/cm-mitm/JArpPoison/pom.xml b/plugins/cm-mitm/JArpPoison/pom.xml index 1d9fdfeb..0eb4efd0 100644 --- a/plugins/cm-mitm/JArpPoison/pom.xml +++ b/plugins/cm-mitm/JArpPoison/pom.xml @@ -3,29 +3,19 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 net.leaobr - jarppoison - 1.0 - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.7 - 1.7 - - - - - - - org.robotninjas - jpcap - 1.0 - - + THIRDPARTY MITM LIBRARY + http://github.com/leaobr/JArpPoison.git + Uses Jpcap along with libjpcap or (winpcap) to perform mitm actions in a network + JArpPoison + eclipse-plugin scm:git:git://github.com/leaobr/JArpPoison.git scm:git:ssh://git@github.com/leaobr/JArpPoison.git + + net.leaobr.cm.plugins.cm-mitm + cm-mitm + 1.0.0-SNAPSHOT + ../pom.xml + diff --git a/plugins/cm-mitm/JArpPoison/steal.log b/plugins/cm-mitm/JArpPoison/steal.log deleted file mode 100644 index 2ed52d95..00000000 Binary files a/plugins/cm-mitm/JArpPoison/steal.log and /dev/null differ diff --git a/plugins/cm-mitm/jpcap/META-INF/MANIFEST.MF b/plugins/cm-mitm/jpcap/META-INF/MANIFEST.MF index 630d2fbc..dd4090b0 100644 --- a/plugins/cm-mitm/jpcap/META-INF/MANIFEST.MF +++ b/plugins/cm-mitm/jpcap/META-INF/MANIFEST.MF @@ -7,3 +7,4 @@ Bundle-ActivationPolicy: lazy Export-Package: jpcap, jpcap.api, jpcap.packet +Bundle-RequiredExecutionEnvironment: JavaSE-1.7 diff --git a/plugins/cm-mitm/jpcap/pom.xml b/plugins/cm-mitm/jpcap/pom.xml index 023b383e..9a6d17f3 100644 --- a/plugins/cm-mitm/jpcap/pom.xml +++ b/plugins/cm-mitm/jpcap/pom.xml @@ -3,22 +3,19 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.robotninjas + THIRDPARTY JPCAP LIBRARY + http://jpcap.sourceforge.net/ + Jpcap is a Java library for capturing and sending network packets. Jpcap is based on libpcap/winpcap. jpcap - 1.0 - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.7 - 1.7 - - - - + eclipse-plugin scm:git:git://github.com/leaobr/jpcap.git scm:git:ssh://git@github.com/leaobr/jpcap.git + + net.leaobr.cm.plugins.cm-mitm + cm-mitm + 1.0.0-SNAPSHOT + ../pom.xml + diff --git a/plugins/cm-mitm/jpcap/src/main/java/jpcap/api/CaptureException.java b/plugins/cm-mitm/jpcap/src/main/java/jpcap/api/CaptureException.java index e7cfa437..65a20e90 100644 --- a/plugins/cm-mitm/jpcap/src/main/java/jpcap/api/CaptureException.java +++ b/plugins/cm-mitm/jpcap/src/main/java/jpcap/api/CaptureException.java @@ -1,23 +1,24 @@ package jpcap.api; +@SuppressWarnings("serial") public class CaptureException extends RuntimeException { - public CaptureException() { - super(); - } + public CaptureException() { + super(); + } - public CaptureException(String message) { - super(message); - } + public CaptureException(String message) { + super(message); + } - public CaptureException(String message, Throwable cause) { - super(message, cause); - } + public CaptureException(String message, Throwable cause) { + super(message, cause); + } - public CaptureException(Throwable cause) { - super(cause); - } + public CaptureException(Throwable cause) { + super(cause); + } - protected CaptureException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { - super(message, cause, enableSuppression, writableStackTrace); - } + protected CaptureException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } } diff --git a/plugins/cm-mitm/jpcap/src/main/java/jpcap/packet/DatalinkPacket.java b/plugins/cm-mitm/jpcap/src/main/java/jpcap/packet/DatalinkPacket.java index 3f180a7c..5bbad7fb 100644 --- a/plugins/cm-mitm/jpcap/src/main/java/jpcap/packet/DatalinkPacket.java +++ b/plugins/cm-mitm/jpcap/src/main/java/jpcap/packet/DatalinkPacket.java @@ -1,7 +1,8 @@ -package jpcap.packet; - -/** - * This class represents datalink layer packet. - */ -public abstract class DatalinkPacket implements java.io.Serializable { -} +package jpcap.packet; + +/** + * This class represents datalink layer packet. + */ +@SuppressWarnings("serial") +public abstract class DatalinkPacket implements java.io.Serializable { +} diff --git a/plugins/cm-mitm/jpcap/src/main/java/jpcap/packet/IPPacket.java b/plugins/cm-mitm/jpcap/src/main/java/jpcap/packet/IPPacket.java index 4dd255e5..98a623d8 100644 --- a/plugins/cm-mitm/jpcap/src/main/java/jpcap/packet/IPPacket.java +++ b/plugins/cm-mitm/jpcap/src/main/java/jpcap/packet/IPPacket.java @@ -1,331 +1,333 @@ -package jpcap.packet; - -import java.net.Inet4Address; -import java.net.Inet6Address; -import java.net.InetAddress; -import java.net.UnknownHostException; - -/** - * This class represents an IP packet. - *

- * Both IPv4 and IPv6 are supported. - */ -public class IPPacket extends Packet { - private static final long serialVersionUID = 6427030004078082099L; - - /** - * IP version (v4/v6) - */ - public byte version; - - /** - * Priority (class) (v4/v6) - */ - public byte priority; - - /** - * IP flag bit: [D]elay (v4) - */ - public boolean d_flag; - - /** - * IP flag bit: [T]hrough (v4) - */ - public boolean t_flag; - - /** - * IP flag bit: [R]eliability (v4) - */ - public boolean r_flag; - - // added by Damien Daspit 5/7/01 - /** - * Type of Service (TOS) (v4/v6) - */ - public byte rsv_tos; - - // ***************************** - - /** - * Packet length (v4/v6) - */ - public short length; - - /** - * Fragmentation reservation flag (v4) - */ - public boolean rsv_frag; - - /** - * Don't fragment flag (v4) - */ - public boolean dont_frag; - - /** - * More fragment flag (v4) - */ - public boolean more_frag; - - /** - * Fragment offset (v4) - */ - public short offset; - - /** - * Hop Limit, Time To Live (TTL) (v4/v6) - */ - public short hop_limit; - - /** - * Protocol (v4/v6) - */ - public short protocol; - - /** - * Protocol number for ICMP - */ - public static final short IPPROTO_ICMP = 1; - - /** - * Protocol number for IGMP - */ - public static final short IPPROTO_IGMP = 2; - - /** - * Protocol number for IP in IP - */ - public static final short IPPROTO_IP = 4; - - /** - * Protocol number for TCP - */ - public static final short IPPROTO_TCP = 6; - - /** - * Protocol number for UDP - */ - public static final short IPPROTO_UDP = 17; - - /** - * Protocol number for IPv6 - */ - public static final short IPPROTO_IPv6 = 41; - - /** - * Protocol number for IPv6 hop-by-hop option - */ - public static final short IPPROTO_HOPOPT = 0; - - /** - * Protocol number for routing header for IPv6 - */ - public static final short IPPROTO_IPv6_Route = 43; - - /** - * Protocol number for fragment header for IPv6 - */ - public static final short IPPROTO_IPv6_Frag = 44; - - /** - * Protocol number for IPv6 ICMP - */ - public static final short IPPROTO_IPv6_ICMP = 58; - - /** - * Protocol number for no next header header for IPv6 - */ - public static final short IPPROTO_IPv6_NoNxt = 59; - - /** - * Protocol number for destination option for IPv6 - */ - public static final short IPPROTO_IPv6_Opts = 60; - - /** - * IDENTIFICATION (v4) - */ - public int ident; - - /** - * Flow label (v6) - */ - public int flow_label; - - /** - * Source IP address - */ - public InetAddress src_ip; - - /** - * Destination IP address - */ - public InetAddress dst_ip; - - /** - * Option in IPv4 header (v4) - */ - public byte[] option; - - /** - * Option headers in IPv6Option (v6) - */ - public java.util.List options = null; - - /** - * Sets the IPv4 parameters - * - * @param d_flag IP flag bit: [D]elay - * @param t_flag IP flag bit: [T]hrough - * @param r_flag IP flag bit: [R]eliability - * @param rsv_tos Type of Service (TOS) - * @param priority Priority - * @param rsv_frag Fragmentation Reservation flag - * @param dont_frag Don't fragment flag - * @param more_frag More fragment flag - * @param offset Offset - * @param ident Identifier - * @param ttl Time To Live - * @param protocol Protocol
- * This value is ignored when this packets inherits a higher - * layer protocol(e.g. TCPPacket) - * @param src Source IP address - * @param dst Destination IP address - */ - public void setIPv4Parameter(int priority, boolean d_flag, boolean t_flag, - boolean r_flag, int rsv_tos, boolean rsv_frag, boolean dont_frag, - boolean more_frag, int offset, int ident, int ttl, int protocol, - InetAddress src, InetAddress dst) { - this.version = 4; - this.priority = (byte) priority; - this.d_flag = d_flag; - this.t_flag = t_flag; - this.r_flag = r_flag; - // added by Damien Daspit 5/7/01 - this.rsv_tos = (byte) rsv_tos; - // ***************************** - this.rsv_frag = rsv_frag; - this.dont_frag = dont_frag; - this.more_frag = more_frag; - offset = (short) offset; - this.ident = ident; - this.hop_limit = (short) ttl; - this.protocol = (short) protocol; - if (src instanceof Inet6Address || dst instanceof Inet6Address) - throw new IllegalArgumentException("Address must be Inet4Address"); - this.src_ip = src; - this.dst_ip = dst; - } - - /** - * Sets the IPv6 parameters - * - * @param cls class - * @param flowlabel flow label - * @param nxt_hdr next header - * @param hop_limit hop limit - * @param src source address - * @param dst destination address - */ - public void setIPv6Parameter(int cls, int flowlabel, int nxt_hdr, - int hop_limit, InetAddress src, InetAddress dst) { - this.version = 6; - this.priority = (byte) cls; - this.flow_label = flowlabel; - this.protocol = (short) nxt_hdr; - this.hop_limit = (short) hop_limit; - if (src instanceof Inet4Address || dst instanceof Inet4Address) - throw new IllegalArgumentException("Address must be Inet6Address"); - this.src_ip = src; - this.dst_ip = dst; - } - - void setIPv4Value(byte ver, byte pri, boolean d, boolean t, boolean r, - byte rsv_tos, boolean rf, boolean df, boolean mf, short offset, - short len, short ident, short ttl, short proto, byte[] src, - byte[] dst) { - - this.version = ver; - this.priority = pri; - d_flag = d; - t_flag = t; - r_flag = r; - // added by Damien Daspit 5/7/01 - this.rsv_tos = rsv_tos; - // ***************************** - rsv_frag = rf; - dont_frag = df; - more_frag = mf; - this.offset = offset; - this.length = len; - this.ident = ident; - this.hop_limit = ttl; - this.protocol = proto; - try { - this.src_ip = InetAddress.getByAddress(src); - this.dst_ip = InetAddress.getByAddress(dst); - } catch (UnknownHostException e) { - } - } - - void setOption(byte[] option) { - this.option = option; - } - - void setIPv6Value(byte ver, byte v6class, int flow, short payload, - byte nxt, short hlim, byte[] src, byte[] dst) { - this.version = ver; - this.priority = v6class; - this.flow_label = flow; - this.length = payload; - this.protocol = nxt; - this.hop_limit = hlim; - try { - this.src_ip = InetAddress.getByAddress(src); - this.dst_ip = InetAddress.getByAddress(dst); - } catch (UnknownHostException e) { - } - } - - void addOptionHeader(IPv6Option header) { - if (options == null) - options = new java.util.ArrayList(); - - options.add(header); - } - - byte[] getSourceAddress() { - return src_ip.getAddress(); - } - - byte[] getDestinationAddress() { - return dst_ip.getAddress(); - } - - /** - * Returns a string represenation of this packet. - *

- * Format(IPv4): src_ip->dst_ip protocol(protocol) priority(priority) - * [D][T][R] hop(hop_limit) [RF/][DF/][MF] offset(offset) ident(ident) - *

- *

- * Format(IPv6): src_ip->dst_ip protocol(protocol) priority(priority) - * flowlabel(flow_label) hop(hop_limit) - * - * @return a string represenation of this packet - */ - public String toString() { - if (version == 4) { - return super.toString() + " " + src_ip + "->" + dst_ip - + " protocol(" + protocol + ") priority(" + priority + ") " - + (d_flag ? "D" : "") + (t_flag ? "T" : "") - + (r_flag ? "R" : "") + " hop(" + hop_limit + ") " - + (rsv_frag ? "RF/" : "") + (dont_frag ? "DF/" : "") - + (more_frag ? "MF" : "") + " offset(" + offset - + ") ident(" + ident + ")"; - } else { - return super.toString() + " " + src_ip + "->" + dst_ip - + " protocol(" + protocol + ") priority(" + priority - + ") flowlabel(" + flow_label + ") hop(" + hop_limit + ")"; - } - } -} +package jpcap.packet; + +import java.net.Inet4Address; +import java.net.Inet6Address; +import java.net.InetAddress; +import java.net.UnknownHostException; + +/** + * This class represents an IP packet. + *

+ * Both IPv4 and IPv6 are supported. + */ +public class IPPacket extends Packet { + private static final long serialVersionUID = 6427030004078082099L; + + /** + * IP version (v4/v6) + */ + public byte version; + + /** + * Priority (class) (v4/v6) + */ + public byte priority; + + /** + * IP flag bit: [D]elay (v4) + */ + public boolean d_flag; + + /** + * IP flag bit: [T]hrough (v4) + */ + public boolean t_flag; + + /** + * IP flag bit: [R]eliability (v4) + */ + public boolean r_flag; + + // added by Damien Daspit 5/7/01 + /** + * Type of Service (TOS) (v4/v6) + */ + public byte rsv_tos; + + // ***************************** + + /** + * Packet length (v4/v6) + */ + public short length; + + /** + * Fragmentation reservation flag (v4) + */ + public boolean rsv_frag; + + /** + * Don't fragment flag (v4) + */ + public boolean dont_frag; + + /** + * More fragment flag (v4) + */ + public boolean more_frag; + + /** + * Fragment offset (v4) + */ + public short offset; + + /** + * Hop Limit, Time To Live (TTL) (v4/v6) + */ + public short hop_limit; + + /** + * Protocol (v4/v6) + */ + public short protocol; + + /** + * Protocol number for ICMP + */ + public static final short IPPROTO_ICMP = 1; + + /** + * Protocol number for IGMP + */ + public static final short IPPROTO_IGMP = 2; + + /** + * Protocol number for IP in IP + */ + public static final short IPPROTO_IP = 4; + + /** + * Protocol number for TCP + */ + public static final short IPPROTO_TCP = 6; + + /** + * Protocol number for UDP + */ + public static final short IPPROTO_UDP = 17; + + /** + * Protocol number for IPv6 + */ + public static final short IPPROTO_IPv6 = 41; + + /** + * Protocol number for IPv6 hop-by-hop option + */ + public static final short IPPROTO_HOPOPT = 0; + + /** + * Protocol number for routing header for IPv6 + */ + public static final short IPPROTO_IPv6_Route = 43; + + /** + * Protocol number for fragment header for IPv6 + */ + public static final short IPPROTO_IPv6_Frag = 44; + + /** + * Protocol number for IPv6 ICMP + */ + public static final short IPPROTO_IPv6_ICMP = 58; + + /** + * Protocol number for no next header header for IPv6 + */ + public static final short IPPROTO_IPv6_NoNxt = 59; + + /** + * Protocol number for destination option for IPv6 + */ + public static final short IPPROTO_IPv6_Opts = 60; + + /** + * IDENTIFICATION (v4) + */ + public int ident; + + /** + * Flow label (v6) + */ + public int flow_label; + + /** + * Source IP address + */ + public InetAddress src_ip; + + /** + * Destination IP address + */ + public InetAddress dst_ip; + + /** + * Option in IPv4 header (v4) + */ + public byte[] option; + + /** + * Option headers in IPv6Option (v6) + */ + @SuppressWarnings("rawtypes") + public java.util.List options = null; + + /** + * Sets the IPv4 parameters + * + * @param d_flag IP flag bit: [D]elay + * @param t_flag IP flag bit: [T]hrough + * @param r_flag IP flag bit: [R]eliability + * @param rsv_tos Type of Service (TOS) + * @param priority Priority + * @param rsv_frag Fragmentation Reservation flag + * @param dont_frag Don't fragment flag + * @param more_frag More fragment flag + * @param offset Offset + * @param ident Identifier + * @param ttl Time To Live + * @param protocol Protocol
+ * This value is ignored when this packets inherits a higher + * layer protocol(e.g. TCPPacket) + * @param src Source IP address + * @param dst Destination IP address + */ + public void setIPv4Parameter(int priority, boolean d_flag, boolean t_flag, + boolean r_flag, int rsv_tos, boolean rsv_frag, boolean dont_frag, + boolean more_frag, int offset, int ident, int ttl, int protocol, + InetAddress src, InetAddress dst) { + this.version = 4; + this.priority = (byte) priority; + this.d_flag = d_flag; + this.t_flag = t_flag; + this.r_flag = r_flag; + // added by Damien Daspit 5/7/01 + this.rsv_tos = (byte) rsv_tos; + // ***************************** + this.rsv_frag = rsv_frag; + this.dont_frag = dont_frag; + this.more_frag = more_frag; + offset = (short) offset; + this.ident = ident; + this.hop_limit = (short) ttl; + this.protocol = (short) protocol; + if (src instanceof Inet6Address || dst instanceof Inet6Address) + throw new IllegalArgumentException("Address must be Inet4Address"); + this.src_ip = src; + this.dst_ip = dst; + } + + /** + * Sets the IPv6 parameters + * + * @param cls class + * @param flowlabel flow label + * @param nxt_hdr next header + * @param hop_limit hop limit + * @param src source address + * @param dst destination address + */ + public void setIPv6Parameter(int cls, int flowlabel, int nxt_hdr, + int hop_limit, InetAddress src, InetAddress dst) { + this.version = 6; + this.priority = (byte) cls; + this.flow_label = flowlabel; + this.protocol = (short) nxt_hdr; + this.hop_limit = (short) hop_limit; + if (src instanceof Inet4Address || dst instanceof Inet4Address) + throw new IllegalArgumentException("Address must be Inet6Address"); + this.src_ip = src; + this.dst_ip = dst; + } + + void setIPv4Value(byte ver, byte pri, boolean d, boolean t, boolean r, + byte rsv_tos, boolean rf, boolean df, boolean mf, short offset, + short len, short ident, short ttl, short proto, byte[] src, + byte[] dst) { + + this.version = ver; + this.priority = pri; + d_flag = d; + t_flag = t; + r_flag = r; + // added by Damien Daspit 5/7/01 + this.rsv_tos = rsv_tos; + // ***************************** + rsv_frag = rf; + dont_frag = df; + more_frag = mf; + this.offset = offset; + this.length = len; + this.ident = ident; + this.hop_limit = ttl; + this.protocol = proto; + try { + this.src_ip = InetAddress.getByAddress(src); + this.dst_ip = InetAddress.getByAddress(dst); + } catch (UnknownHostException e) { + } + } + + void setOption(byte[] option) { + this.option = option; + } + + void setIPv6Value(byte ver, byte v6class, int flow, short payload, + byte nxt, short hlim, byte[] src, byte[] dst) { + this.version = ver; + this.priority = v6class; + this.flow_label = flow; + this.length = payload; + this.protocol = nxt; + this.hop_limit = hlim; + try { + this.src_ip = InetAddress.getByAddress(src); + this.dst_ip = InetAddress.getByAddress(dst); + } catch (UnknownHostException e) { + } + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + void addOptionHeader(IPv6Option header) { + if (options == null) + options = new java.util.ArrayList(); + + options.add(header); + } + + byte[] getSourceAddress() { + return src_ip.getAddress(); + } + + byte[] getDestinationAddress() { + return dst_ip.getAddress(); + } + + /** + * Returns a string represenation of this packet. + *

+ * Format(IPv4): src_ip->dst_ip protocol(protocol) priority(priority) + * [D][T][R] hop(hop_limit) [RF/][DF/][MF] offset(offset) ident(ident) + *

+ *

+ * Format(IPv6): src_ip->dst_ip protocol(protocol) priority(priority) + * flowlabel(flow_label) hop(hop_limit) + * + * @return a string represenation of this packet + */ + public String toString() { + if (version == 4) { + return super.toString() + " " + src_ip + "->" + dst_ip + + " protocol(" + protocol + ") priority(" + priority + ") " + + (d_flag ? "D" : "") + (t_flag ? "T" : "") + + (r_flag ? "R" : "") + " hop(" + hop_limit + ") " + + (rsv_frag ? "RF/" : "") + (dont_frag ? "DF/" : "") + + (more_frag ? "MF" : "") + " offset(" + offset + + ") ident(" + ident + ")"; + } else { + return super.toString() + " " + src_ip + "->" + dst_ip + + " protocol(" + protocol + ") priority(" + priority + + ") flowlabel(" + flow_label + ") hop(" + hop_limit + ")"; + } + } +} diff --git a/plugins/cm-mitm/net.leaobr.cm.mitm.feature/feature.xml b/plugins/cm-mitm/net.leaobr.cm.mitm.feature/feature.xml index 1927451e..5a84cfa0 100644 --- a/plugins/cm-mitm/net.leaobr.cm.mitm.feature/feature.xml +++ b/plugins/cm-mitm/net.leaobr.cm.mitm.feature/feature.xml @@ -23,4 +23,18 @@ version="0.0.0" unpack="false"/> + + + + diff --git a/plugins/cm-mitm/pom.xml b/plugins/cm-mitm/pom.xml index 2223857a..45e2df00 100644 --- a/plugins/cm-mitm/pom.xml +++ b/plugins/cm-mitm/pom.xml @@ -16,5 +16,7 @@ net.leaobr.cm.mitm.feature net.leaobr.cm.mitm.ui + JArpPoison + jpcap diff --git a/plugins/cm-nmap/nmap4j/pom.xml b/plugins/cm-nmap/nmap4j/pom.xml index 555347b6..83d72647 100644 --- a/plugins/cm-nmap/nmap4j/pom.xml +++ b/plugins/cm-nmap/nmap4j/pom.xml @@ -10,7 +10,7 @@ org.nmap4j org.nmap4j 1.0.4 - Nmap Java Parser Plugin + THIRDPARTY Nmap Java Parser Plugin Cross Platform Nmap parser and process manager eclipse-plugin