From 79436476e7c7fcb9fde327708a8bd6a659e2b683 Mon Sep 17 00:00:00 2001
From: sk13 <sk13@5a230232-f31e-4839-b85c-661838634aa0>
Date: Fri, 7 Jan 2022 16:14:44 +0000
Subject: [PATCH]

---
 .../android/ui/main/MainActivity.java         |  81 +++++--
 app/src/main/res/layout/fragment_anon.xml     | 226 +++++++++++-------
 .../anon_next/android/AndroidVpnService.java  | 202 ++++++++++++++++
 .../networking/AndroidNetworkFactory.java     |  81 +++++++
 .../anon_next/android/AndroidVpnService.java  | 207 ++++++++++++++++
 .../networking/AndroidNetworkFactory.java     |  97 ++++++++
 .../wiresharksshdumpserver/MyCommand.java     | 103 ++++++++
 .../MyCommandFactory.java                     |  23 ++
 .../MyHostBasedAuthenticator.java             |  17 ++
 .../MyKeyboardInteractiveAuthenticator.java   |  23 ++
 .../MyPasswordAuthenticator.java              |  17 ++
 .../MyPublicKeyAuthenticator.java             |  16 ++
 .../WiresharkSSHdumpServer.java               | 134 +++++++++++
 gradle/wrapper/gradle-wrapper.properties      |   6 +-
 14 files changed, 1123 insertions(+), 110 deletions(-)
 create mode 100644 app/src/noRemotePCAP/java/anonvpn/anon_next/android/AndroidVpnService.java
 create mode 100644 app/src/noRemotePCAP/java/anonvpn/anon_next/android/service/networking/AndroidNetworkFactory.java
 create mode 100644 app/src/withRemotePCAP/java/anonvpn/anon_next/android/AndroidVpnService.java
 create mode 100644 app/src/withRemotePCAP/java/anonvpn/anon_next/android/service/networking/AndroidNetworkFactory.java
 create mode 100644 app/src/withRemotePCAP/java/wiresharksshdumpserver/MyCommand.java
 create mode 100644 app/src/withRemotePCAP/java/wiresharksshdumpserver/MyCommandFactory.java
 create mode 100644 app/src/withRemotePCAP/java/wiresharksshdumpserver/MyHostBasedAuthenticator.java
 create mode 100644 app/src/withRemotePCAP/java/wiresharksshdumpserver/MyKeyboardInteractiveAuthenticator.java
 create mode 100644 app/src/withRemotePCAP/java/wiresharksshdumpserver/MyPasswordAuthenticator.java
 create mode 100644 app/src/withRemotePCAP/java/wiresharksshdumpserver/MyPublicKeyAuthenticator.java
 create mode 100644 app/src/withRemotePCAP/java/wiresharksshdumpserver/WiresharkSSHdumpServer.java

diff --git a/app/src/main/java/anonvpn/anon_next/android/ui/main/MainActivity.java b/app/src/main/java/anonvpn/anon_next/android/ui/main/MainActivity.java
index e9f1854..698e484 100644
--- a/app/src/main/java/anonvpn/anon_next/android/ui/main/MainActivity.java
+++ b/app/src/main/java/anonvpn/anon_next/android/ui/main/MainActivity.java
@@ -21,6 +21,7 @@ import androidx.core.view.GravityCompat;
 import androidx.drawerlayout.widget.DrawerLayout;
 import androidx.fragment.app.Fragment;
 import androidx.fragment.app.FragmentManager;
+import androidx.fragment.app.FragmentTransaction;
 import anon.AnonLib;
 import anonvpn.anon_next.android.R;
 import anonvpn.anon_next.android.service.persistence.AndroidConfig;
