able to connect to tor control port via go

This commit is contained in:
Dan Ballard 2017-08-20 13:42:07 -07:00
parent 6e8ef24c79
commit db899ffcf6
4 changed files with 26 additions and 2 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
*.iml *.iml
*.aar
.gradle .gradle
/local.properties /local.properties
/.idea/workspace.xml /.idea/workspace.xml

View File

@ -9,6 +9,9 @@ import android.view.View;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket; import java.net.Socket;
import goRicochetMobile.GoRicochetMobile; import goRicochetMobile.GoRicochetMobile;
@ -55,14 +58,34 @@ public class ConnectActivity extends AppCompatActivity {
Log.i(TAG, "Attempting manual java connection to tor control"); Log.i(TAG, "Attempting manual java connection to tor control");
try { try {
Socket socket = new Socket("127.0.0.1", 5051); Socket socket = new Socket("127.0.0.1", 9051);
PrintWriter out =
new PrintWriter(socket.getOutputStream(), true);
BufferedReader in =
new BufferedReader(
new InputStreamReader(socket.getInputStream()));
out.write("hello");
//String result = in.readLine();
Log.i(TAG, "wrote");
//in.close();
socket.close();
} catch (Exception e) { } catch (Exception e) {
Log.e(TAG, e.toString()); Log.e(TAG, e.toString());
Log.e(TAG, Log.getStackTraceString(e)); Log.e(TAG, Log.getStackTraceString(e));
} }
Log.i(TAG, "Go Net Test...");
try {
boolean ok = GoRicochetMobile.testNet();
Log.i(TAG, "NetTest: " + ok);
} catch(Exception e) {
}
Log.i(TAG, "Starting Echo Bot"); Log.i(TAG, "Starting Echo Bot");
GoRicochetMobile.echoBot(privateKey); GoRicochetMobile.echoBot(privateKey);
} }
} }

View File

@ -82,7 +82,7 @@
android:id="@+id/textView3" android:id="@+id/textView3"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="ControlPort 5051" android:text="ControlPort 9051"
android:layout_marginTop="7dp" android:layout_marginTop="7dp"
app:layout_constraintTop_toBottomOf="@+id/textView2" app:layout_constraintTop_toBottomOf="@+id/textView2"
android:layout_marginRight="8dp" android:layout_marginRight="8dp"