-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 89acb5b
Showing
42 changed files
with
913 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Built application files | ||
/*/build/ | ||
|
||
# Crashlytics configuations | ||
com_crashlytics_export_strings.xml | ||
|
||
# Local configuration file (sdk path, etc) | ||
local.properties | ||
|
||
# Gradle generated files | ||
.gradle/ | ||
|
||
# Signing files | ||
.signing/ | ||
|
||
# User-specific configurations | ||
.idea/libraries/ | ||
.idea/workspace.xml | ||
.idea/tasks.xml | ||
.idea/.name | ||
.idea/compiler.xml | ||
.idea/copyright/profiles_settings.xml | ||
.idea/encodings.xml | ||
.idea/misc.xml | ||
.idea/modules.xml | ||
.idea/scopes/scope_settings.xml | ||
.idea/vcs.xml | ||
*.iml | ||
|
||
# OS-specific files | ||
.DS_Store | ||
.DS_Store? | ||
._* | ||
.Spotlight-V100 | ||
.Trashes | ||
ehthumbs.db | ||
Thumbs.db |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Copyright (c) 2016, Steinwurf ApS | ||
|
||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
Neither the name of adb-join-wifi nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | ||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
============= | ||
adb-join-wifi | ||
============= | ||
A simple app for making it possible to join a certain wifi access point from ADB | ||
without requiring a rooted device. | ||
|
||
.. contents:: Table of Contents: | ||
:local: | ||
|
||
Usage | ||
===== | ||
Build the app, either by importing the project into Android Studio or by using | ||
the following command (make sure you have set the ``ANDROID_HOME`` environment | ||
variable if you choose the latter):: | ||
|
||
./gradlew assembleDebug | ||
|
||
install the app:: | ||
|
||
adb install app/build/outputs/apk/app-debug.apk | ||
|
||
Use the Activity Manager (``am``) to start the application with the appropriate | ||
parameters:: | ||
|
||
adb shell am start -n com.steinwurf.adbjoinwifi/com.steinwurf.adbjoinwifi.MainActivity -e ssid [SSID] -e password_type [PASSWORD_TYPE] -e password [WIFI PASSWORD] | ||
|
||
If you want to join an access point without a password you shouldn't specify the | ||
password or password type. | ||
If you need to join an access point with a password you need to specify both. | ||
The password type should be either: | ||
|
||
* ``WPA``, or | ||
* ``WEP`` | ||
|
||
License | ||
======= | ||
adb-join-wifi is available under the BSD license. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 26 | ||
buildToolsVersion '26.0.2' | ||
useLibrary 'org.apache.http.legacy' | ||
defaultConfig { | ||
applicationId "com.geohot.towelroot" | ||
minSdkVersion 16 | ||
targetSdkVersion 23 | ||
versionCode 1 | ||
versionName "1.0" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
sourceSets { | ||
main { | ||
jniLibs.srcDir 'jniLibs' | ||
} | ||
} | ||
productFlavors { | ||
} | ||
} | ||
|
||
dependencies { | ||
compile fileTree(include: ['*.jar'], dir: 'libs') | ||
testCompile 'junit:junit:4.12' | ||
compile 'com.android.support:appcompat-v7:26.1.0' | ||
compile 'com.google.http-client:google-http-client-android:+' | ||
compile 'com.google.api-client:google-api-client-android:+' | ||
compile 'com.google.api-client:google-api-client-gson:+' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in /home/jpihl/Android/Sdk/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the proguardFiles | ||
# directive in build.gradle. | ||
# | ||
# 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 *; | ||
#} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.geohot.towelroot"> | ||
|
||
|
||
<!--<receiver android:nacom.geohot.towelroot.TowelRootroot$MyBroadcastReceiver">--> | ||
<!--<intent-filter android:priority="100">--> | ||
<!--<action android:name="android.mWifiwifi.STATE_CHANGE" />--> | ||
<!--</intent-filter>--> | ||
<!--</receiver>--> | ||
|
||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | ||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> | ||
<uses-permission android:name="android.permission.INTERNET"></uses-permission> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity android:name=".TowelRoot"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<!--<receiver android:nacom.geohot.towelroot.TowelRootroot$broadcastReceiver">--> | ||
<!--<intent-filter android:priority="100">--> | ||
<!--<action android:name="android.mWifiwifi.STATE_CHANGE" />--> | ||
<!--</intent-filter>--> | ||
<!--</receiver>--> | ||
|
||
</application> | ||
|
||
</manifest> |
83 changes: 83 additions & 0 deletions
83
app/src/main/java/com/geohot/towelroot/CheckSSIDBroadcastReceiver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
package com.geohot.towelroot; | ||
|
||
import android.content.BroadcastReceiver; | ||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.net.ConnectivityManager; | ||
import android.net.Network; | ||
import android.net.NetworkInfo; | ||
import android.net.wifi.WifiInfo; | ||
import android.net.wifi.WifiManager; | ||
import android.os.Build; | ||
import android.support.v7.app.AppCompatActivity; | ||
|
||
public class CheckSSIDBroadcastReceiver extends BroadcastReceiver | ||
{ | ||
public interface SSIDFoundListener | ||
{ | ||
void SSIDFound(); | ||
void WifiEnabled(); | ||
} | ||
|
||
private String mSSID; | ||
private SSIDFoundListener mSSIDFoundListener; | ||
|
||
CheckSSIDBroadcastReceiver(String SSID) | ||
{ | ||
mSSID = "\"".concat(SSID).concat("\""); | ||
} | ||
|
||
void setSSIDFoundListener(SSIDFoundListener listener) | ||
{ | ||
mSSIDFoundListener = listener; | ||
} | ||
|
||
@Override | ||
public void onReceive(Context context, Intent intent) { | ||
String action = intent.getAction(); | ||
WifiManager wifiManager = (WifiManager) context.getSystemService( | ||
AppCompatActivity.WIFI_SERVICE); | ||
if (action.equals(WifiManager.WIFI_STATE_CHANGED_ACTION)) | ||
{ | ||
if (wifiManager.isWifiEnabled()) | ||
mSSIDFoundListener.WifiEnabled(); | ||
} | ||
else if (action.equals(ConnectivityManager.CONNECTIVITY_ACTION)) | ||
{ | ||
ConnectivityManager connectionManager = (ConnectivityManager) context.getSystemService( | ||
Context.CONNECTIVITY_SERVICE); | ||
|
||
NetworkInfo wifiNetwork = null; | ||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) | ||
{ | ||
for(Network i : connectionManager.getAllNetworks()) | ||
{ | ||
NetworkInfo networkInfo = connectionManager.getNetworkInfo(i); | ||
if (networkInfo.getType() == ConnectivityManager.TYPE_WIFI) | ||
{ | ||
wifiNetwork = networkInfo; | ||
break; | ||
} | ||
} | ||
} | ||
else | ||
{ | ||
wifiNetwork = connectionManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI); | ||
} | ||
|
||
|
||
if (wifiNetwork != null && wifiNetwork.isConnectedOrConnecting()) | ||
{ | ||
WifiInfo wifiInfo = wifiManager.getConnectionInfo(); | ||
if (wifiInfo.getSSID().equals(mSSID)) | ||
{ | ||
if (mSSIDFoundListener != null) | ||
{ | ||
mSSIDFoundListener.SSIDFound(); | ||
mSSIDFoundListener = null; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.