Browse Source

First steps...

mip-it 10 years ago
commit
a468c67df0
100 changed files with 956 additions and 0 deletions
  1. 9 0
      .classpath
  2. 33 0
      .project
  3. 4 0
      .settings/org.eclipse.jdt.core.prefs
  4. 32 0
      AndroidManifest.xml
  5. 32 0
      bin/AndroidManifest.xml
  6. BIN
      bin/classes.dex
  7. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/BuildConfig.class
  8. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/HoneyHandler.class
  9. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/HoneyListener.class
  10. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/HoneyService$LocalBinder.class
  11. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/HoneyService.class
  12. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/R$anim.class
  13. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/R$array.class
  14. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/R$attr.class
  15. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/R$dimen.class
  16. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/R$drawable.class
  17. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/R$id.class
  18. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/R$layout.class
  19. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/R$menu.class
  20. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/R$string.class
  21. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/R$style.class
  22. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/R.class
  23. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/logging/FileLogger.class
  24. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/logging/Logger.class
  25. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/logging/Record$TYPE.class
  26. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/logging/Record.class
  27. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/protocol/ECHO.class
  28. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/protocol/FTP$STATE.class
  29. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/protocol/FTP.class
  30. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/protocol/HTTP$STATE.class
  31. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/protocol/HTTP.class
  32. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/protocol/HTTPS$STATE.class
  33. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/protocol/HTTPS.class
  34. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/protocol/Protocol$TALK_FIRST.class
  35. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/protocol/Protocol.class
  36. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/protocol/SMB$STATE.class
  37. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/protocol/SMB.class
  38. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/protocol/SSH$STATE.class
  39. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/protocol/SSH.class
  40. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/ui/ListViewAdapter.class
  41. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/ui/MainActivity$1.class
  42. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/ui/MainActivity$2.class
  43. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/ui/MainActivity$3.class
  44. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/ui/MainActivity$4.class
  45. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/ui/MainActivity$5.class
  46. BIN
      bin/classes/de/tudarmstadt/informatik/hostage/ui/MainActivity.class
  47. BIN
      bin/dexedLibs/android-support-v4-42c19cdadff6b0f8b63bf06fb4b73720.jar
  48. BIN
      bin/hostage.apk
  49. 3 0
      bin/jarlist.cache
  50. BIN
      bin/res/drawable-hdpi/ic_launcher.png
  51. BIN
      bin/res/drawable-hdpi/light_green.png
  52. BIN
      bin/res/drawable-hdpi/light_green_large.png
  53. BIN
      bin/res/drawable-hdpi/light_grey.png
  54. BIN
      bin/res/drawable-hdpi/light_grey_large.png
  55. BIN
      bin/res/drawable-hdpi/light_red.png
  56. BIN
      bin/res/drawable-hdpi/light_red_large.png
  57. BIN
      bin/res/drawable-hdpi/light_yellow.png
  58. BIN
      bin/res/drawable-hdpi/light_yellow_large.png
  59. BIN
      bin/res/drawable-mdpi/ic_launcher.png
  60. BIN
      bin/res/drawable-xhdpi/ic_launcher.png
  61. BIN
      bin/res/drawable-xxhdpi/ic_launcher.png
  62. BIN
      bin/resources.ap_
  63. 6 0
      gen/de/tudarmstadt/informatik/hostage/BuildConfig.java
  64. 109 0
      gen/de/tudarmstadt/informatik/hostage/R.java
  65. BIN
      ic_launcher-web.png
  66. BIN
      libs/android-support-v4.jar
  67. 20 0
      proguard-project.txt
  68. 14 0
      project.properties
  69. 10 0
      res/anim/in_left_to_right.xml
  70. 10 0
      res/anim/in_right_to_left.xml
  71. 10 0
      res/anim/out_left_to_right.xml
  72. 10 0
      res/anim/out_right_to_left.xml
  73. BIN
      res/drawable-hdpi/ic_launcher.png
  74. BIN
      res/drawable-hdpi/light_green.png
  75. BIN
      res/drawable-hdpi/light_green_large.png
  76. BIN
      res/drawable-hdpi/light_grey.png
  77. BIN
      res/drawable-hdpi/light_grey_large.png
  78. BIN
      res/drawable-hdpi/light_red.png
  79. BIN
      res/drawable-hdpi/light_red_large.png
  80. BIN
      res/drawable-hdpi/light_yellow.png
  81. BIN
      res/drawable-hdpi/light_yellow_large.png
  82. BIN
      res/drawable-mdpi/ic_launcher.png
  83. BIN
      res/drawable-xhdpi/ic_launcher.png
  84. BIN
      res/drawable-xxhdpi/ic_launcher.png
  85. 128 0
      res/layout/activity_main.xml
  86. 45 0
      res/layout/list_view_protocols_row.xml
  87. 9 0
      res/menu/main.xml
  88. 8 0
      res/values-sw600dp/dimens.xml
  89. 9 0
      res/values-sw720dp-land/dimens.xml
  90. 11 0
      res/values-v11/styles.xml
  91. 12 0
      res/values-v14/styles.xml
  92. 7 0
      res/values/dimens.xml
  93. 13 0
      res/values/protocols.xml
  94. 16 0
      res/values/strings.xml
  95. 20 0
      res/values/styles.xml
  96. 115 0
      src/de/tudarmstadt/informatik/hostage/HoneyHandler.java
  97. 89 0
      src/de/tudarmstadt/informatik/hostage/HoneyListener.java
  98. 121 0
      src/de/tudarmstadt/informatik/hostage/HoneyService.java
  99. 42 0
      src/de/tudarmstadt/informatik/hostage/logging/FileLogger.java
  100. 9 0
      src/de/tudarmstadt/informatik/hostage/logging/Logger.java

