use of org.csploit.android.gui.dialogs.InputDialog in project android by cSploit.
the class PortScanner method onOptionsItemSelected.
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()) {
case R.id.scanner_custom_parameters:
if (item.isChecked())
hideParametersField();
else
displayParametersField();
item.setChecked(!item.isChecked());
return true;
case R.id.select_ports:
new InputDialog(getString(R.string.select_ports), getString(R.string.enter_ports_list), this, new InputDialogListener() {
@Override
public void onInputEntered(String input) {
input = input.trim();
if (!input.isEmpty()) {
String[] ports = input.split("[^\\d]+");
for (String port : ports) {
try {
if (port.isEmpty())
throw new Exception(getString(R.string.invalid_port_) + port + "'.");
else {
int iport = Integer.parseInt(port);
if (iport <= 0 || iport > 65535)
throw new Exception(getString(R.string.port_must_be_greater));
}
} catch (Exception e) {
new ErrorDialog("Error", e.toString(), PortScanner.this).show();
return;
}
}
mCustomPorts = "";
for (int i = 0, last = ports.length - 1; i < ports.length; i++) {
mCustomPorts += ports[i];
if (i != last)
mCustomPorts += ",";
}
if (mCustomPorts.isEmpty()) {
mCustomPorts = null;
new ErrorDialog(getString(R.string.error), getString(R.string.invalid_ports), PortScanner.this).show();
}
hideParametersField();
mMenu.findItem(R.id.scanner_custom_parameters).setChecked(false);
Logger.debug("mCustomPorts = " + mCustomPorts);
} else
new ErrorDialog(getString(R.string.error), getString(R.string.empty_port_list), PortScanner.this).show();
}
}).show();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
use of org.csploit.android.gui.dialogs.InputDialog 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);
}
}
}
Aggregations