@@ -87,10 +88,10 @@ public class MainActivity extends VPNConnectedActivity implements NavigationView
 		protected void onCreate(Bundle savedInstanceState)
 			{
 				SharedPreferences sharedPreferences = getSharedPreferences(this.getString(R.string.sp_global), Context.MODE_PRIVATE);
-				m_AndroidConfig=(AndroidConfig)new AndroidPersistenceFactory(sharedPreferences).getConfiguration();
-				String strLang=m_AndroidConfig.getLanguage(null);
+				m_AndroidConfig = (AndroidConfig) new AndroidPersistenceFactory(sharedPreferences).getConfiguration();
+				String strLang = m_AndroidConfig.getLanguage(null);
 
-				SettingsActivity.setLocale(this,strLang,false);
+				SettingsActivity.setLocale(this, strLang, false);
 //				Log.d("ANONVPNMainActivity", "ONCREATE");
 				super.onCreate(savedInstanceState);
 				mFragmentManager = getSupportFragmentManager();
@@ -100,14 +101,13 @@ public class MainActivity extends VPNConnectedActivity implements NavigationView
 				///TODO: Move on better place...
 				CascadeConnectionManager.USE_FAKE_DNS = false;
 				CascadeConnectionManager.USE_UDP_SOCKS = true;
-				CascadeConnectionManager.USE_DEBUG_LOG = false;
+				CascadeConnectionManager.USE_DEBUG_LOG = true;
 				CascadeConnectionManager.USE_PCAP_WRITER = false;
-				AnonLib.DISABLE_PACKET_COUNTING=true;
+				AnonLib.DISABLE_PACKET_COUNTING = true;
 //            CascadeConnectionManager.PCAP_FILENAME= Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS)+"/vpn.pcap";
 				CascadeConnectionManager.PCAP_FILENAME = "/storage/6533-3732/test/vpn.pcap";
 
 
-
 				launchMainView();
 				if (!m_AndroidConfig.getTutorialPassed())
 					{
@@ -123,13 +123,16 @@ public class MainActivity extends VPNConnectedActivity implements NavigationView
 				super.onNewIntent(intent);
 				//String LOGTAG = "MainActivity";
 				//Log.i(LOGTAG, "Received new intent");
-				if (intent.hasExtra("type") && intent.getStringExtra("type").equals("notification")) {
-					mAnonFragment.updateStatus();
-				}
-				else if(intent.hasExtra(STR_INTENT_EXTRA_FRAGMENTID))
+				if (intent.hasExtra("type") && intent.getStringExtra("type").equals("notification"))
+					{
+						mAnonFragment.updateStatus();
+					}
+				else if (intent.hasExtra(STR_INTENT_EXTRA_FRAGMENTID))
 					{
-						if(intent.getIntExtra(STR_INTENT_EXTRA_FRAGMENTID,-1)==MainActivity.FRAGMENTID_CONNECTION)
-							setFragment(MainActivity.FRAGMENTID_CONNECTION);
+						if (intent.getIntExtra(STR_INTENT_EXTRA_FRAGMENTID, -1) == MainActivity.FRAGMENTID_CONNECTION)
+							{
+								setFragment(MainActivity.FRAGMENTID_CONNECTION);
+							}
 					}
 			}
 
@@ -220,9 +223,9 @@ public class MainActivity extends VPNConnectedActivity implements NavigationView
 		protected void onVPNServiceConnected()
 			{
 				if (m_AndroidConfig.getVPNstarted() && getServiceInterface().getServiceState() == VPNState.DISABLED)
-				{
-					enableVPNTunneling();
-				}
+					{
+						enableVPNTunneling();
+					}
 			}
 
 		protected void onVPNServiceDisconnected()
@@ -242,7 +245,7 @@ public class MainActivity extends VPNConnectedActivity implements NavigationView
 		@Override
 		public void onActivityResult(int request_code, int result, Intent data)
 			{
-				super.onActivityResult(request_code,result,data);
+				super.onActivityResult(request_code, result, data);
 				if (request_code == ALLOW_VPN_REQUEST)
 					{
 						if (result == Activity.RESULT_OK)
@@ -358,6 +361,40 @@ public class MainActivity extends VPNConnectedActivity implements NavigationView
 				setFragment(FRAGMENTID_ANONYMITY);
 			}
 
+
+		private void changeFragment(Fragment f)
+			{
+				if (f == null)
+					{
+						return;
+					}
+				if (mFragmentManager == null)
+					{
+						mFragmentManager = getSupportFragmentManager();
+						if (mFragmentManager == null)
+							{
+								return;
+							}
+					}
+				FragmentTransaction t = mFragmentManager.beginTransaction();
+				t = t.replace(R.id.fl_fragmentcontainer, f);
+				try
+					{
+						t.commit();
+
+					}
+				catch (Exception e1)
+					{
+						try
+							{
+								t.commitAllowingStateLoss();
+							}
+						catch (Exception e2)
+							{
+							}
+					}
+			}
+
 		public void setFragment(final int id)
 			{
 				new Handler().post(new Runnable()
@@ -369,25 +406,25 @@ public class MainActivity extends VPNConnectedActivity implements NavigationView
 									{
 										case FRAGMENTID_ANONYMITY:
 											//mAnonFragment = new AnonFragment();
-											mFragmentManager.beginTransaction().replace(R.id.fl_fragmentcontainer, mAnonFragment).commit();
+											changeFragment(mAnonFragment);
 											setTheme(R.style.AppTheme_SwitchBig);
 											setTitle(R.string.start_title);
 											break;
 										case FRAGMENTID_CONNECTION:
 											//mConnectFragment = new ConnectFragment();
-											mFragmentManager.beginTransaction().replace(R.id.fl_fragmentcontainer, mConnectFragment).commit();
+											changeFragment(mConnectFragment);
 											setTheme(R.style.AppTheme);
 											setTitle(R.string.connect_title);
 											break;
 										case FRAGMENTID_APPS:
 											//mAppFragment = new AppFragment();
-											mFragmentManager.beginTransaction().replace(R.id.fl_fragmentcontainer, mAppFragment).commit();
+											changeFragment(mAppFragment);
 											setTheme(R.style.AppTheme);
 											setTitle(R.string.app_title);
 											break;
 										case FRAGMENTID_NETWORKS:
 											//mNetFragment = new NetFragment();
-											mFragmentManager.beginTransaction().replace(R.id.fl_fragmentcontainer, mNetFragment).commit();
+											changeFragment(mNetFragment);
 											setTheme(R.style.AppTheme);
 											setTitle(R.string.net_title);
 											break;
@@ -412,6 +449,8 @@ public class MainActivity extends VPNConnectedActivity implements NavigationView
 						((ConnectFragment) activeFragment).onBackPressed();
 					}
 				else
-					super.onBackPressed();
+					{
+						super.onBackPressed();
+					}
 			}
 	}
diff --git a/app/src/main/res/layout/fragment_anon.xml b/app/src/main/res/layout/fragment_anon.xml
index 0af47a3..c665a18 100644
--- a/app/src/main/res/layout/fragment_anon.xml
+++ b/app/src/main/res/layout/fragment_anon.xml
@@ -1,41 +1,51 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+							xmlns:app="http://schemas.android.com/apk/res-auto"
 							xmlns:tools="http://schemas.android.com/tools"
 							android:layout_width="match_parent"
 							android:layout_height="match_parent"
 							android:orientation="vertical"
-							android:weightSum="5"
 							tools:context="anonvpn.anon_next.android.ui.main.AnonFragment">
 
-	<RelativeLayout
+	<androidx.constraintlayout.widget.ConstraintLayout
 		android:id="@+id/anon_rl_top"
 		android:layout_width="match_parent"
-		android:layout_height="match_parent"
-		android:layout_weight="3">
+		android:layout_height="0dp"
+		android:layout_weight="1">
 
-		<androidx.appcompat.widget.SwitchCompat
-			android:id="@+id/anon_switch"
+		<LinearLayout
 			android:layout_width="wrap_content"
 			android:layout_height="wrap_content"
-			android:layout_above="@+id/anon_tv_status"
-			android:layout_centerHorizontal="true"
-			android:layout_marginBottom="50dp"
-			android:background="#0000"
-			android:switchMinWidth="200dp"
-			android:thumb="@drawable/switch_thumb_selector_big"
-			android:thumbTextPadding="100dp"
-			android:track="@drawable/switch_track_selector_big"/>
-
-		<TextView
-			android:id="@+id/anon_tv_status"
-			android:layout_width="wrap_content"
-			android:layout_height="wrap_content"
-			android:layout_alignParentBottom="true"
-			android:layout_centerHorizontal="true"
-			android:layout_marginBottom="20dp"
-			android:text="@string/start_label_state"
-			android:textColor="@color/deactivate_button"
-			android:textSize="@dimen/title"/>
-	</RelativeLayout>
+			android:orientation="vertical"
+			app:layout_constraintBottom_toBottomOf="parent"
+			app:layout_constraintEnd_toEndOf="parent"
+			app:layout_constraintStart_toStartOf="parent"
+			app:layout_constraintTop_toTopOf="parent">
+
+
+			<androidx.appcompat.widget.SwitchCompat
+				android:id="@+id/anon_switch"
+				android:layout_width="wrap_content"
+				android:layout_height="wrap_content"
+				android:layout_gravity="center"
+				android:layout_marginBottom="0dp"
+				android:background="#0000"
+				android:switchMinWidth="200dp"
+				android:thumb="@drawable/switch_thumb_selector_big"
+				android:thumbTextPadding="100dp"
+				android:track="@drawable/switch_track_selector_big"/>
+
+			<TextView
+				android:id="@+id/anon_tv_status"
+				android:layout_width="wrap_content"
+				android:layout_height="wrap_content"
+				android:layout_marginTop="16dp"
+				android:layout_marginBottom="0dp"
+				android:text="@string/start_label_state"
+				android:textColor="@color/deactivate_button"
+				android:textSize="@dimen/title"/>
+		</LinearLayout>
+
+	</androidx.constraintlayout.widget.ConstraintLayout>
 	<!-- Separation line -->
 	<View
 		android:layout_width="match_parent"
@@ -44,15 +54,17 @@
 		android:layout_marginRight="10dp"
 		android:background="@android:color/darker_gray"/>
 
+	<!-- Lower part -->
 	<LinearLayout
 		android:layout_width="match_parent"
-		android:layout_height="match_parent"
+		android:layout_height="0dp"
 		android:layout_weight="1"
 		android:orientation="horizontal"
-		android:weightSum="2">
+		>
 
-		<RelativeLayout
-			android:layout_width="match_parent"
+		<androidx.constraintlayout.widget.ConstraintLayout
+			android:id="@+id/anon_iv_anonymometer_container"
+			android:layout_width="0dp"
 			android:layout_height="match_parent"
 			android:layout_weight="1">
 
@@ -60,112 +72,148 @@
 				android:id="@+id/anon_iv_anonymometer"
 				android:layout_width="wrap_content"
 				android:layout_height="wrap_content"
-				android:layout_marginLeft="20dp"
 				android:layout_marginStart="20dp"
+				android:layout_marginLeft="20dp"
 				android:layout_marginTop="15dp"
 				android:text="@string/start_label_meter"
-				android:textSize="@dimen/text_priority1"/>
+				android:textSize="@dimen/text_priority1"
+				app:layout_constraintStart_toStartOf="parent"
+				app:layout_constraintTop_toTopOf="parent"
+				tools:layout_conversion_wrapHeight="706"
+				tools:layout_conversion_wrapWidth="0"/>
 
 			<ImageView
 				android:id="@+id/anon_iv_anonymometer_help"
 				android:layout_width="wrap_content"
 				android:layout_height="wrap_content"
-				android:layout_marginLeft="5dp"
 				android:layout_marginStart="5dp"
+				android:layout_marginLeft="5dp"
 				android:layout_marginTop="6dp"
-				android:layout_toEndOf="@+id/anon_iv_anonymometer"
-				android:layout_toRightOf="@+id/anon_iv_anonymometer"
 				android:padding="6dp"
-				android:src="@drawable/ic_help_outline_blue_200_24dp"/>
+				android:src="@drawable/ic_help_outline_blue_200_24dp"
+				app:layout_constraintLeft_toRightOf="@+id/anon_iv_anonymometer"
+				app:layout_constraintStart_toEndOf="@+id/anon_iv_anonymometer"
+				app:layout_constraintTop_toTopOf="parent"
+				tools:layout_conversion_wrapHeight="95"
+				tools:layout_conversion_wrapWidth="0"/>
 
-			<RelativeLayout
-				android:layout_width="wrap_content"
-				android:layout_height="wrap_content"
-				android:layout_below="@+id/anon_iv_anonymometer"
-				android:layout_marginLeft="25dp"
-				android:layout_marginStart="25dp"
-				android:layout_marginTop="25dp">
+			<androidx.constraintlayout.widget.ConstraintLayout
+				android:id="@+id/anon_rl_status_container"
+				android:layout_width="0dp"
+				android:layout_height="0dp"
+				android:layout_marginTop="25dp"
+				app:layout_constraintBottom_toBottomOf="parent"
+				app:layout_constraintEnd_toEndOf="parent"
+				app:layout_constraintStart_toStartOf="parent"
+				app:layout_constraintTop_toBottomOf="@+id/anon_iv_anonymometer"
+				tools:layout_conversion_wrapHeight="1109"
+				tools:layout_conversion_wrapWidth="0">
 
-				<RelativeLayout
+				<androidx.constraintlayout.widget.ConstraintLayout
 					android:id="@+id/anon_rl_status"
 					android:layout_width="wrap_content"
-					android:layout_height="160dp"
-					android:layout_alignParentLeft="true"
-					android:layout_alignParentStart="true"
-					android:layout_marginLeft="40dp"
-					android:layout_marginStart="40dp">
+					android:layout_height="0dp"
+					android:layout_marginBottom="8dp"
+					app:layout_constraintBottom_toTopOf="@+id/anon_tv_tip"
+					app:layout_constraintEnd_toEndOf="parent"
+					app:layout_constraintStart_toStartOf="parent"
+					app:layout_constraintTop_toTopOf="parent">
 
 					<ProgressBar
 						android:id="@+id/anon_iv_statusbar"
 						style="@android:style/Widget.ProgressBar.Horizontal"
-						android:layout_width="20dp"
-						android:layout_height="160dp"
+						android:layout_width="wrap_content"
+						android:layout_height="0dp"
 						android:max="100"
 						android:progress="1"
-						android:progressDrawable="@drawable/progress_scale_drawable"/>
+						android:progressDrawable="@drawable/progress_scale_drawable"
+						app:layout_constrainedHeight="false"
+						app:layout_constrainedWidth="false"
+						app:layout_constraintBottom_toBottomOf="parent"
+						app:layout_constraintStart_toStartOf="parent"
+						app:layout_constraintTop_toTopOf="parent"
+						app:layout_constraintVertical_bias="0.0"
+						/>
 
 					<TextView
+						android:id="@+id/textView"
 						android:layout_width="wrap_content"
 						android:layout_height="wrap_content"
-						android:layout_alignParentTop="true"
-						android:layout_marginLeft="10dp"
-						android:layout_marginStart="10dp"
-						android:layout_toEndOf="@+id/anon_iv_statusbar"
-						android:layout_toRightOf="@+id/anon_iv_statusbar"
-						android:text="@string/start_label_meterfull"/>
+						android:layout_marginStart="8dp"
+						android:layout_marginLeft="8dp"
+						android:text="@string/start_label_meterfull"
+						app:layout_constraintLeft_toRightOf="@+id/anon_iv_statusbar"
+						app:layout_constraintStart_toEndOf="@+id/anon_iv_statusbar"
+						app:layout_constraintTop_toTopOf="parent"/>
 
 					<TextView
+						android:id="@+id/textView2"
 						android:layout_width="wrap_content"
 						android:layout_height="wrap_content"
-						android:layout_centerVertical="true"
-						android:layout_marginLeft="10dp"
-						android:layout_marginStart="10dp"
-						android:layout_toEndOf="@+id/anon_iv_statusbar"
-						android:layout_toRightOf="@+id/anon_iv_statusbar"
-						android:text="@string/start_label_meterhalf"/>
+						android:layout_marginStart="8dp"
+						android:layout_marginLeft="8dp"
+						android:text="@string/start_label_meterhalf"
+						app:layout_constraintBottom_toBottomOf="parent"
+						app:layout_constraintLeft_toRightOf="@+id/anon_iv_statusbar"
+						app:layout_constraintStart_toEndOf="@+id/anon_iv_statusbar"
+						app:layout_constraintTop_toTopOf="parent"/>
 
 					<TextView
+						android:id="@+id/textView3"
 						android:layout_width="wrap_content"
-						android:layout_height="15dp"
-						android:layout_alignParentBottom="true"
-						android:layout_marginLeft="10dp"
-						android:layout_marginStart="10dp"
-						android:layout_toEndOf="@+id/anon_iv_statusbar"
-						android:layout_toRightOf="@+id/anon_iv_statusbar"
-						android:text="@string/start_label_meterzero"/>
-				</RelativeLayout>
+						android:layout_height="wrap_content"
+						android:layout_marginStart="8dp"
+						android:layout_marginLeft="8dp"
+						android:text="@string/start_label_meterzero"
+						app:layout_constraintBottom_toBottomOf="parent"
+						app:layout_constraintLeft_toRightOf="@+id/anon_iv_statusbar"
+						app:layout_constraintStart_toEndOf="@+id/anon_iv_statusbar"/>
+				</androidx.constraintlayout.widget.ConstraintLayout>
 
 				<TextView
 					android:id="@+id/anon_tv_tip"
-					android:layout_width="wrap_content"
+					android:layout_width="0dp"
 					android:layout_height="wrap_content"
-					android:layout_below="@+id/anon_rl_status"
-					android:layout_marginTop="10dp"
+					android:layout_marginStart="16dp"
+					android:layout_marginLeft="16dp"
+					android:layout_marginEnd="16dp"
+					android:layout_marginRight="16dp"
+					android:layout_marginBottom="8dp"
 					android:text="@string/start_label_tipp"
-					android:textSize="@dimen/text_list_description"/>
-			</RelativeLayout>
+					android:textSize="@dimen/text_list_description"
+					app:layout_constraintBottom_toBottomOf="parent"
+					app:layout_constraintEnd_toEndOf="parent"
+					app:layout_constraintStart_toStartOf="parent"/>
+			</androidx.constraintlayout.widget.ConstraintLayout>
 
-		</RelativeLayout>
+		</androidx.constraintlayout.widget.ConstraintLayout>
 
+		<!-- Horizontal separation line -->
 		<View
 			android:layout_width="1dp"
-			android:layout_height="285dp"
+			android:layout_height="match_parent"
 			android:layout_marginBottom="10dp"
 			android:layout_marginTop="10dp"
 			android:background="@android:color/darker_gray"/>
 
-		<RelativeLayout
-			android:layout_width="match_parent"
+		<LinearLayout
+			android:layout_width="0dp"
 			android:layout_height="match_parent"
-			android:layout_weight="1">
+			android:layout_weight="1"
+			android:orientation="vertical">
+
+			<Space
+				android:layout_width="match_parent"
+				android:layout_height="0dp"
+				android:layout_weight="0.5"/>
 
 			<LinearLayout
 				android:id="@+id/anon_ll_download"
 				android:layout_width="wrap_content"
 				android:layout_height="wrap_content"
-				android:layout_marginLeft="@dimen/margin_edge_left"
 				android:layout_marginStart="@dimen/margin_edge_left"
-				android:layout_marginTop="100dp"
+				android:layout_marginLeft="@dimen/margin_edge_left"
+				android:layout_marginTop="16dp"
 				android:orientation="horizontal">
 
 				<ImageView
@@ -178,8 +226,8 @@
 					android:id="@+id/anon_tv_download"
 					android:layout_width="wrap_content"
 					android:layout_height="wrap_content"
-					android:layout_marginLeft="4dp"
 					android:layout_marginStart="4dp"
+					android:layout_marginLeft="4dp"
 					android:text="@string/start_label_down_per_second"
 					android:textSize="@dimen/text_priority1"/>
 			</LinearLayout>
@@ -263,9 +311,15 @@
 				android:layout_marginStart="45dp"
 				android:text="@string/start_label_observer"
 				android:textSize="12sp"/>
+			<Space
+				android:layout_width="match_parent"
+				android:layout_height="0dp"
+				android:layout_weight="0.5"/>
+
+		</LinearLayout>
 
-		</RelativeLayout>
 
 	</LinearLayout>
 
+
 </LinearLayout>
\ No newline at end of file
diff --git a/app/src/noRemotePCAP/java/anonvpn/anon_next/android/AndroidVpnService.java b/app/src/noRemotePCAP/java/anonvpn/anon_next/android/AndroidVpnService.java
new file mode 100644
index 0000000..6ef421e
--- /dev/null
+++ b/app/src/noRemotePCAP/java/anonvpn/anon_next/android/AndroidVpnService.java
@@ -0,0 +1,202 @@
+package anonvpn.anon_next.android;
+
+/**
+ * Created by migue on 16.06.15.
+ * handles a vpn connection
+ */
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.net.VpnService;
+import android.os.IBinder;
+import android.os.ParcelFileDescriptor;
+import android.util.Log;
+
+import java.io.IOException;
+
+import anonvpn.anon_next.android.service.gui.AndroidGUIFactory;
+import anonvpn.anon_next.android.service.gui.AndroidGUIInterface;
+import anonvpn.anon_next.android.service.networking.AndroidConnectivityMonitorFactory;
+import anonvpn.anon_next.android.service.networking.AndroidNetworkFactory;
+import anonvpn.anon_next.android.service.networking.AndroidProtectedSocketFactory;
+import anonvpn.anon_next.android.service.persistence.AndroidPersistenceFactory;
+import anonvpn.anon_next.android.util.AndroidResourceLoaderHelper;
+import anonvpn.anon_next.core.ANONVPNService;
+import anonvpn.anon_next.core.notification.Event;
+import anonvpn.anon_next.core.persistence.IConfig;
+
+public class AndroidVpnService extends VpnService
+	{
+
+		static
+			{
+				System.loadLibrary("FileDescriptorHandler");
+			}
+
+		ANONVPNService anonvpnService = null;
+
+		// This reference is needed to properly shutdown the service later on
+		ParcelFileDescriptor mTunnelingDevice = null;
+
+		// TODO: Find a way to adapt the MTU to the block size of the ANON protocol
+		final private static int TUNNELING_MTU = 9000;
+
+		AndroidNetworkFactory mNetworkFactory = null;
+
+		private native int setBlocking(int fd_id);
+
+		/**
+		 * We expect this method to be called after VPNService.prepare has been called.
+		 *
+		 * @param intent
+		 * @param flags
+		 * @param startId
+		 * @return
+		 */
+		@Override
+		public int onStartCommand(Intent intent, int flags, int startId)
+			{
+
+				// onStartCommand may be run multiple times (e.g. if the user turns the smartphone)
+				if (anonvpnService == null)
+					{
+						Log.e("AndroidVPNService", Thread.currentThread().getId() + "Setting up tunneling device!");
+						AndroidPersistenceFactory persistenceFactory = null;
+						try
+							{
+								persistenceFactory = new AndroidPersistenceFactory(getSharedPreferences(this.getString(R.string.sp_global), Context.MODE_PRIVATE));
+							}
+						catch (Exception e)
+							{
+								e.printStackTrace();
+							}
+
+						IConfig a_config = null;
+						if (persistenceFactory != null)
+							{
+								a_config = persistenceFactory.getConfiguration();
+							}
+						mNetworkFactory = new AndroidNetworkFactory(this, TUNNELING_MTU, a_config);
+						AndroidProtectedSocketFactory mixSocketFactory = new AndroidProtectedSocketFactory(this);
+						AndroidGUIFactory guiFactory = new AndroidGUIFactory(this);
+
+						AndroidConnectivityMonitorFactory connMonFactory = new AndroidConnectivityMonitorFactory(getApplicationContext());
+						Log.e("AndroidVPNService", "Starting core service!");
+						AndroidResourceLoaderHelper resourecLoaderHelper = new AndroidResourceLoaderHelper(getAssets());
+						AndroidLog logger = new AndroidLog();
+						anonvpnService = new ANONVPNService(mNetworkFactory, persistenceFactory, guiFactory, connMonFactory, mixSocketFactory, resourecLoaderHelper, logger);
+					}
+
+				// service running until it is explicitly stopped,return sticky.
+				return START_STICKY;
+			}
+
+		public void startTunnelingDevice()
+			{
+
+				byte[] ip = new byte[4];
+				ip[0] = 10;
+				int iIP = 10;
+				for (int i = 1; i < 4; i++)
+					{
+						ip[i] = (byte) (2 + (int) (Math.random() * 252));
+						iIP <<= 8;
+						iIP |= (ip[i] & 0x00FF);
+					}
+				mTunnelingDevice = setupTunnelingDevice(TUNNELING_MTU, ip);
+				mNetworkFactory.setTunnelingDescriptor(mTunnelingDevice, iIP);
+
+			}
+
+		public void stopTunnelingDevice()
+			{
+				try
+					{
+						mTunnelingDevice.close();
+						mTunnelingDevice = null;
+						mNetworkFactory.setTunnelingDescriptor(null, -1);
+					}
+				catch (Exception e)
+					{
+						Log.e("AndroidVPNService", "Failed to close tunneling device!");
+					}
+
+
+			}
+
+		public boolean tunnelingEnabled()
+			{
+				return mTunnelingDevice != null;
+			}
+
+		private ParcelFileDescriptor setupTunnelingDevice(int MTU, byte[] ip)
+			{
+				ParcelFileDescriptor result = null;
+				String strIP = Integer.toString(ip[0] & 0x00FF) + ".";
+				String DNSServer = "10.0.0.1";
+
+				// Generate a random internal IP address
+				strIP = strIP + Integer.toString(ip[1] & 0x00FF) + ".";
+				strIP = strIP + Integer.toString(ip[2] & 0x00FF) + ".";
+				strIP = strIP + Integer.toString(ip[3] & 0x00FF);
+
+				VpnService.Builder builder = new VpnService.Builder();
+				builder.setMtu(MTU);
+				builder.addAddress(strIP, 32);
+				builder.addRoute("0.0.0.0", 0);
+				builder.addDnsServer(DNSServer);
+				builder.setSession("ANON Tunneling Interface");
+
+				// TODO: Consider calling builder.setConfigureIntent to make the VPN connection configurable
+				//       from the Android settings
+
+				try
+					{
+						result = builder.establish();
+						if (setBlocking(result.getFd()) == -1)
+							{
+								throw new IOException("Failed to set blocking mode!");
+							}
+					}
+				catch (Exception e)
+					{
+						Log.i("ANDROIDTUN", "Failed to create tunneling device: " + e.getMessage());
+						return null;
+					}
+
+
+				return result;
+			}
+
+
+
+
+		@Override
+		public void onDestroy()
+			{
+				super.onDestroy();
+				Log.e("AndroidVPNService", "Destroying core service!");
+			}
+
+		@Override
+		public IBinder onBind(Intent intent)
+			{
+				return (AndroidGUIInterface) anonvpnService.getGUIInterface();
+			}
+
+		public void shutdown()
+			{
+				stopTunnelingDevice();
+				Log.e("AndroidVPNService", "Stopping!");
+				anonvpnService.notify(Event.VPN_DISABLED);
+				stopSelf();
+			}
+
+		@Override
+		public void onRevoke()
+			{
+				Log.e("AndroidVPNService", "Got revoked!");
+				shutdown();
+			}
+	};
diff --git a/app/src/noRemotePCAP/java/anonvpn/anon_next/android/service/networking/AndroidNetworkFactory.java b/app/src/noRemotePCAP/java/anonvpn/anon_next/android/service/networking/AndroidNetworkFactory.java
new file mode 100644
index 0000000..067ff1f
--- /dev/null
+++ b/app/src/noRemotePCAP/java/anonvpn/anon_next/android/service/networking/AndroidNetworkFactory.java
@@ -0,0 +1,81 @@
+package anonvpn.anon_next.android.service.networking;
+
+import android.net.VpnService;
+import android.os.ParcelFileDescriptor;
+import android.util.Log;
+
+import java.io.OutputStream;
+import java.net.Socket;
+
+import anonvpn.anon_next.core.networking.IInternetSocket;
+import anonvpn.anon_next.core.networking.INetworkFactory;
+import anonvpn.anon_next.core.networking.ITunneling;
+import anonvpn.anon_next.core.persistence.IConfig;
+import pcap.PCAPTUNDevice;
+import pcap.PCAPWriter;
+
+/**
+ * Created by martin on 5/22/17.
+ */
+
+public class AndroidNetworkFactory implements INetworkFactory
+	{
+
+		/**
+		 * This reference is needed in order to create sockets
+		 * that are not routed into the VPN interface.
+		 */
+		private final VpnService mServiceRef;
+		private ParcelFileDescriptor mTunnelingDescriptor = null;
+		private final int mPacketMTU;
+		private int m_iIP;
+		private IConfig m_Config;
+
+		public AndroidNetworkFactory(VpnService service, int MTU, IConfig a_config)
+			{
+
+				mServiceRef = service;
+				mPacketMTU = MTU;
+				m_Config = a_config;
+			}
+
+		public void setTunnelingDescriptor(ParcelFileDescriptor tunnelingDescriptor, int ip)
+			{
+				mTunnelingDescriptor = tunnelingDescriptor;
+				m_iIP = ip;
+			}
+
+		/**
+		 * Assumes that prepare has been called in advance so that the VPN device can
+		 * be created.
+		 *
+		 *
+		 */
+		public ITunneling getTunnelingInterface()
+			{
+
+				ITunneling result = null;
+
+				if (mTunnelingDescriptor != null)
+					{
+						result = new AndroidTunnelingInterface(m_Config, mTunnelingDescriptor, mPacketMTU, m_iIP);
+					}
+				return result;
+			}
+
+		public IInternetSocket getInternetSocket()
+			{
+
+				AndroidInternetSocket result = null;
+				Socket sock = new Socket();
+
+				// Avoid socket packets being put into tunneling interface
+				if (mServiceRef.protect(sock) == false)
+					{
+						Log.i("ANDROIDTUN", "Failed to protect socket!");
+					}
+
+				result = new AndroidInternetSocket(sock);
+				return result;
+			}
+	}
diff --git a/app/src/withRemotePCAP/java/anonvpn/anon_next/android/AndroidVpnService.java b/app/src/withRemotePCAP/java/anonvpn/anon_next/android/AndroidVpnService.java
new file mode 100644
index 0000000..c0bdcdd
--- /dev/null
+++ b/app/src/withRemotePCAP/java/anonvpn/anon_next/android/AndroidVpnService.java
@@ -0,0 +1,207 @@
+package anonvpn.anon_next.android;
+
+/**
+ * Created by migue on 16.06.15.
+ * handles a vpn connection
+ */
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.net.VpnService;
+import android.os.IBinder;
+import android.os.ParcelFileDescriptor;
+import android.util.Log;
+
+import java.io.IOException;
+
+import anonvpn.anon_next.android.service.gui.AndroidGUIFactory;
+import anonvpn.anon_next.android.service.gui.AndroidGUIInterface;
+import anonvpn.anon_next.android.service.networking.AndroidConnectivityMonitorFactory;
+import anonvpn.anon_next.android.service.networking.AndroidNetworkFactory;
+import anonvpn.anon_next.android.service.networking.AndroidProtectedSocketFactory;
+import anonvpn.anon_next.android.service.persistence.AndroidPersistenceFactory;
+import anonvpn.anon_next.android.util.AndroidResourceLoaderHelper;
+import anonvpn.anon_next.core.ANONVPNService;
+import anonvpn.anon_next.core.notification.Event;
+import anonvpn.anon_next.core.persistence.IConfig;
+import wiresharksshdumpserver.WiresharkSSHdumpServer;
+
+public class AndroidVpnService extends VpnService
+	{
+
+		static
+			{
+				System.loadLibrary("FileDescriptorHandler");
+			}
+
+		ANONVPNService anonvpnService = null;
+
+		// This reference is needed to properly shutdown the service later on
+		ParcelFileDescriptor mTunnelingDevice = null;
+
+		// TODO: Find a way to adapt the MTU to the block size of the ANON protocol
+		final private static int TUNNELING_MTU = 9000;
+
+		AndroidNetworkFactory mNetworkFactory = null;
+
+		private native int setBlocking(int fd_id);
+
+		/**
+		 * We expect this method to be called after VPNService.prepare has been called.
+		 *
+		 * @param intent
+		 * @param flags
+		 * @param startId
+		 * @return
+		 */
+		@Override
+		public int onStartCommand(Intent intent, int flags, int startId)
+			{
+
+				// onStartCommand may be run multiple times (e.g. if the user turns the smartphone)
+				if (anonvpnService == null)
+					{
+						Log.e("AndroidVPNService", Thread.currentThread().getId() + "Setting up tunneling device!");
+						AndroidPersistenceFactory persistenceFactory = null;
+						try
+							{
+								persistenceFactory = new AndroidPersistenceFactory(getSharedPreferences(this.getString(R.string.sp_global), Context.MODE_PRIVATE));
+							}
+						catch (Exception e)
+							{
+								e.printStackTrace();
+							}
+
+						IConfig a_config = null;
+						if (persistenceFactory != null)
+							{
+								a_config = persistenceFactory.getConfiguration();
+							}
+						mNetworkFactory = new AndroidNetworkFactory(this, TUNNELING_MTU, a_config);
+						AndroidProtectedSocketFactory mixSocketFactory = new AndroidProtectedSocketFactory(this);
+						AndroidGUIFactory guiFactory = new AndroidGUIFactory(this);
+
+						AndroidConnectivityMonitorFactory connMonFactory = new AndroidConnectivityMonitorFactory(getApplicationContext());
+						Log.e("AndroidVPNService", "Starting core service!");
+						AndroidResourceLoaderHelper resourecLoaderHelper = new AndroidResourceLoaderHelper(getAssets());
+						AndroidLog logger = new AndroidLog();
+						anonvpnService = new ANONVPNService(mNetworkFactory, persistenceFactory, guiFactory, connMonFactory, mixSocketFactory, resourecLoaderHelper, logger);
+					}
+
+				// service running until it is explicitly stopped,return sticky.
+				return START_STICKY;
+			}
+
+		public void startTunnelingDevice()
+			{
+
+				byte[] ip = new byte[4];
+				ip[0] = 10;
+				int iIP = 10;
+				for (int i = 1; i < 4; i++)
+					{
+						ip[i] = (byte) (2 + (int) (Math.random() * 252));
+						iIP <<= 8;
+						iIP |= (ip[i] & 0x00FF);
+					}
+				mTunnelingDevice = setupTunnelingDevice(TUNNELING_MTU, ip);
+				mNetworkFactory.setTunnelingDescriptor(mTunnelingDevice, iIP);
+
+			}
+
+		public void stopTunnelingDevice()
+			{
+				try
+					{
+						mTunnelingDevice.close();
+						mTunnelingDevice = null;
+						mNetworkFactory.setTunnelingDescriptor(null, -1);
+					}
+				catch (Exception e)
+					{
+						Log.e("AndroidVPNService", "Failed to close tunneling device!");
+					}
+
+
+			}
+
+		public boolean tunnelingEnabled()
+			{
+				return mTunnelingDevice != null;
+			}
+
+		private ParcelFileDescriptor setupTunnelingDevice(int MTU, byte[] ip)
+			{
+				ParcelFileDescriptor result = null;
+				String strIP = Integer.toString(ip[0] & 0x00FF) + ".";
+				String DNSServer = "10.0.0.1";
+
+				// Generate a random internal IP address
+				strIP = strIP + Integer.toString(ip[1] & 0x00FF) + ".";
+				strIP = strIP + Integer.toString(ip[2] & 0x00FF) + ".";
+				strIP = strIP + Integer.toString(ip[3] & 0x00FF);
+
+				VpnService.Builder builder = new VpnService.Builder();
+				builder.setMtu(MTU);
+				builder.addAddress(strIP, 32);
+				builder.addRoute("0.0.0.0", 0);
+				builder.addDnsServer(DNSServer);
+				builder.setSession("ANON Tunneling Interface");
+
+				// TODO: Consider calling builder.setConfigureIntent to make the VPN connection configurable
+				//       from the Android settings
+
+				try
+					{
+						result = builder.establish();
+						if (setBlocking(result.getFd()) == -1)
+							{
+								throw new IOException("Failed to set blocking mode!");
+							}
+					}
+				catch (Exception e)
+					{
+						Log.i("ANDROIDTUN", "Failed to create tunneling device: " + e.getMessage());
+						return null;
+					}
+
+				setupPCAPssh();
+
+				return result;
+			}
+
+		private void setupPCAPssh()
+		{
+			WiresharkSSHdumpServer.main(null);
+		}
+
+
+		@Override
+		public void onDestroy()
+			{
+				super.onDestroy();
+				Log.e("AndroidVPNService", "Destroying core service!");
+			}
+
+		@Override
+		public IBinder onBind(Intent intent)
+			{
+				return (AndroidGUIInterface) anonvpnService.getGUIInterface();
+			}
+
+		public void shutdown()
+			{
+				stopTunnelingDevice();
+				Log.e("AndroidVPNService", "Stopping!");
+				anonvpnService.notify(Event.VPN_DISABLED);
+				stopSelf();
+			}
+
+		@Override
+		public void onRevoke()
+			{
+				Log.e("AndroidVPNService", "Got revoked!");
+				shutdown();
+			}
+	};
diff --git a/app/src/withRemotePCAP/java/anonvpn/anon_next/android/service/networking/AndroidNetworkFactory.java b/app/src/withRemotePCAP/java/anonvpn/anon_next/android/service/networking/AndroidNetworkFactory.java
new file mode 100644
index 0000000..7ab2ffa
--- /dev/null
+++ b/app/src/withRemotePCAP/java/anonvpn/anon_next/android/service/networking/AndroidNetworkFactory.java
@@ -0,0 +1,97 @@
+package anonvpn.anon_next.android.service.networking;
+
+import android.net.VpnService;
+import android.os.ParcelFileDescriptor;
+import android.util.Log;
+
+import java.io.OutputStream;
+import java.net.Socket;
+
+import anonvpn.anon_next.core.networking.IInternetSocket;
+import anonvpn.anon_next.core.networking.INetworkFactory;
+import anonvpn.anon_next.core.networking.ITunneling;
+import anonvpn.anon_next.core.persistence.IConfig;
+import pcap.PCAPTUNDevice;
+import pcap.PCAPWriter;
+import wiresharksshdumpserver.WiresharkSSHdumpServer;
+
+/**
+ * Created by martin on 5/22/17.
+ */
+
+public class AndroidNetworkFactory implements INetworkFactory
+	{
+
+		/**
+		 * This reference is needed in order to create sockets
+		 * that are not routed into the VPN interface.
+		 */
+		private final VpnService mServiceRef;
+		private ParcelFileDescriptor mTunnelingDescriptor = null;
+		private final int mPacketMTU;
+		private int m_iIP;
+		private IConfig m_Config;
+
+		public AndroidNetworkFactory(VpnService service, int MTU, IConfig a_config)
+			{
+
+				mServiceRef = service;
+				mPacketMTU = MTU;
+				m_Config = a_config;
+			}
+
+		public void setTunnelingDescriptor(ParcelFileDescriptor tunnelingDescriptor, int ip)
+			{
+				mTunnelingDescriptor = tunnelingDescriptor;
+				m_iIP = ip;
+			}
+
+		/**
+		 * Assumes that prepare has been called in advance so that the VPN device can
+		 * be created.
+		 *
+		 *
+		 */
+		public ITunneling getTunnelingInterface()
+			{
+
+				ITunneling result = null;
+
+				if (mTunnelingDescriptor != null)
+					{
+						result = new AndroidTunnelingInterface(m_Config, mTunnelingDescriptor, mPacketMTU, m_iIP);
+						//sk13
+						if(WiresharkSSHdumpServer.pcapWriter==null)
+							{
+								try
+									{
+										WiresharkSSHdumpServer.pcapWriter=new PCAPWriter((OutputStream)null);
+										WiresharkSSHdumpServer.pcapWriter.enableAutoFlush(true);
+									}
+								catch (Exception e)
+									{
+										e.printStackTrace();
+									}
+							}
+						result=new PCAPTUNDevice(result, WiresharkSSHdumpServer.pcapWriter);
+						 //sk13
+					}
+				return result;
+			}
+
+		public IInternetSocket getInternetSocket()
+			{
+
+				AndroidInternetSocket result = null;
+				Socket sock = new Socket();
+
+				// Avoid socket packets being put into tunneling interface
+				if (mServiceRef.protect(sock) == false)
+					{
+						Log.i("ANDROIDTUN", "Failed to protect socket!");
+					}
+
+				result = new AndroidInternetSocket(sock);
+				return result;
+			}
+	}
diff --git a/app/src/withRemotePCAP/java/wiresharksshdumpserver/MyCommand.java b/app/src/withRemotePCAP/java/wiresharksshdumpserver/MyCommand.java
new file mode 100644
index 0000000..84c639f
--- /dev/null
+++ b/app/src/withRemotePCAP/java/wiresharksshdumpserver/MyCommand.java
@@ -0,0 +1,103 @@
+package wiresharksshdumpserver;
+
+import org.apache.sshd.server.Environment;
+import org.apache.sshd.server.ExitCallback;
+import org.apache.sshd.server.channel.ChannelSession;
+import org.apache.sshd.server.command.Command;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+public class MyCommand implements Command, Runnable
+	{
+
+		private InputStream m_In;
+		private OutputStream m_Out;
+		
+		public void start(ChannelSession channel, Environment env) throws IOException
+			{
+			/*	Thread t=new Thread(this);
+				t.setDaemon(true);
+				t.start();*/
+				try
+					{
+						WiresharkSSHdumpServer.pcapWriter.setOutputStream(m_Out);
+					}
+				catch (Exception e)
+					{
+						e.printStackTrace();
+					}
+			}
+
+		public void destroy(ChannelSession channel) throws Exception
+			{
+				try
+					{
+						WiresharkSSHdumpServer.pcapWriter.setOutputStream(null);
+					}
+				catch (Exception e)
+					{
+						e.printStackTrace();
+					}
+			}
+
+		public void setInputStream(InputStream in)
+			{
+				m_In=in;
+			}
+
+		public void setOutputStream(OutputStream out)
+			{
+				m_Out=out;
+
+			}
+
+		public void setErrorStream(OutputStream err)
+			{
+			}
+
+		public void setExitCallback(ExitCallback callback)
+			{
+			}
+
+		@Override
+		public void run()
+			{
+				try
+					{
+						//BufferedReader fin=new BufferedReader(new FileReader("c:\\temp\\is.pcap"));
+						//String s;
+						FileInputStream fin=new FileInputStream("c:\\temp\\is.pcap");
+						byte buff[]=new byte[1000];
+						int len;
+						while((len=fin.read(buff))>0)
+							{
+								m_Out.write(buff,0,len);
+								Thread.sleep(100);
+							}
+					}
+				catch (Exception e)
+					{
+						// TODO Auto-generated catch block
+						e.printStackTrace();
+					}
+				
+				
+			}
+
+
+		public void start(Environment env) throws IOException
+			{
+				Thread t=new Thread(this);
+				t.setDaemon(true);
+				t.start();
+			}
+
+
+		public void destroy() throws Exception
+			{
+
+			}
+	}
diff --git a/app/src/withRemotePCAP/java/wiresharksshdumpserver/MyCommandFactory.java b/app/src/withRemotePCAP/java/wiresharksshdumpserver/MyCommandFactory.java
new file mode 100644
index 0000000..ee2aa21
--- /dev/null
+++ b/app/src/withRemotePCAP/java/wiresharksshdumpserver/MyCommandFactory.java
@@ -0,0 +1,23 @@
+package wiresharksshdumpserver;
+
+import org.apache.sshd.server.channel.ChannelSession;
+import org.apache.sshd.server.command.Command;
+import org.apache.sshd.server.command.CommandFactory;
+
+import java.io.IOException;
+
+public class MyCommandFactory implements CommandFactory
+	{
+
+		public Command createCommand(ChannelSession channel, String command) throws IOException
+			{
+				System.out.println("Get command: "+command);
+				return new MyCommand();
+			}
+
+		public Command createCommand(String command)
+			{
+				System.out.println("Get command: "+command);
+				return new MyCommand();
+			}
+	}
diff --git a/app/src/withRemotePCAP/java/wiresharksshdumpserver/MyHostBasedAuthenticator.java b/app/src/withRemotePCAP/java/wiresharksshdumpserver/MyHostBasedAuthenticator.java
new file mode 100644
index 0000000..7fac773
--- /dev/null
+++ b/app/src/withRemotePCAP/java/wiresharksshdumpserver/MyHostBasedAuthenticator.java
@@ -0,0 +1,17 @@
+package wiresharksshdumpserver;
+
+import org.apache.sshd.server.auth.hostbased.HostBasedAuthenticator;
+import org.apache.sshd.server.session.ServerSession;
+
+import java.security.PublicKey;
+import java.security.cert.X509Certificate;
+import java.util.List;
+
+public class MyHostBasedAuthenticator implements HostBasedAuthenticator
+	{
+		@Override
+		public boolean authenticate(ServerSession session, String username, PublicKey clientHostKey, String clientHostName, String clientUsername, List<X509Certificate> certificates)
+			{
+				return true;
+			}
+	}
diff --git a/app/src/withRemotePCAP/java/wiresharksshdumpserver/MyKeyboardInteractiveAuthenticator.java b/app/src/withRemotePCAP/java/wiresharksshdumpserver/MyKeyboardInteractiveAuthenticator.java
new file mode 100644
index 0000000..a680731
--- /dev/null
+++ b/app/src/withRemotePCAP/java/wiresharksshdumpserver/MyKeyboardInteractiveAuthenticator.java
@@ -0,0 +1,23 @@
+package wiresharksshdumpserver;
+
+import org.apache.sshd.server.auth.keyboard.InteractiveChallenge;
+import org.apache.sshd.server.auth.keyboard.KeyboardInteractiveAuthenticator;
+import org.apache.sshd.server.session.ServerSession;
+
+import java.util.List;
+
+public class MyKeyboardInteractiveAuthenticator implements KeyboardInteractiveAuthenticator
+	{
+
+		public InteractiveChallenge generateChallenge(ServerSession session, String username, String lang,
+																									String subMethods)
+			{
+				return new InteractiveChallenge();
+			}
+
+		public boolean authenticate(ServerSession session, String username, List<String> responses) throws Exception
+			{
+				return true;
+			}
+
+	}
diff --git a/app/src/withRemotePCAP/java/wiresharksshdumpserver/MyPasswordAuthenticator.java b/app/src/withRemotePCAP/java/wiresharksshdumpserver/MyPasswordAuthenticator.java
new file mode 100644
index 0000000..43b7cf3
--- /dev/null
+++ b/app/src/withRemotePCAP/java/wiresharksshdumpserver/MyPasswordAuthenticator.java
@@ -0,0 +1,17 @@
+package wiresharksshdumpserver;
+
+import org.apache.sshd.server.auth.AsyncAuthException;
+import org.apache.sshd.server.auth.password.PasswordAuthenticator;
+import org.apache.sshd.server.auth.password.PasswordChangeRequiredException;
+import org.apache.sshd.server.session.ServerSession;
+
+public class MyPasswordAuthenticator implements PasswordAuthenticator
+	{
+
+		public boolean authenticate(String username, String password, ServerSession session)
+				throws PasswordChangeRequiredException, AsyncAuthException
+			{
+				return true;
+			}
+
+	}
diff --git a/app/src/withRemotePCAP/java/wiresharksshdumpserver/MyPublicKeyAuthenticator.java b/app/src/withRemotePCAP/java/wiresharksshdumpserver/MyPublicKeyAuthenticator.java
new file mode 100644
index 0000000..02b0608
--- /dev/null
+++ b/app/src/withRemotePCAP/java/wiresharksshdumpserver/MyPublicKeyAuthenticator.java
@@ -0,0 +1,16 @@
+package wiresharksshdumpserver;
+
+import org.apache.sshd.server.auth.AsyncAuthException;
+import org.apache.sshd.server.auth.pubkey.PublickeyAuthenticator;
+import org.apache.sshd.server.session.ServerSession;
+
+import java.security.PublicKey;
+
+public class MyPublicKeyAuthenticator implements PublickeyAuthenticator
+	{
+		@Override
+		public boolean authenticate(String username, PublicKey key, ServerSession session) throws AsyncAuthException
+			{
+				return true;
+			}
+	}
diff --git a/app/src/withRemotePCAP/java/wiresharksshdumpserver/WiresharkSSHdumpServer.java b/app/src/withRemotePCAP/java/wiresharksshdumpserver/WiresharkSSHdumpServer.java
new file mode 100644
index 0000000..cf866b3
--- /dev/null
+++ b/app/src/withRemotePCAP/java/wiresharksshdumpserver/WiresharkSSHdumpServer.java
@@ -0,0 +1,134 @@
+package wiresharksshdumpserver;
+
+import org.apache.sshd.common.NamedFactory;
+import org.apache.sshd.common.channel.ChannelFactory;
+import org.apache.sshd.common.compression.BuiltinCompressions;
+import org.apache.sshd.common.compression.Compression;
+import org.apache.sshd.common.compression.CompressionFactory;
+import org.apache.sshd.common.config.keys.BuiltinIdentities;
+import org.apache.sshd.common.file.nativefs.NativeFileSystemFactory;
+import org.apache.sshd.common.kex.BuiltinDHFactories;
+import org.apache.sshd.common.kex.DHFactory;
+import org.apache.sshd.common.kex.KeyExchangeFactory;
+import org.apache.sshd.common.random.SingletonRandomFactory;
+import org.apache.sshd.common.signature.BuiltinSignatures;
+import org.apache.sshd.common.signature.Signature;
+import org.apache.sshd.common.util.security.SecurityUtils;
+import org.apache.sshd.server.ServerBuilder;
+import org.apache.sshd.server.SshServer;
+import org.apache.sshd.server.channel.ChannelSessionFactory;
+import org.apache.sshd.server.forward.DirectTcpipFactory;
+import org.apache.sshd.server.kex.DHGEXServer;
+import org.apache.sshd.server.kex.DHGServer;
+import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.function.Function;
+
+import pcap.PCAPWriter;
+
+public class WiresharkSSHdumpServer
+	{
+		public static PCAPWriter pcapWriter;
+
+		public static final Function<DHFactory, KeyExchangeFactory> DH2KEX = factory -> factory == null
+						? null
+						: factory.isGroupExchange()
+						? DHGEXServer.newFactory(factory)
+						: DHGServer.newFactory(factory);
+		public static final List<BuiltinDHFactories> DEFAULT_KEX_PREFERENCE = Collections.unmodifiableList(
+        Arrays.asList(
+        		
+                BuiltinDHFactories.ecdhp521,
+                BuiltinDHFactories.ecdhp384,
+                BuiltinDHFactories.ecdhp256,
+
+                BuiltinDHFactories.dhgex256,
+
+                BuiltinDHFactories.dhg18_512,
+                BuiltinDHFactories.dhg17_512,
+                BuiltinDHFactories.dhg16_512,
+                BuiltinDHFactories.dhg15_512,
+                BuiltinDHFactories.dhg14_256,
+                BuiltinDHFactories.dhg14));
+		 public static List<KeyExchangeFactory> setUpDefaultKeyExchanges(boolean ignoreUnsupported) {
+       return NamedFactory.setUpTransformedFactories(ignoreUnsupported, DEFAULT_KEX_PREFERENCE, DH2KEX);
+   }
+		public static final List<CompressionFactory> DEFAULT_COMPRESSION_FACTORIES = Collections.unmodifiableList(
+						Arrays.<CompressionFactory> asList(
+										BuiltinCompressions.none,
+										BuiltinCompressions.zlib,
+										BuiltinCompressions.delayedZlib));
+		public static List<NamedFactory<Compression>> setUpDefaultCompressionFactories(boolean ignoreUnsupported) {
+			return (List) NamedFactory.setUpBuiltinFactories(ignoreUnsupported, DEFAULT_COMPRESSION_FACTORIES);
+		}
+		public static final List<ChannelFactory> DEFAULT_CHANNEL_FACTORIES = Collections.unmodifiableList(
+						Arrays.asList(
+										ChannelSessionFactory.INSTANCE,
+										DirectTcpipFactory.INSTANCE));
+
+		 public static final List<BuiltinSignatures> DEFAULT_SIGNATURE_PREFERENCE = Collections.unmodifiableList(
+         Arrays.asList(
+                 BuiltinSignatures.nistp256_cert,
+                 BuiltinSignatures.nistp384_cert,
+                 BuiltinSignatures.nistp521_cert,
+                 BuiltinSignatures.ed25519_cert,
+                 BuiltinSignatures.rsaSHA512_cert,
+                 BuiltinSignatures.rsaSHA256_cert,
+                 BuiltinSignatures.nistp256,
+                 BuiltinSignatures.nistp384,
+                 BuiltinSignatures.nistp521,
+                 BuiltinSignatures.ed25519,
+                 BuiltinSignatures.sk_ecdsa_sha2_nistp256,
+                 BuiltinSignatures.sk_ssh_ed25519,
+                 BuiltinSignatures.rsaSHA512,
+                 BuiltinSignatures.rsaSHA256,
+                 BuiltinSignatures.rsa,
+                 BuiltinSignatures.sk_ssh_ed25519,
+                 BuiltinSignatures.dsa,
+                 BuiltinSignatures.dsa_cert)); 
+		 
+		 public static List<NamedFactory<Signature>> setUpDefaultSignatureFactories(boolean ignoreUnsupported) {
+       return (List) NamedFactory.setUpBuiltinFactories(ignoreUnsupported, DEFAULT_SIGNATURE_PREFERENCE);
+   } 
+
+		public static void main(String[] args)
+			{
+				SshServer sshd = new SshServer();
+				sshd.setCipherFactories(ServerBuilder.setUpDefaultCiphers(false));
+				sshd.setCompressionFactories(setUpDefaultCompressionFactories(false));
+				sshd.setMacFactories(ServerBuilder.setUpDefaultMacs(false));
+				sshd.setRandomFactory(new SingletonRandomFactory(SecurityUtils.getRandomFactory()));
+				sshd.setChannelFactories(DEFAULT_CHANNEL_FACTORIES);
+				sshd.setFileSystemFactory(NativeFileSystemFactory.INSTANCE);
+				sshd.setPort(2222);
+				sshd.setKeyExchangeFactories(setUpDefaultKeyExchanges(false));
+				sshd.setSignatureFactories(setUpDefaultSignatureFactories(false));
+				SimpleGeneratorHostKeyProvider hostKeyProvider=new SimpleGeneratorHostKeyProvider();
+				hostKeyProvider.setKeySize(1024);
+				hostKeyProvider.setAlgorithm(BuiltinIdentities.Constants.RSA);
+				sshd.setKeyPairProvider(hostKeyProvider);
+				sshd.setPasswordAuthenticator(new MyPasswordAuthenticator());
+				sshd.setKeyboardInteractiveAuthenticator(new MyKeyboardInteractiveAuthenticator());
+				sshd.setHostBasedAuthenticator(new MyHostBasedAuthenticator());
+				sshd.setPublickeyAuthenticator(new MyPublicKeyAuthenticator());
+				sshd.setCommandFactory(new MyCommandFactory());
+				try
+					{
+						sshd.start();
+					}
+					catch(Exception e)
+						{
+							e.printStackTrace();
+						}
+			/*	Object o=new Object();
+				synchronized(o)
+				{
+					o.wait();
+				}
+*/
+			}
+
+	}
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 2fa5f06..5cc45af 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Mon Jun 03 16:22:00 CEST 2019
+#Fri Jan 07 16:43:56 CET 2022
 distributionBase=GRADLE_USER_HOME
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
 distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
+zipStoreBase=GRADLE_USER_HOME
-- 
GitLab