+ 9 - 0
.classpath

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="src" path="gen"/>
+	<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
+	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
+	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
+	<classpathentry kind="output" path="bin/classes"/>
+</classpath>

+ 33 - 0
.project

@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>hostage</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>com.android.ide.eclipse.adt.ApkBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

+ 4 - 0
.settings/org.eclipse.jdt.core.prefs

@@ -0,0 +1,4 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.source=1.6

+ 32 - 0
AndroidManifest.xml

@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="de.tudarmstadt.informatik.hostage"
+    android:versionCode="1"
+    android:versionName="1.0" >
+
+    <uses-sdk
+        android:minSdkVersion="8"
+        android:targetSdkVersion="17" />
+
+    <uses-permission android:name="android.permission.INTERNET" />
+
+    <application
+        android:allowBackup="true"
+        android:icon="@drawable/ic_launcher"
+        android:label="@string/app_name"
+        android:theme="@style/AppTheme" >
+        <activity
+            android:name="de.tudarmstadt.informatik.hostage.ui.MainActivity"
+            android:label="@string/app_name" >
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+
+        <service android:name="de.tudarmstadt.informatik.hostage.HoneyService" >
+        </service>
+    </application>
+
+</manifest>

+ 32 - 0
bin/AndroidManifest.xml

@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="de.tudarmstadt.informatik.hostage"
+    android:versionCode="1"
+    android:versionName="1.0" >
+
+    <uses-sdk
+        android:minSdkVersion="8"
+        android:targetSdkVersion="17" />
+
+    <uses-permission android:name="android.permission.INTERNET" />
+
+    <application
+        android:allowBackup="true"
+        android:icon="@drawable/ic_launcher"
+        android:label="@string/app_name"
+        android:theme="@style/AppTheme" >
+        <activity
+            android:name="de.tudarmstadt.informatik.hostage.ui.MainActivity"
+            android:label="@string/app_name" >
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+
+        <service android:name="de.tudarmstadt.informatik.hostage.HoneyService" >
+        </service>
+    </application>
+
+</manifest>

BIN
bin/classes.dex


BIN
bin/classes/de/tudarmstadt/informatik/hostage/BuildConfig.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/HoneyHandler.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/HoneyListener.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/HoneyService$LocalBinder.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/HoneyService.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/R$anim.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/R$array.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/R$attr.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/R$dimen.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/R$drawable.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/R$id.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/R$layout.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/R$menu.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/R$string.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/R$style.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/R.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/logging/FileLogger.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/logging/Logger.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/logging/Record$TYPE.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/logging/Record.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/protocol/ECHO.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/protocol/FTP$STATE.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/protocol/FTP.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/protocol/HTTP$STATE.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/protocol/HTTP.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/protocol/HTTPS$STATE.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/protocol/HTTPS.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/protocol/Protocol$TALK_FIRST.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/protocol/Protocol.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/protocol/SMB$STATE.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/protocol/SMB.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/protocol/SSH$STATE.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/protocol/SSH.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/ui/ListViewAdapter.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/ui/MainActivity$1.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/ui/MainActivity$2.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/ui/MainActivity$3.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/ui/MainActivity$4.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/ui/MainActivity$5.class


