Introduce
Learning about the technique has been a long time ago so I would like to change the item to write about how to make the application.
I occasionally fiddle with the wifi pass around by using my phone to try some common passes and found that there are quite a few wifi set passes that are very simple, but if you can automatically enter the pass, try connecting the pass, to the work is good then come in and use, what else, while failing, try another pass, try about 30 pass in the list of the most popular pass only, all the landlords put the hard pass already, just come and ask for it quickly. half the time
And after a long time groping almost drop several times, I also have a version that can be used to introduce to everyone.
Fanpage https://www.facebook.com/wifihunter.vn
Download the app: https://raw.githubusercontent.com/dangquanuet/wifi-hunter-public/develop/apk/wifi-hunter-version-1-0-2.apk
Android Wifi Hunter application allows you to scan wifi around, connect by entering a pass, or hunt pass. The application can be run offline.
As I said above, the application only automatically detects on about 30 most common wifi passes, but does not guarantee 100% detection of wifi pass.
As far as I know, there are many ways to find wifi pass with greater success rate or even 100% but of course it is also not easy for ordinary users so I will not discuss or debate here.
Apps made with the main purpose of fun, non-profit, only pass the password to use when there is no network, no intention to harm anyone so people consider when using and not criticizing themselves.
You may ask why I did not put the app on google play store, then I answered that the app is always in violation of the policy, so if it is up, it will be cut immediately. Don’t ask why the account is locked. If not through google play store, you can update the app, then I would say yes and how I will show it below.
And this project doesn’t have open source, so I just shared how to do it
Fasteners spec
- Tune in around the surrounding wifi based on the 30 most common passes
- Can be connected manually by entering the password
- Share the pass
- Save hunt history
- The application runs offline
Thiết kế
Because I don’t specialize in design, I have just edited and edited the UI of the app a few times with the simplest criteria to use.
Implement
Initialize project
Using the MovieDB base project I have created long ago and continue to maintain with new technologies of android.
https://github.com/dangquanuet/The-Movie-DB-Kotlin
Create a list of 30 popular wifi passes
This list, you can search online easily
1 2 | ["12345678","123456789","88888888","87654321","987654321","66666666","1234567890","0987654321","888888888","8888888888","66668888","68686868","99999999","00000000","11111111","22222222","33333333","44444444","55555555","77777777","password","qwertyui","qwertyuiop","asdfghjkl","abcdefgh","1q2w3e4r","1a2b3c4d","abcd1234","1234abcd","12341234","abcdabcd"] |
Tune in around the surrounding wifi based on the 30 most common passes
To perform the WiFi pass detection around, the application needs to do the following
- Scan wifi around
- Connect to wifi
- Getting connection status successful or failed
- Success, then spend
- If you fail, try the next pass until the end
Scan wifi around
To be able to display the list of surrounding wifi, you will need wifiManager to scan and listen to the broadcast action WifiManager.SCAN_RESULTS_AVAILABLE_ACTION
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <span class="token keyword">private</span> <span class="token keyword">val</span> wifiManager <span class="token operator">:</span> WifiManager <span class="token keyword">by</span> lazy <span class="token punctuation">{</span> applicationContext <span class="token operator">?</span> <span class="token punctuation">.</span> <span class="token function">getSystemService</span> <span class="token punctuation">(</span> Context <span class="token punctuation">.</span> WIFI_SERVICE <span class="token punctuation">)</span> <span class="token keyword">as</span> WifiManager <span class="token punctuation">}</span> wifiManager <span class="token punctuation">.</span> <span class="token function">startScan</span> <span class="token punctuation">(</span> <span class="token punctuation">)</span> <span class="token keyword">private</span> <span class="token keyword">val</span> wifiConnectivityReceiver <span class="token operator">=</span> <span class="token keyword">object</span> <span class="token operator">:</span> <span class="token function">BroadcastReceiver</span> <span class="token punctuation">(</span> <span class="token punctuation">)</span> <span class="token punctuation">{</span> <span class="token keyword">override</span> <span class="token keyword">fun</span> <span class="token function">onReceive</span> <span class="token punctuation">(</span> context <span class="token operator">:</span> Context <span class="token operator">?</span> <span class="token punctuation">,</span> intent <span class="token operator">:</span> Intent <span class="token operator">?</span> <span class="token punctuation">)</span> <span class="token punctuation">{</span> <span class="token keyword">when</span> <span class="token punctuation">(</span> intent <span class="token operator">?</span> <span class="token punctuation">.</span> action <span class="token punctuation">)</span> <span class="token punctuation">{</span> WifiManager <span class="token punctuation">.</span> SCAN_RESULTS_AVAILABLE_ACTION <span class="token operator">-></span> <span class="token punctuation">{</span> <span class="token keyword">if</span> <span class="token punctuation">(</span> intent <span class="token punctuation">.</span> <span class="token function">getBooleanExtra</span> <span class="token punctuation">(</span> WifiManager <span class="token punctuation">.</span> EXTRA_RESULTS_UPDATED <span class="token punctuation">,</span> <span class="token boolean">false</span> <span class="token punctuation">)</span> <span class="token punctuation">)</span> <span class="token punctuation">{</span> <span class="token comment">// scan wifi success, update available wifi list</span> <span class="token punctuation">}</span> <span class="token punctuation">}</span> |
Connect to wifi
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | <span class="token comment">/** * format wifi ssid */</span> <span class="token keyword">fun</span> <span class="token function">formatSsid</span> <span class="token punctuation">(</span> ssid <span class="token operator">:</span> String <span class="token operator">?</span> <span class="token punctuation">)</span> <span class="token operator">:</span> String <span class="token punctuation">{</span> <span class="token keyword">return</span> <span class="token string">"" <span class="token interpolation variable">$ssid</span> ""</span> <span class="token punctuation">}</span> <span class="token comment">/** * format wifi password */</span> <span class="token keyword">fun</span> <span class="token function">formatPassword</span> <span class="token punctuation">(</span> password <span class="token operator">:</span> String <span class="token operator">?</span> <span class="token punctuation">)</span> <span class="token operator">:</span> String <span class="token punctuation">{</span> <span class="token keyword">return</span> <span class="token string">"" <span class="token interpolation variable">$password</span> ""</span> <span class="token punctuation">}</span> <span class="token comment">// create netId</span> <span class="token keyword">val</span> netId <span class="token operator">=</span> wifiManager <span class="token punctuation">.</span> <span class="token function">addNetwork</span> <span class="token punctuation">(</span> <span class="token function">WifiConfiguration</span> <span class="token punctuation">(</span> <span class="token punctuation">)</span> <span class="token punctuation">.</span> <span class="token function">apply</span> <span class="token punctuation">{</span> SSID <span class="token operator">=</span> <span class="token function">formatSsid</span> <span class="token punctuation">(</span> ssid <span class="token punctuation">)</span> preSharedKey <span class="token operator">=</span> <span class="token function">formatPassword</span> <span class="token punctuation">(</span> password <span class="token punctuation">)</span> <span class="token punctuation">}</span> <span class="token punctuation">)</span> <span class="token comment">// connect to netId</span> wifiManager <span class="token punctuation">.</span> <span class="token function">apply</span> <span class="token punctuation">{</span> <span class="token function">disconnect</span> <span class="token punctuation">(</span> <span class="token punctuation">)</span> <span class="token function">enableNetwork</span> <span class="token punctuation">(</span> netId <span class="token punctuation">,</span> <span class="token boolean">true</span> <span class="token punctuation">)</span> <span class="token function">reconnect</span> <span class="token punctuation">(</span> <span class="token punctuation">)</span> <span class="token punctuation">}</span> |
Getting connection status successful or failed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | <span class="token keyword">private</span> <span class="token keyword">val</span> connectivityStatusReceiver <span class="token operator">=</span> <span class="token keyword">object</span> <span class="token operator">:</span> <span class="token function">BroadcastReceiver</span> <span class="token punctuation">(</span> <span class="token punctuation">)</span> <span class="token punctuation">{</span> <span class="token keyword">override</span> <span class="token keyword">fun</span> <span class="token function">onReceive</span> <span class="token punctuation">(</span> context <span class="token operator">:</span> Context <span class="token punctuation">,</span> intent <span class="token operator">:</span> Intent <span class="token punctuation">)</span> <span class="token punctuation">{</span> <span class="token keyword">val</span> networkInfo <span class="token operator">=</span> intent <span class="token punctuation">.</span> getParcelableExtra <span class="token operator"><</span> NetworkInfo <span class="token operator">></span> <span class="token punctuation">(</span> WifiManager <span class="token punctuation">.</span> EXTRA_NETWORK_INFO <span class="token punctuation">)</span> <span class="token keyword">val</span> activeNetworkInfo <span class="token operator">=</span> connectivityManager <span class="token punctuation">.</span> activeNetworkInfo <span class="token keyword">if</span> <span class="token punctuation">(</span> networkInfo <span class="token operator">==</span> <span class="token keyword">null</span> <span class="token punctuation">)</span> <span class="token punctuation">{</span> <span class="token keyword">if</span> <span class="token punctuation">(</span> intent <span class="token punctuation">.</span> action <span class="token operator">==</span> WifiManager <span class="token punctuation">.</span> SUPPLICANT_STATE_CHANGED_ACTION <span class="token operator">&&</span> intent <span class="token punctuation">.</span> <span class="token function">hasExtra</span> <span class="token punctuation">(</span> WifiManager <span class="token punctuation">.</span> EXTRA_SUPPLICANT_ERROR <span class="token punctuation">)</span> <span class="token punctuation">)</span> <span class="token punctuation">{</span> <span class="token comment">// failed to connect</span> <span class="token function">handleConnectFailed</span> <span class="token punctuation">(</span> <span class="token punctuation">)</span> <span class="token punctuation">}</span> <span class="token punctuation">}</span> <span class="token keyword">else</span> <span class="token punctuation">{</span> <span class="token keyword">if</span> <span class="token punctuation">(</span> networkInfo <span class="token punctuation">.</span> isConnected <span class="token punctuation">)</span> <span class="token punctuation">{</span> <span class="token comment">// connected</span> <span class="token function">handleConnectedToNetwork</span> <span class="token punctuation">(</span> <span class="token punctuation">)</span> <span class="token punctuation">}</span> <span class="token punctuation">}</span> <span class="token punctuation">}</span> <span class="token punctuation">}</span> |
Can be connected manually by entering the password
This part, just do the interface for the user to enter the password and then follow the section Connect to wifi
Share the pass
Share a simple pass, you can use the intent share, or invest more, you can use the library to generate wifi information: name + pass to QR code and share this QR code image, otherwise no need to enter the password manual to connect to anymore.
Save hunt history
This is only for using Room
The application runs offline
With the current wifi detection, the application can completely run offline without network.
Application update
Since the app cannot be uploaded to the google play store, I need to build a mechanism to update the app and I have written about this before, you can refer to
https://viblo.asia/p/tu-xay-dung-co-che-update-app-khi-khong-co-google-play-store-4P856OB1KY3
Runtime permission
To perform wifi scan and wifi state check, you will need runtime permission, so you can refer to the request runtime permission processing here.
https://viblo.asia/p/tu-refactor-phan-request-runtime-permission-in-android-bJzKmjqrZ9N
Hunt Service
You can completely connect the wifi to a service so that you can still use another app during the hunt, of course, you cannot use the network at that time.
Conclusion
Today’s article is over, see you later, and give it a try
Fanpage https://www.facebook.com/wifihunter.vn
Download the app: https://raw.githubusercontent.com/dangquanuet/wifi-hunter-public/develop/apk/wifi-hunter-version-1-0-2.apk