From 1aa5265233528cc92fc21f94e08451ca02066514 Mon Sep 17 00:00:00 2001 From: jfisher Date: Mon, 5 Aug 2019 23:05:35 -0500 Subject: [PATCH] Making NoPE Proxy work with Burp 2.1+ --- NonHTTPProxy/pom.xml | 21 +++++++++++++++++---- NonHTTPProxy/src/josh/dao/HibHelper.java | 23 ++++++++++++++++++++--- NonHTTPProxy/src/josh/utils/Lister.java | 4 +++- 3 files changed, 40 insertions(+), 8 deletions(-) diff --git a/NonHTTPProxy/pom.xml b/NonHTTPProxy/pom.xml index 0e2ba75..b9b7769 100644 --- a/NonHTTPProxy/pom.xml +++ b/NonHTTPProxy/pom.xml @@ -22,6 +22,19 @@ 1.8 + + maven-assembly-plugin + + + + NonHTTPProxy + + + + jar-with-dependencies + + + @@ -37,19 +50,19 @@ org.hibernate - hibernate - 3.6.0.Beta2 + hibernate-core + 5.4.4.Final pom org.hibernate hibernate-c3p0 - 5.1.0.Final + 5.4.4.Final org.xerial sqlite-jdbc - 3.8.11.2 + 3.28.0 org.bouncycastle diff --git a/NonHTTPProxy/src/josh/dao/HibHelper.java b/NonHTTPProxy/src/josh/dao/HibHelper.java index b08474d..5f655b8 100755 --- a/NonHTTPProxy/src/josh/dao/HibHelper.java +++ b/NonHTTPProxy/src/josh/dao/HibHelper.java @@ -1,6 +1,8 @@ package josh.dao; +import java.util.Properties; + import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; @@ -19,9 +21,24 @@ private static SessionFactory buildSessionFactory() { String path = System.getProperty("user.home"); String resultFile = path + "/.NoPEProxy/requests.sqlite"; String SQLString = "jdbc:sqlite:" + resultFile; - Configuration cfg = new Configuration(); - cfg.configure(); - cfg.getProperties().setProperty("hibernate.connection.url",SQLString); + Configuration cfg = new Configuration(); + Properties prop= new Properties(); + + prop.setProperty("hibernate.dialect", "josh.dao.SQLiteDialect"); + prop.setProperty("hibernate.connection.driver_class", "org.sqlite.JDBC"); + prop.setProperty("hibernate.show_sql", "false"); + prop.setProperty("hibernate.hbm2ddl.auto", "update"); + prop.setProperty("hibernate.c3p0.min_size", "20"); + prop.setProperty("hibernate.c3p0.max_size", "50"); + prop.setProperty("hibernate.c3p0.timeout", "1800"); + prop.setProperty("hibernate.c3p0.max_statements", "300"); + prop.setProperty("hibernate.c3p0.idle_test_period", "300"); + prop.setProperty("hibernate.connection.url",SQLString); + cfg.addProperties(prop); + + cfg.addAnnotatedClass(Requests.class); + cfg.addAnnotatedClass(ListenerSetting.class); + return cfg.buildSessionFactory(); } catch (Throwable ex) { diff --git a/NonHTTPProxy/src/josh/utils/Lister.java b/NonHTTPProxy/src/josh/utils/Lister.java index bc2ae26..a1c4966 100644 --- a/NonHTTPProxy/src/josh/utils/Lister.java +++ b/NonHTTPProxy/src/josh/utils/Lister.java @@ -23,6 +23,7 @@ import org.pcap4j.core.PcapHandle; import org.pcap4j.core.PcapNativeException; import org.pcap4j.core.PcapNetworkInterface; +import org.pcap4j.core.PcapPacket; import org.pcap4j.core.PcapNetworkInterface.PromiscuousMode; import org.pcap4j.core.Pcaps; import org.pcap4j.core.BpfProgram.BpfCompileMode; @@ -62,7 +63,8 @@ public void run() { PacketListener listener = new PacketListener() { - public void gotPacket(Packet packet) { + @Override + public void gotPacket(PcapPacket packet) { TcpPacket tcp = packet.get(TcpPacket.class); IpV4Packet ip = packet.get(IpV4Packet.class); if(tcp.getHeader().getSyn() && !tcp.getHeader().getAck() && !ip.getHeader().getSrcAddr().toString().equals("/"+IP)){