BIN
bin/classes/de/tudarmstadt/informatik/hostage/ui/MainActivity.class


BIN
bin/dexedLibs/android-support-v4-42c19cdadff6b0f8b63bf06fb4b73720.jar


BIN
bin/hostage.apk


+ 3 - 0
bin/jarlist.cache

@@ -0,0 +1,3 @@
+# cache for current jar dependency. DO NOT EDIT.
+# format is <lastModified> <length> <SHA-1> <path>
+# Encoding is UTF-8

BIN
bin/res/drawable-hdpi/ic_launcher.png


BIN
bin/res/drawable-hdpi/light_green.png


BIN
bin/res/drawable-hdpi/light_green_large.png


BIN
bin/res/drawable-hdpi/light_grey.png


BIN
bin/res/drawable-hdpi/light_grey_large.png


BIN
bin/res/drawable-hdpi/light_red.png


BIN
bin/res/drawable-hdpi/light_red_large.png


BIN
bin/res/drawable-hdpi/light_yellow.png


BIN
bin/res/drawable-hdpi/light_yellow_large.png


BIN
bin/res/drawable-mdpi/ic_launcher.png


BIN
bin/res/drawable-xhdpi/ic_launcher.png


BIN
bin/res/drawable-xxhdpi/ic_launcher.png


BIN
bin/resources.ap_


+ 6 - 0
gen/de/tudarmstadt/informatik/hostage/BuildConfig.java

@@ -0,0 +1,6 @@
+/** Automatically generated file. DO NOT MODIFY */
+package de.tudarmstadt.informatik.hostage;
+
+public final class BuildConfig {
+    public final static boolean DEBUG = true;
+}

+ 109 - 0
gen/de/tudarmstadt/informatik/hostage/R.java

@@ -0,0 +1,109 @@
+/* AUTO-GENERATED FILE.  DO NOT MODIFY.
+ *
+ * This class was automatically generated by the
+ * aapt tool from the resource data it found.  It
+ * should not be modified by hand.
+ */
+
+package de.tudarmstadt.informatik.hostage;
+
+public final class R {
+    public static final class anim {
+        public static final int in_left_to_right=0x7f040000;
+        public static final int in_right_to_left=0x7f040001;
+        public static final int out_left_to_right=0x7f040002;
+        public static final int out_right_to_left=0x7f040003;
+    }
+    public static final class array {
+        public static final int protocols=0x7f060000;
+    }
+    public static final class attr {
+    }
+    public static final class dimen {
+        /**  Default screen margins, per the Android Design guidelines. 
+
+         Customize dimensions originally defined in res/values/dimens.xml (such as
+         screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
+    
+         */
+        public static final int activity_horizontal_margin=0x7f050000;
+        public static final int activity_vertical_margin=0x7f050001;
+    }
+    public static final class drawable {
+        public static final int ic_launcher=0x7f020000;
+        public static final int light_green=0x7f020001;
+        public static final int light_green_large=0x7f020002;
+        public static final int light_grey=0x7f020003;
+        public static final int light_grey_large=0x7f020004;
+        public static final int light_red=0x7f020005;
+        public static final int light_red_large=0x7f020006;
+        public static final int light_yellow=0x7f020007;
+        public static final int light_yellow_large=0x7f020008;
+    }
+    public static final class id {
+        public static final int TextViewServices=0x7f0a000a;
+        public static final int action_settings=0x7f0a000f;
+        public static final int checkBoxParanoid=0x7f0a0003;
+        public static final int imageViewLight=0x7f0a0002;
+        public static final int listViewProtocols=0x7f0a000b;
+        public static final int textViewConnections=0x7f0a000d;
+        public static final int textViewConnectionsValue=0x7f0a000e;
+        public static final int textViewDetails=0x7f0a0005;
+        public static final int textViewIP=0x7f0a0008;
+        public static final int textViewIPValue=0x7f0a0009;
+        public static final int textViewProtocol=0x7f0a000c;
+        public static final int textViewSSID=0x7f0a0006;
+        public static final int textViewSSIDValue=0x7f0a0007;
+        public static final int textViewStatus=0x7f0a0001;
+        public static final int toggleButtonOnOff=0x7f0a0004;
+        public static final int viewAnimator=0x7f0a0000;
+    }
+    public static final class layout {
+        public static final int activity_main=0x7f030000;
+        public static final int list_view_protocols_row=0x7f030001;
+    }
+    public static final class menu {
+        public static final int main=0x7f090000;
+    }
+    public static final class string {
+        public static final int action_settings=0x7f070001;
+        public static final int app_name=0x7f070000;
+        public static final int capital_off=0x7f070003;
+        public static final int capital_on=0x7f070002;
+        public static final int connections=0x7f07000a;
+        public static final int details=0x7f070006;
+        public static final int ip=0x7f070008;
+        public static final int paranoid=0x7f070005;
+        public static final int services=0x7f070009;
+        public static final int ssid=0x7f070007;
+        public static final int status=0x7f070004;
+    }
+    public static final class style {
+        /** 
+        Base application theme, dependent on API level. This theme is replaced
+        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
+    
+
+            Theme customizations available in newer API levels can go in
+            res/values-vXX/styles.xml, while customizations related to
+            backward-compatibility can go here.
+        
+
+        Base application theme for API 11+. This theme completely replaces
+        AppBaseTheme from res/values/styles.xml on API 11+ devices.
+    
+ API 11 theme customizations can go here. 
+
+        Base application theme for API 14+. This theme completely replaces
+        AppBaseTheme from BOTH res/values/styles.xml and
+        res/values-v11/styles.xml on API 14+ devices.
+    
+ API 14 theme customizations can go here. 
+         */
+        public static final int AppBaseTheme=0x7f080000;
+        /**  Application theme. 
+ All customizations that are NOT specific to a particular API-level can go here. 
+         */
+        public static final int AppTheme=0x7f080001;
+    }
+}

