manadream / AndroidProxySetter

An android app that sets the proxy settings for a wifi access point by using adb
GNU General Public License v3.0
477 stars 96 forks source link

Network configurations are not being overwritten #4

Closed eamonnfaherty-productmadness closed 8 years ago

eamonnfaherty-productmadness commented 9 years ago

I am running the following multiple times: adb -s XXXXX shell am start -n tk.elevenk.proxysetter/.MainActivity -e host 10.131.35.42 -e port 7001 -e ssid MYWIFI -e key SOMESECRETKEY

Each time I run it I see a new (duplicate) network configuration saved in the wifi settings (on this activity https://adblockplus.org/en/android-images/wifi_settings.png?97)

I expected to see the existing network update instead of a new one appearing.

I am raising this as setting the configuration sometimes fails (about 20% of the time) and this this may be a symptom of the issue causing mine.

manadream commented 9 years ago

I expected this would occur potentially. This problem would take some investigation. To solve this problem you can try running the command with the additional extra -e reset-wifi true which will clear out all network configurations before creating the one required to connect to the wifi network given. Let me know if that workaround will solve the problem for now. This ticket will stay open though, until a real fix can be made.

eamonnfaherty-productmadness commented 9 years ago

It does not fix the issue.

I found that causing an error cleared it.

Do you have any idea what could be causing this issue?

manadream commented 9 years ago

Not sure. Could you post the logcat output when you encounter the error as well as the device/OS version? Then I'll see if I can reproduce it or see what's going on.

manadream commented 9 years ago

@eamonnfaherty-productmadness is this working for you now? Do you have the logs?

MaikNog commented 9 years ago

Hi. I seem to have the same issue and so I attach here. Below is my log from a Samsung S2 with Android 4.1.2

It creates a new "CUSTOMER" (~wifi name) every time the command is run.

07-08 06:13:14.546 13507-13507/? D/ProxySetterApp﹕ Received broadcast about wifi. Connected = true 07-08 06:13:14.546 13507-13507/? V/ProxySetterApp﹕ action: android.net.conn.CONNECTIVITY_CHANGE 07-08 06:13:14.546 13507-13507/? V/ProxySetterApp﹕ component: null 07-08 06:13:14.546 13507-13507/? V/ProxySetterApp﹕ key [networkInfo]: NetworkInfo: type: WIFI[], state: CONNECTED/CONNECTED, reason: (unspecified), extra: (none), roaming: false, failover: false, isAvailable: true 07-08 06:13:14.546 13507-13507/? V/ProxySetterApp﹕ key [inetCondition]: 0 07-08 06:13:14.546 13507-16167/? E/ProxySetterApp﹕ Error starting looper on thread java.lang.RuntimeException: Only one Looper may be created per thread at android.os.Looper.prepare(Looper.java:78) at android.os.Looper.prepare(Looper.java:73) at tk.elevenk.proxysetter.MainActivity$ProxyChangeAsync.doInBackground(MainActivity.java:80) at tk.elevenk.proxysetter.MainActivity$ProxyChangeAsync.doInBackground(MainActivity.java:60) at android.os.AsyncTask$2.call(AsyncTask.java:287) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) at java.util.concurrent.FutureTask.run(FutureTask.java:137) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) at java.lang.Thread.run(Thread.java:856) 07-08 06:13:14.546 13507-16167/? V/ProxySetterApp﹕ action: null 07-08 06:13:14.546 13507-16167/? V/ProxySetterApp﹕ component: ComponentInfo{tk.elevenk.proxysetter/tk.elevenk.proxysetter.MainActivity} 07-08 06:13:14.546 13507-16167/? V/ProxySetterApp﹕ key [port]: 8888 07-08 06:13:14.546 13507-16167/? V/ProxySetterApp﹕ key [ssid]: CUSTOMER 07-08 06:13:14.546 13507-16167/? V/ProxySetterApp﹕ key [host]: 111.11.11.11 07-08 06:13:14.546 13507-16167/? V/ProxySetterApp﹕ key [key]: PASSWORD 07-08 06:13:14.551 13507-16167/? D/ProxySetterApp﹕ {'CUSTOMER' - 'SECURITY_PSK'=* ID: 1 PRIO: 0 Channel: 6MAC ACL: 3 KeyMgmt: WPA_PSK WPA_EAP Protocols: WPA RSN AuthAlgorithms: PairwiseCiphers: TKIP CCMP GroupCiphers: WEP40 WEP104 TKIP CCMP PSK: eap: phase1: phase2: pac_file: identity: anonymous_identity: password: client_cert: private_key: engine: 0 engine_id: key_id: ca_cert: IP assignment: UNASSIGNED Proxy settings: STATIC LinkAddresses: [182.127.146.214/16,] Routes: [0.0.0.0/0 -> 182.127.2.1,] DnsAddresses: [210.167.111.222,210.167.220.220,] HttpProxy: [172.27.16.35] 8888 xl= } 07-08 06:13:14.596 13507-13507/? E/ProxySetterApp﹕ Executing proxy change request... 07-08 06:13:19.986 13507-13507/? D/ProxySetterApp﹕ Received broadcast about wifi. Connected = true 07-08 06:13:19.986 13507-13507/? V/ProxySetterApp﹕ action: android.net.conn.CONNECTIVITY_CHANGE 07-08 06:13:19.986 13507-13507/? V/ProxySetterApp﹕ component: null 07-08 06:13:19.986 13507-13507/? V/ProxySetterApp﹕ key [networkInfo]: NetworkInfo: type: WIFI[], state: CONNECTED/CONNECTED, reason: (unspecified), extra: (none), roaming: false, failover: false, isAvailable: true 07-08 06:13:19.986 13507-13507/? V/ProxySetterApp﹕ key [inetCondition]: 0 07-08 06:13:20.676 13507-16167/? D/ProxySetterApp﹕ {'CUSTOMER' - 'SECURITY_PSK'=* ID: 2 PRIO: 0 Channel: 6MAC ACL: 3 KeyMgmt: WPA_PSK WPA_EAP Protocols: WPA RSN AuthAlgorithms: PairwiseCiphers: TKIP CCMP GroupCiphers: WEP40 WEP104 TKIP CCMP PSK: eap: phase1: phase2: pac_file: identity: anonymous_identity: password: client_cert: private_key: engine: 0 engine_id: key_id: ca_cert: IP assignment: UNASSIGNED Proxy settings: UNASSIGNED LinkAddresses: [182.127.146.214/16,] Routes: [0.0.0.0/0 -> 182.127.2.1,] DnsAddresses: [210.167.111.222,210.167.220.220,] } 07-08 06:13:20.931 13507-13507/? E/ProxySetterApp﹕ Proxy on CUSTOMER with security SECURITY_PSK set to 111.11.11.11:8888 bypass: null 07-08 06:13:20.946 13507-13507/? E/ProxySetterApp﹕ Checking wifi connectivity... 07-08 06:13:22.946 13507-13507/? E/ProxySetterApp﹕ Wifi connected and proxy set!

manadream commented 9 years ago

Thanks for the logs. I'll try to get to this sometime this week or next.

manadream commented 8 years ago

@MaikNog I'm taking a look at this. What is the exact adb command you are running when you get this?

manadream commented 8 years ago

@MaikNog @eamonnfaherty-productmadness Try the latest release (0.1.3). I made some changes to it that should fix this problem. Let me know if this does not fix the issue.

MaikNog commented 8 years ago

Checked with version 0.1.3 on a Samsung S2 with Android 4.1.2. Works.

There are no more newly creates SSIDs, it sticks and updates the existing one.

manadream commented 8 years ago

Great, thanks. Closing this issue.