Search in sources :

Example 1 with WifiCrackDialogListener

use of org.csploit.android.gui.dialogs.WifiCrackDialog.WifiCrackDialogListener in project android by cSploit.

the class WifiScannerFragment method onListItemClick.

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);
    final ScanResult result = mAdapter.getItem(position);
    if (result != null) {
        final Keygen keygen = mWifiMatcher.getKeygen(result);
        mPreviousConfig = NetworkManager.getWifiConfiguration(mWifiManager, result);
        if (mPreviousConfig != null) {
            mWifiManager.removeNetwork(mPreviousConfig.networkId);
        }
        if (keygen != null && (result.capabilities.contains("WEP") || result.capabilities.contains("WPA"))) {
            mKeyList.clear();
            new WifiCrackDialog(result.SSID, getResources().getString(R.string.enter_key_or_crack), getActivity(), new WifiCrackDialogListener() {

                @Override
                public void onManualConnect(String key) {
                    mCurrentNetworkId = performConnection(result, key);
                    if (mCurrentNetworkId != -1)
                        mConnectionReceiver.register(getActivity());
                    else
                        mConnectionReceiver.unregister();
                }

                @Override
                public void onCrack() {
                    performCracking(keygen, result);
                }
            }).show();
        } else {
            if (result.capabilities.contains("WEP") || result.capabilities.contains("WPA")) {
                new InputDialog(result.SSID, getString(R.string.enter_wifi_key), null, true, true, getActivity(), new InputDialogListener() {

                    @Override
                    public void onInputEntered(String input) {
                        mCurrentNetworkId = performConnection(result, input);
                        if (mCurrentNetworkId != -1)
                            mConnectionReceiver.register(getActivity());
                        else
                            mConnectionReceiver.unregister();
                    }
                }).show();
            } else
                performConnection(result, null);
        }
    }
}
Also used : InputDialogListener(org.csploit.android.gui.dialogs.InputDialog.InputDialogListener) ScanResult(android.net.wifi.ScanResult) Keygen(org.csploit.android.wifi.Keygen) InputDialog(org.csploit.android.gui.dialogs.InputDialog) WifiCrackDialog(org.csploit.android.gui.dialogs.WifiCrackDialog) WifiCrackDialogListener(org.csploit.android.gui.dialogs.WifiCrackDialog.WifiCrackDialogListener)

Aggregations

ScanResult (android.net.wifi.ScanResult)1 InputDialog (org.csploit.android.gui.dialogs.InputDialog)1 InputDialogListener (org.csploit.android.gui.dialogs.InputDialog.InputDialogListener)1 WifiCrackDialog (org.csploit.android.gui.dialogs.WifiCrackDialog)1 WifiCrackDialogListener (org.csploit.android.gui.dialogs.WifiCrackDialog.WifiCrackDialogListener)1 Keygen (org.csploit.android.wifi.Keygen)1