BIN
ic_launcher-web.png


BIN
libs/android-support-v4.jar


+ 20 - 0
proguard-project.txt

@@ -0,0 +1,20 @@
+# To enable ProGuard in your project, edit project.properties
+# to define the proguard.config property as described in that file.
+#
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in ${sdk.dir}/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the ProGuard
+# include property in project.properties.
+#
+# For more details, see
+#   http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+#   public *;
+#}

+ 14 - 0
project.properties

@@ -0,0 +1,14 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system edit
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+#
+# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
+#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
+
+# Project target.
+target=android-17

+ 10 - 0
res/anim/in_left_to_right.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+    android:interpolator="@android:anim/accelerate_interpolator" >
+
+    <translate
+        android:duration="250"
+        android:fromXDelta="-100%"
+        android:toXDelta="0" />
+
+</set>

+ 10 - 0
res/anim/in_right_to_left.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+    android:interpolator="@android:anim/accelerate_interpolator" >
+
+    <translate
+        android:duration="250"
+        android:fromXDelta="100%"
+        android:toXDelta="0" />
+
+</set>

+ 10 - 0
res/anim/out_left_to_right.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+    android:interpolator="@android:anim/accelerate_interpolator" >
+
+    <translate
+        android:duration="250"
+        android:fromXDelta="0"
+        android:toXDelta="100%" />
+
+</set>

+ 10 - 0
res/anim/out_right_to_left.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android"
+    android:interpolator="@android:anim/accelerate_interpolator" >
+
+    <translate
+        android:duration="250"
+        android:fromXDelta="0"
+        android:toXDelta="-100%" />
+
+</set>

BIN
res/drawable-hdpi/ic_launcher.png


BIN
res/drawable-hdpi/light_green.png


BIN
res/drawable-hdpi/light_green_large.png


BIN
res/drawable-hdpi/light_grey.png


BIN
res/drawable-hdpi/light_grey_large.png


BIN
res/drawable-hdpi/light_red.png


BIN
res/drawable-hdpi/light_red_large.png


BIN
res/drawable-hdpi/light_yellow.png


BIN
res/drawable-hdpi/light_yellow_large.png


BIN
res/drawable-mdpi/ic_launcher.png


BIN
res/drawable-xhdpi/ic_launcher.png


BIN
res/drawable-xxhdpi/ic_launcher.png


+ 128 - 0
res/layout/activity_main.xml

@@ -0,0 +1,128 @@
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:paddingBottom="@dimen/activity_vertical_margin"
+    android:paddingLeft="@dimen/activity_horizontal_margin"
+    android:paddingRight="@dimen/activity_horizontal_margin"
+    android:paddingTop="@dimen/activity_vertical_margin"
+    tools:context=".MainActivity" >
+
+    <ViewAnimator
+        android:id="@+id/viewAnimator"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent" >
+
+        <RelativeLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent" >
+
+            <TextView
+                android:id="@+id/textViewStatus"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_above="@+id/imageViewLight"
+                android:layout_centerHorizontal="true"
+                android:text="@string/status"
+                android:textAppearance="?android:attr/textAppearanceLarge" />
+
+            <ImageView
+                android:id="@+id/imageViewLight"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_centerHorizontal="true"
+                android:layout_centerVertical="true"
+                android:src="@drawable/light_grey_large" />
+
+            <CheckBox
+                android:id="@+id/checkBoxParanoid"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_alignParentBottom="true"
+                android:layout_alignParentLeft="true"
+                android:text="@string/paranoid" />
+
+            <ToggleButton
+                android:id="@+id/toggleButtonOnOff"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_alignParentBottom="true"
+                android:layout_alignParentRight="true"
+                android:onClick="buttonOnOffClick"
+                android:textOff="@string/capital_off"
+                android:textOn="@string/capital_on" />
+        </RelativeLayout>
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:orientation="vertical" >
+
+            <TextView
+                android:id="@+id/textViewDetails"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/details"
+                android:textAppearance="?android:attr/textAppearanceLarge" />
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content" >
+
+                <TextView
+                    android:id="@+id/textViewSSID"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:paddingLeft="20dp"
+                    android:text="@string/ssid"
+                    android:textAppearance="?android:attr/textAppearanceMedium" />
+
+                <TextView
+                    android:id="@+id/textViewSSIDValue"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:paddingLeft="5dp"
+                    android:text="-"
+                    android:textAppearance="?android:attr/textAppearanceMedium" />
+            </LinearLayout>
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content" >
+
+                <TextView
+                    android:id="@+id/textViewIP"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:paddingLeft="20dp"
+                    android:text="@string/ip"
+                    android:textAppearance="?android:attr/textAppearanceMedium" />
+
+                <TextView
+                    android:id="@+id/textViewIPValue"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:paddingLeft="5dp"
+                    android:text="-"
+                    android:textAppearance="?android:attr/textAppearanceMedium" />
+            </LinearLayout>
+
+            <TextView
+                android:id="@+id/TextViewServices"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/services"
+                android:textAppearance="?android:attr/textAppearanceLarge" />
+
+            <ListView
+                android:id="@+id/listViewProtocols"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:divider="#b5b5b5"
+                android:dividerHeight="1dp"
+                android:entries="@array/protocols" >
+            </ListView>
+        </LinearLayout>
+    </ViewAnimator>
+
+</RelativeLayout>

+ 45 - 0
res/layout/list_view_protocols_row.xml

@@ -0,0 +1,45 @@
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:padding="5dp" >
+
+    <ImageView
+        android:id="@+id/imageViewLight"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content" />
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_centerVertical="true"
+        android:layout_toRightOf="@+id/imageViewLight"
+        android:orientation="vertical" >
+
+        <TextView
+            android:id="@+id/textViewProtocol"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textAppearance="?android:attr/textAppearanceLarge" />
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal" >
+
+            <TextView
+                android:id="@+id/textViewConnections"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/connections"
+                android:textAppearance="?android:attr/textAppearanceSmall" />
+
+            <TextView
+                android:id="@+id/textViewConnectionsValue"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:paddingLeft="5dp"
+                android:textAppearance="?android:attr/textAppearanceSmall" />
+        </LinearLayout>
+    </LinearLayout>
+
+</RelativeLayout>

+ 9 - 0
res/menu/main.xml

@@ -0,0 +1,9 @@
+<menu xmlns:android="http://schemas.android.com/apk/res/android" >
+
+    <item
+        android:id="@+id/action_settings"
+        android:orderInCategory="100"
+        android:showAsAction="never"
+        android:title="@string/action_settings"/>
+
+</menu>

+ 8 - 0
res/values-sw600dp/dimens.xml

@@ -0,0 +1,8 @@
+<resources>
+
+    <!--
+         Customize dimensions originally defined in res/values/dimens.xml (such as
+         screen margins) for sw600dp devices (e.g. 7" tablets) here.
+    -->
+
+</resources>

+ 9 - 0
res/values-sw720dp-land/dimens.xml

@@ -0,0 +1,9 @@
+<resources>
+
+    <!--
+         Customize dimensions originally defined in res/values/dimens.xml (such as
+         screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
+    -->
+    <dimen name="activity_horizontal_margin">128dp</dimen>
+
+</resources>

+ 11 - 0
res/values-v11/styles.xml

@@ -0,0 +1,11 @@
+<resources>
+
+    <!--
+        Base application theme for API 11+. This theme completely replaces
+        AppBaseTheme from res/values/styles.xml on API 11+ devices.
+    -->
+    <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
+        <!-- API 11 theme customizations can go here. -->
+    </style>
+
+</resources>

+ 12 - 0
res/values-v14/styles.xml

@@ -0,0 +1,12 @@
+<resources>
+
+    <!--
+        Base application theme for API 14+. This theme completely replaces
+        AppBaseTheme from BOTH res/values/styles.xml and
+        res/values-v11/styles.xml on API 14+ devices.
+    -->
+    <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
+        <!-- API 14 theme customizations can go here. -->
+    </style>
+
+</resources>

+ 7 - 0
res/values/dimens.xml

@@ -0,0 +1,7 @@
+<resources>
+
+    <!-- Default screen margins, per the Android Design guidelines. -->
+    <dimen name="activity_horizontal_margin">16dp</dimen>
+    <dimen name="activity_vertical_margin">16dp</dimen>
+
+</resources>

+ 13 - 0
res/values/protocols.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+    <string-array name="protocols">
+        <item>ECHO</item>
+        <item>FTP</item>
+        <item>HTTP</item>
+        <item>HTTPS</item>
+        <item>SMB</item>
+        <item>SSH</item>
+    </string-array>
+
+</resources>

+ 16 - 0
res/values/strings.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+    <string name="app_name">Hostage</string>
+    <string name="action_settings">Settings</string>
+    <string name="capital_on">ON</string>
+    <string name="capital_off">OFF</string>
+    <string name="status">Status</string>
+    <string name="paranoid">Paranoid Mode</string>
+    <string name="details">Connection info</string>
+    <string name="ssid">SSID:</string>
+    <string name="ip">IP:</string>
+    <string name="services">Services</string>
+    <string name="connections">Active connections:</string>
+
+</resources>

+ 20 - 0
res/values/styles.xml

@@ -0,0 +1,20 @@
+<resources>
+
+    <!--
+        Base application theme, dependent on API level. This theme is replaced
+        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
+    -->
+    <style name="AppBaseTheme" parent="android:Theme.Light">
+        <!--
+            Theme customizations available in newer API levels can go in
+            res/values-vXX/styles.xml, while customizations related to
+            backward-compatibility can go here.
+        -->
+    </style>
+
+    <!-- Application theme. -->
+    <style name="AppTheme" parent="AppBaseTheme">
+        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
+    </style>
+
+</resources>

+ 115 - 0
src/de/tudarmstadt/informatik/hostage/HoneyHandler.java

@@ -0,0 +1,115 @@
+package de.tudarmstadt.informatik.hostage;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.net.Socket;
+
+import de.tudarmstadt.informatik.hostage.logging.Logger;
+import de.tudarmstadt.informatik.hostage.logging.Record;
+import de.tudarmstadt.informatik.hostage.logging.Record.TYPE;
+import de.tudarmstadt.informatik.hostage.protocol.Protocol;
+import de.tudarmstadt.informatik.hostage.protocol.Protocol.TALK_FIRST;
+
+public class HoneyHandler implements Runnable {
+
+	private static final int TIMEOUT = 30 * 1000;
+
+	private Protocol protocol;
+	private Socket client;
+	private Thread thread;
+
+	private HoneyService service;
+	private HoneyListener listener;
+	private Logger log;
+
+	public HoneyHandler(HoneyService service, HoneyListener listener,
+			Protocol protocol, Socket client) {
+		this.service = service;
+		this.listener = listener;
+		this.log = service.getLog();
+		this.protocol = protocol;
+		this.client = client;
+		this.thread = new Thread(this);
+		setSoTimeout(client);
+		thread.start();
+	}
+
+	private void setSoTimeout(Socket client) {
+		try {
+			client.setSoTimeout(TIMEOUT);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+	@Override
+	public void run() {
+		BufferedReader in;
+		BufferedWriter out;
+		try {
+			in = new BufferedReader(new InputStreamReader(
+					client.getInputStream()));
+			out = new BufferedWriter(new OutputStreamWriter(
+					client.getOutputStream()));
+			talkToClient(in, out);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		kill();
+	}
+
+	public void kill() {
+		thread.interrupt();
+		try {
+			client.close();
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		listener.refreshHandlers();
+	}
+
+	public boolean isTerminated() {
+		return thread.isInterrupted();
+	}
+
+	private void talkToClient(BufferedReader in, BufferedWriter out)
+			throws IOException {
+		String inputLine;
+		String outputLine;
+
+		if (protocol.whoTalksFirst() == TALK_FIRST.SERVER) {
+			outputLine = protocol.processMessage(null);
+			out.write(outputLine + "\n");
+			out.flush();
+			log.write(createRecord(TYPE.SEND, outputLine));
+		}
+
+		while (!thread.isInterrupted() && (inputLine = in.readLine()) != null) {
+			log.write(createRecord(TYPE.RECEIVE, inputLine));
+			outputLine = protocol.processMessage(inputLine);
+			if (outputLine != null) {
+				out.write(outputLine + "\n");
+				out.flush();
+				log.write(createRecord(TYPE.SEND, outputLine));
+			}
+			if (protocol.isClosed())
+				break;
+		}
+	}
+
+	private Record createRecord(TYPE type, String packet) {
+		Record record = new Record();
+		record.setType(type);
+		record.setTimestamp(System.currentTimeMillis());
+		record.setLocalIP(client.getLocalAddress());
+		record.setLocalPort(protocol.getPort());
+		record.setRemoteIP(client.getInetAddress());
+		record.setRemotePort(client.getPort());
+		record.setPacket(packet);
+		return record;
+	}
+
+}

+ 89 - 0
src/de/tudarmstadt/informatik/hostage/HoneyListener.java

@@ -0,0 +1,89 @@
+package de.tudarmstadt.informatik.hostage;
+
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.util.ArrayList;
+
+import de.tudarmstadt.informatik.hostage.protocol.Protocol;
+
+public class HoneyListener implements Runnable {
+
+	private ArrayList<HoneyHandler> handlers = new ArrayList<HoneyHandler>();
+
+	public int getHandlerCount() {
+		return handlers.size();
+	}
+
+	private Protocol protocol;
+	private ServerSocket server;
+	private Thread thread;
+
+	private HoneyService service;
+
+	private boolean running = false;
+
+	public boolean isRunning() {
+		return running;
+	}
+
+	public HoneyListener(HoneyService service, Protocol protocol) {
+		this.service = service;
+		this.protocol = protocol;
+	}
+
+	@Override
+	public void run() {
+		while (!thread.isInterrupted()) {
+			addHandler();
+		}
+		for (HoneyHandler handler : handlers) {
+			handler.kill();
+		}
+	}
+
+	public void start() {
+		try {
+			server = new ServerSocket(protocol.getPort());
+			(this.thread = new Thread(this)).start();
+			running = true;
+			service.notifyUI();
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+	public void stop() {
+		try {
+			thread.interrupt();
+			server.close();
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		running = false;
+		service.notifyUI();
+	}
+
+	public String getProtocolName() {
+		return protocol.toString();
+	}
+
+	public void refreshHandlers() {
+		for (HoneyHandler handler : handlers) {
+			if (handler.isTerminated()) {
+				handlers.remove(handler);
+			}
+		}
+		service.notifyUI();
+	}
+
+	private void addHandler() {
+		try {
+			Socket client = server.accept();
+			handlers.add(new HoneyHandler(service, this, protocol.getClass()
+					.newInstance(), client));
+			service.notifyUI();
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+}

+ 121 - 0
src/de/tudarmstadt/informatik/hostage/HoneyService.java

@@ -0,0 +1,121 @@
+package de.tudarmstadt.informatik.hostage;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import android.app.Service;
+import android.content.Intent;
+import android.os.Binder;
+import android.os.IBinder;
+import android.support.v4.content.LocalBroadcastManager;
+import de.tudarmstadt.informatik.hostage.logging.FileLogger;
+import de.tudarmstadt.informatik.hostage.logging.Logger;
+import de.tudarmstadt.informatik.hostage.protocol.Protocol;
+import de.tudarmstadt.informatik.hostage.ui.MainActivity;
+
+public class HoneyService extends Service {
+
+	private ArrayList<HoneyListener> listeners = new ArrayList<HoneyListener>();
+
+	public List<HoneyListener> getListeners() {
+		return listeners;
+	}
+
+	private Logger log;
+
+	public Logger getLog() {
+		return log;
+	}
+
+	private final IBinder mBinder = new LocalBinder();
+
+	public class LocalBinder extends Binder {
+		public HoneyService getService() {
+			return HoneyService.this;
+		}
+	}
+
+	@Override
+	public IBinder onBind(Intent intent) {
+		return mBinder;
+	}
+
+	@Override
+	public void onCreate() {
+		super.onCreate();
+		log = new FileLogger(getApplicationContext());
+		for (Protocol protocol : getProtocolArray()) {
+			listeners.add(new HoneyListener(this, protocol));
+		}
+	}
+
+	@Override
+	public void onDestroy() {
+		log.close();
+		super.onDestroy();
+	}
+
+	private ArrayList<Protocol> getProtocolArray() {
+		String[] protocols = getResources().getStringArray(R.array.protocols);
+		String packageName = Protocol.class.getPackage().getName();
+		ArrayList<Protocol> protocolArray = new ArrayList<Protocol>();
+
+		for (String protocol : protocols) {
+			try {
+				protocolArray.add((Protocol) Class.forName(
+						String.format("%s.%s", packageName, protocol))
+						.newInstance());
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+		}
+
+		return protocolArray;
+	}
+
+	public void notifyUI() {
+		Intent intent = new Intent(MainActivity.BROADCAST);
+		LocalBroadcastManager.getInstance(this).sendBroadcast(intent);
+	}
+
+	public void startListeners() {
+		for (HoneyListener listener : listeners) {
+			listener.start();
+		}
+	}
+
+	public void stopListeners() {
+		for (HoneyListener listener : listeners) {
+			listener.stop();
+		}
+	}
+
+	public void startListener(String protocolName) {
+		for (HoneyListener listener : listeners) {
+			if (listener.getProtocolName().equals(protocolName)) {
+				listener.start();
+			}
+		}
+	}
+
+	public void stopListener(String protocolName) {
+		for (HoneyListener listener : listeners) {
+			if (listener.getProtocolName().equals(protocolName)) {
+				listener.stop();
+			}
+		}
+	}
+
+	public void toggleListener(String protocolName) {
+		for (HoneyListener listener : listeners) {
+			if (listener.getProtocolName().equals(protocolName)) {
+				if (listener.isRunning()) {
+					stopListener(protocolName);
+				} else {
+					startListener(protocolName);
+				}
+			}
+		}
+	}
+
+}

+ 42 - 0
src/de/tudarmstadt/informatik/hostage/logging/FileLogger.java

@@ -0,0 +1,42 @@
+package de.tudarmstadt.informatik.hostage.logging;
+
+import java.io.FileOutputStream;
+
+import android.content.Context;
+
+public class FileLogger implements Logger {
+
+	private FileOutputStream log = null;
+
+	public FileLogger(Context context) {
+		try {
+			log = context.openFileOutput("hostage.log", Context.MODE_APPEND);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+	@Override
+	public synchronized void write(Record record) {
+		if (log != null) {
+			try {
+				log.write((record.toString() + "\n").getBytes());
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+		}
+	}
+
+	@Override
+	public void close() {
+		if (log != null) {
+			try {
+				log.flush();
+				log.close();
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+		}
+	}
+
+}

+ 9 - 0
src/de/tudarmstadt/informatik/hostage/logging/Logger.java

@@ -0,0 +1,9 @@
+package de.tudarmstadt.informatik.hostage.logging;
+
+public interface Logger {
+
+	void write(Record record);
+
+	void close();
+
+}

Some files were not shown because too many files changed in this diff