use of org.csploit.android.gui.dialogs.InputDialog in project android by cSploit.
the class MainFragment method targetAliasPrompt.
private void targetAliasPrompt(final Target target) {
new InputDialog(getString(R.string.target_alias), getString(R.string.set_alias), target.hasAlias() ? target.getAlias() : "", true, false, getActivity(), new InputDialogListener() {
@Override
public void onInputEntered(String input) {
target.setAlias(input);
mTargetAdapter.notifyDataSetChanged();
}
}).show();
}
use of org.csploit.android.gui.dialogs.InputDialog in project android by cSploit.
the class Hijacker method onCreate.
public void onCreate(Bundle savedInstanceState) {
SharedPreferences themePrefs = getSharedPreferences("THEME", 0);
Boolean isDark = themePrefs.getBoolean("isDark", false);
if (isDark)
setTheme(R.style.DarkTheme);
else
setTheme(R.style.AppTheme);
super.onCreate(savedInstanceState);
setTitle(System.getCurrentTarget() + " > MITM > " + getString(R.string.session_sniffer));
setContentView(R.layout.plugin_mitm_hijacker);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mHijackToggleButton = (ToggleButton) findViewById(R.id.hijackToggleButton);
mHijackProgress = (ProgressBar) findViewById(R.id.hijackActivity);
ListView mListView = (ListView) findViewById(R.id.listView);
mAdapter = new SessionListAdapter(R.layout.plugin_mitm_hijacker_list_item);
mSpoof = new SpoofSession();
mListView.setAdapter(mAdapter);
mListView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
final Session session = mAdapter.getByPosition(position);
if (session != null) {
new ConfirmDialog(getString(R.string.hijack_session), mRunning ? getString(R.string.start_hijacking) : getString(R.string.start_hijacking2), Hijacker.this, new ConfirmDialogListener() {
@Override
public void onConfirm() {
if (mRunning)
setStoppedState();
System.setCustomData(session);
startActivity(new Intent(Hijacker.this, HijackerWebView.class));
}
@Override
public void onCancel() {
}
}).show();
}
}
});
mListView.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
final Session session = mAdapter.getByPosition(position);
if (session != null) {
new InputDialog(getString(R.string.save_session), getString(R.string.set_session_filename), session.getFileName(), true, false, Hijacker.this, new InputDialogListener() {
@Override
public void onInputEntered(String name) {
if (!name.isEmpty()) {
try {
String filename = session.save(name);
Toast.makeText(Hijacker.this, getString(R.string.session_saved_to) + filename + " .", Toast.LENGTH_SHORT).show();
} catch (IOException e) {
new ErrorDialog(getString(R.string.error), e.toString(), Hijacker.this).show();
}
} else
new ErrorDialog(getString(R.string.error), getString(R.string.invalid_session), Hijacker.this).show();
}
}).show();
}
return true;
}
});
mHijackToggleButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (mRunning) {
setStoppedState();
} else {
setStartedState();
}
}
});
mRequestListener = new RequestListener();
}
use of org.csploit.android.gui.dialogs.InputDialog in project android by cSploit.
the class MainFragment method onOptionsItemSelected.
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
switch(item.getItemId()) {
case R.id.add:
new InputDialog(getString(R.string.add_custom_target), getString(R.string.enter_url), getActivity(), new InputDialogListener() {
@Override
public void onInputEntered(String input) {
final Target target = Target.getFromString(input);
if (target != null) {
ThreadHelper.getSharedExecutor().execute(new Runnable() {
@Override
public void run() {
System.addOrderedTarget(target);
}
});
} else
new ErrorDialog(getString(R.string.error), getString(R.string.invalid_target), getActivity()).show();
}
}).show();
return true;
case R.id.scan:
startNetworkRadar();
return true;
case R.id.wifi_ifaces:
displayNetworkInterfaces(true);
return true;
case R.id.wifi_scan:
stopNetworkRadar();
mRadarReceiver.unregister();
mUpdateReceiver.unregister();
startActivityForResult(new Intent(getActivity(), WifiScannerActivity.class), WIFI_CONNECTION_REQUEST);
getActivity().overridePendingTransition(R.anim.fadeout, R.anim.fadein);
return true;
case R.id.new_session:
new ConfirmDialog(getString(R.string.warning), getString(R.string.warning_new_session), getActivity(), new ConfirmDialogListener() {
@Override
public void onConfirm() {
try {
System.reset();
Toast.makeText(getActivity(), getString(R.string.new_session_started), Toast.LENGTH_SHORT).show();
} catch (Exception e) {
new FatalDialog(getString(R.string.error), e.toString(), getActivity()).show();
}
}
@Override
public void onCancel() {
}
}).show();
return true;
case R.id.save_session:
new InputDialog(getString(R.string.save_session), getString(R.string.enter_session_name), System.getSessionName(), true, false, getActivity(), new InputDialogListener() {
@Override
public void onInputEntered(String input) {
String name = input.trim().replace("/", "").replace("..", "");
if (!name.isEmpty()) {
try {
String filename = System.saveSession(name);
Toast.makeText(getActivity(), getString(R.string.session_saved_to) + filename + " .", Toast.LENGTH_SHORT).show();
} catch (IOException e) {
new ErrorDialog(getString(R.string.error), e.toString(), getActivity()).show();
}
} else
new ErrorDialog(getString(R.string.error), getString(R.string.invalid_session), getActivity()).show();
}
}).show();
return true;
case R.id.restore_session:
final ArrayList<String> sessions = System.getAvailableSessionFiles();
if (sessions != null && sessions.size() > 0) {
new SpinnerDialog(getString(R.string.select_session), getString(R.string.select_session_file), sessions.toArray(new String[sessions.size()]), getActivity(), new SpinnerDialogListener() {
@Override
public void onItemSelected(int index) {
String session = sessions.get(index);
try {
System.loadSession(session);
} catch (Exception e) {
e.printStackTrace();
new ErrorDialog(getString(R.string.error), e.getMessage(), getActivity()).show();
}
}
}).show();
} else
new ErrorDialog(getString(R.string.error), getString(R.string.no_session_found), getActivity()).show();
return true;
case R.id.settings:
startActivity(new Intent(getActivity(), SettingsActivity.class));
getActivity().overridePendingTransition(R.anim.fadeout, R.anim.fadein);
return true;
case R.id.ss_monitor:
new Thread(new Runnable() {
@Override
public void run() {
Services.getNetworkRadar().onMenuClick(getActivity(), item);
}
}).start();
return true;
case R.id.ss_msfrpcd:
new Thread(new Runnable() {
@Override
public void run() {
Services.getMsfRpcdService().onMenuClick(getActivity(), item);
}
}).start();
return true;
case R.id.submit_issue:
String uri = getString(R.string.github_new_issue_url);
Intent browser = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(browser);
// String.format(getString(R.string.issue_message), getString(R.string.github_issues_url), getString(R.string.github_new_issue_url));
return true;
case R.id.about:
new AboutDialog(getActivity()).show();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
use of org.csploit.android.gui.dialogs.InputDialog in project android by cSploit.
the class MITM method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
SharedPreferences themePrefs = getSharedPreferences("THEME", 0);
Boolean isDark = themePrefs.getBoolean("isDark", false);
if (isDark)
setTheme(R.style.DarkTheme);
else
setTheme(R.style.AppTheme);
super.onCreate(savedInstanceState);
new CheckForOpenPortsTask().execute();
mActionListView = (ListView) findViewById(R.id.actionListView);
mActionAdapter = new ActionAdapter(R.layout.plugin_mitm_list_item, mActions);
mActionListView.setAdapter(mActionAdapter);
mImagePicker = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
mImagePicker.setType("image/*");
mImagePicker.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
mScriptPicker = new Intent();
mScriptPicker.addCategory(Intent.CATEGORY_OPENABLE);
mScriptPicker.setType("text/*");
mScriptPicker.setAction(Intent.ACTION_GET_CONTENT);
mScriptPicker.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
mActions.add(new Action(getString(R.string.mitm_simple_sniff), getString(R.string.mitm_simple_sniff_desc), R.drawable.action_sniffer, new OnClickListener() {
@Override
public void onClick(View v) {
if (System.checkNetworking(MITM.this) == false)
return;
setStoppedState();
startActivity(new Intent(MITM.this, Sniffer.class));
overridePendingTransition(R.anim.fadeout, R.anim.fadein);
}
}, null));
mActions.add(new Action(getString(R.string.mitm_password_sniff), getString(R.string.mitm_password_sniff_desc), R.drawable.action_passwords, new OnClickListener() {
@Override
public void onClick(View v) {
if (!System.checkNetworking(MITM.this))
return;
setStoppedState();
startActivity(new Intent(MITM.this, PasswordSniffer.class));
overridePendingTransition(R.anim.fadeout, R.anim.fadein);
}
}, null));
mActions.add(new Action(getString(R.string.mitm_dns_spoofing), getString(R.string.mitm_dns_spoofing_desc), R.drawable.action_redirect, new OnClickListener() {
@Override
public void onClick(View v) {
if (!System.checkNetworking(MITM.this))
return;
setStoppedState();
startActivity(new Intent(MITM.this, DNSSpoofing.class));
overridePendingTransition(R.anim.fadeout, R.anim.fadein);
}
}, null));
mActions.add(new Action(getString(R.string.mitm_session_hijack), getString(R.string.mitm_session_hijack_desc), R.drawable.action_hijack, new OnClickListener() {
@Override
public void onClick(View v) {
if (!System.checkNetworking(MITM.this))
return;
setStoppedState();
startActivity(new Intent(MITM.this, Hijacker.class));
overridePendingTransition(R.anim.fadeout, R.anim.fadein);
}
}, null));
mActions.add(new Action(getString(R.string.mitm_connection_kill), getString(R.string.mitm_connection_kill_desc), R.drawable.action_kill, new OnClickListener() {
@Override
public void onClick(View v) {
if (!System.checkNetworking(MITM.this))
return;
final ProgressBar activity = (ProgressBar) v.findViewById(R.id.itemActivity);
if (activity.getVisibility() == View.INVISIBLE) {
if (System.getCurrentTarget().getType() != Target.Type.ENDPOINT) {
new ErrorDialog(getString(R.string.error), getString(R.string.mitm_connection_kill_error), MITM.this).show();
} else if (!System.getNetwork().haveGateway() && !System.getNetwork().isTetheringEnabled()) {
new ErrorDialog(getString(R.string.error), "Connection killer requires a gateway or active Tethering", MITM.this).show();
} else {
setStoppedState();
try {
if (System.getNetwork().haveGateway()) {
mConnectionKillerProcess = System.getTools().arpSpoof.spoof(System.getCurrentTarget(), new ArpSpoof.ArpSpoofReceiver() {
@Override
public void onStart(String cmd) {
super.onStart(cmd);
System.setForwarding(false);
}
@Override
public void onError(String line) {
MITM.this.runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(MITM.this, "arpspoof error", Toast.LENGTH_LONG).show();
activity.setVisibility(View.INVISIBLE);
}
});
}
});
} else {
mConnectionKillerProcess = null;
System.setForwarding(false);
}
activity.setVisibility(View.VISIBLE);
Toast.makeText(MITM.this, getString(R.string.tap_again), Toast.LENGTH_LONG).show();
} catch (ChildManager.ChildNotStartedException e) {
Toast.makeText(MITM.this, getString(R.string.child_not_started), Toast.LENGTH_LONG).show();
}
}
} else {
if (mConnectionKillerProcess != null) {
mConnectionKillerProcess.kill(2);
mConnectionKillerProcess = null;
}
if (!System.getNetwork().haveGateway() && System.getNetwork().isTetheringEnabled()) {
System.setForwarding(true);
}
activity.setVisibility(View.INVISIBLE);
}
}
}, new Action.ActionEnabler() {
@Override
public boolean isEnabled() {
return System.getNetwork().haveGateway() || System.getNetwork().isTetheringEnabled();
}
}));
mActions.add(new Action(getString(R.string.mitm_redirect), getString(R.string.mitm_redirect_desc), R.drawable.action_redirect, new OnClickListener() {
@Override
public void onClick(View v) {
if (System.checkNetworking(MITM.this) == false)
return;
final ProgressBar activity = (ProgressBar) v.findViewById(R.id.itemActivity);
if (activity.getVisibility() == View.INVISIBLE) {
setStoppedState();
new RedirectionDialog(getString(R.string.mitm_redirection), MITM.this, new RedirectionDialogListener() {
@Override
public void onInputEntered(String address, String port) {
if (address.isEmpty() == false && port.isEmpty() == false) {
try {
int iport = Integer.parseInt(port);
if (iport <= 0 || iport > 65535)
throw new Exception(getString(R.string.error_port_outofrange));
address = address.startsWith("http") ? address : "http://" + address;
URL url = new URL(address);
address = url.getHost();
activity.setVisibility(View.VISIBLE);
Toast.makeText(MITM.this, getString(R.string.tap_again), Toast.LENGTH_LONG).show();
final String faddress = address;
final int fport = iport;
mSpoofSession = new SpoofSession();
mSpoofSession.start(new OnSessionReadyListener() {
@Override
public void onSessionReady() {
System.getProxy().setRedirection(faddress, fport);
}
@Override
public void onError(String error, int resId) {
error = error == null ? getString(resId) : error;
setSpoofErrorState(error);
}
});
} catch (Exception e) {
new ErrorDialog(getString(R.string.error), e.getMessage(), MITM.this).show();
}
} else
new ErrorDialog(getString(R.string.error), getString(R.string.error_invalid_address_or_port), MITM.this).show();
}
}).show();
} else
setStoppedState();
}
}, null));
mActions.add(new Action(getString(R.string.mitm_image_replace), getString(R.string.mitm_image_replace_desc), R.drawable.action_image, new OnClickListener() {
@Override
public void onClick(View v) {
if (System.checkNetworking(MITM.this) == false)
return;
final ProgressBar activity = (ProgressBar) v.findViewById(R.id.itemActivity);
if (activity.getVisibility() == View.INVISIBLE) {
setStoppedState();
new ChoiceDialog(MITM.this, getString(R.string.choose_source), new String[] { getString(R.string.local_images), "Web URL" }, new ChoiceDialogListener() {
@Override
public void onChoice(int choice) {
if (choice == 0) {
try {
mCurrentActivity = activity;
startActivityForResult(mImagePicker, SELECT_PICTURE);
} catch (ActivityNotFoundException e) {
new ErrorDialog(getString(R.string.error), getString(R.string.error_image_intent), MITM.this).show();
}
} else {
new InputDialog(getString(R.string.image), getString(R.string.enter_image_url), "", true, false, MITM.this, new InputDialogListener() {
@Override
public void onInputEntered(String input) {
String image = input.trim();
if (image.isEmpty() == false) {
image = image.startsWith("http") ? image : "http://" + image;
activity.setVisibility(View.VISIBLE);
final String resource = image;
mSpoofSession = new SpoofSession();
try {
mSpoofSession.start(new OnSessionReadyListener() {
@Override
public void onSessionReady() {
System.getProxy().setFilter(new ProxyFilter() {
@Override
public String onDataReceived(String headers, String data) {
// handle img tags
data = data.replaceAll("(?i)<img([^/]+)src=(['\"])[^'\"]+(['\"])", "<img$1src=$2" + resource + "$3");
// handle css background declarations
data = data.replaceAll("(?i)background\\s*(:|-)\\s*url\\s*[\\(|:][^\\);]+\\)?.*", "background: url(" + resource + ")");
return data;
}
});
}
@Override
public void onError(String error, int resId) {
error = error == null ? getString(resId) : error;
setSpoofErrorState(error);
}
});
Toast.makeText(MITM.this, getString(R.string.tap_again), Toast.LENGTH_LONG).show();
} catch (ChildManager.ChildNotStartedException e) {
Toast.makeText(MITM.this, getString(R.string.child_not_started), Toast.LENGTH_LONG).show();
}
} else
new ErrorDialog(getString(R.string.error), getString(R.string.error_image_url), MITM.this).show();
}
}).show();
}
}
}).show();
} else {
mCurrentActivity = null;
setStoppedState();
}
}
}, null));
mActions.add(new Action(getString(R.string.mitm_video_replace), getString(R.string.mitm_video_replace_desc), R.drawable.action_youtube, new OnClickListener() {
@Override
public void onClick(View v) {
if (System.checkNetworking(MITM.this) == false)
return;
final ProgressBar activity = (ProgressBar) v.findViewById(R.id.itemActivity);
if (activity.getVisibility() == View.INVISIBLE) {
setStoppedState();
new InputDialog(getString(R.string.video), getString(R.string.enter_video_url), "http://www.youtube.com/watch?v=dQw4w9WgXcQ", true, false, MITM.this, new InputDialogListener() {
@Override
public void onInputEntered(String input) {
final String video = input.trim();
Matcher matcher = YOUTUBE_PATTERN.matcher(input);
if (video.isEmpty() == false && matcher != null && matcher.find()) {
final String videoId = matcher.group(1);
mSpoofSession = new SpoofSession();
try {
mSpoofSession.start(new OnSessionReadyListener() {
@Override
public void onSessionReady() {
System.getProxy().setFilter(new ProxyFilter() {
@Override
public String onDataReceived(String headers, String data) {
if (data.matches("(?s).+/v=[a-zA-Z0-9_-]+.+"))
data = data.replaceAll("(?s)/v=[a-zA-Z0-9_-]+", "/v=" + videoId);
else if (data.matches("(?s).+/v/[a-zA-Z0-9_-]+.+"))
data = data.replaceAll("(?s)/v/[a-zA-Z0-9_-]+", "/v/" + videoId);
else if (data.matches("(?s).+/embed/[a-zA-Z0-9_-]+.+"))
data = data.replaceAll("(?s)/embed/[a-zA-Z0-9_-]+", "/embed/" + videoId);
return data;
}
});
}
@Override
public void onError(String error, int resId) {
error = error == null ? getString(resId) : error;
setSpoofErrorState(error);
}
});
activity.setVisibility(View.VISIBLE);
Toast.makeText(MITM.this, getString(R.string.tap_again), Toast.LENGTH_LONG).show();
} catch (ChildManager.ChildNotStartedException e) {
System.errorLogging(e);
Toast.makeText(MITM.this, getString(R.string.child_not_started), Toast.LENGTH_LONG).show();
}
} else
new ErrorDialog(getString(R.string.error), getString(R.string.error_video_url), MITM.this).show();
}
}).show();
} else
setStoppedState();
}
}, null));
mActions.add(new Action(getString(R.string.mitm_script_injection), getString(R.string.mitm_script_injection_desc), R.drawable.action_injection, new OnClickListener() {
@Override
public void onClick(View v) {
if (!System.checkNetworking(MITM.this))
return;
final ProgressBar activity = (ProgressBar) v.findViewById(R.id.itemActivity);
if (activity.getVisibility() == View.INVISIBLE) {
setStoppedState();
new ChoiceDialog(MITM.this, getString(R.string.choose_method), new String[] { getString(R.string.local_files), getString(R.string.custom_code) }, new ChoiceDialogListener() {
@Override
public void onChoice(int choice) {
if (choice == 0) {
try {
mCurrentActivity = activity;
startActivityForResult(mScriptPicker, SELECT_SCRIPT);
} catch (ActivityNotFoundException e) {
new ErrorDialog(getString(R.string.error), getString(R.string.error_file_intent), MITM.this).show();
}
} else {
new InputDialog("Javascript", getString(R.string.enter_js_code), "<script type=\"text/javascript\">\n" + " alert('This site has been hacked with cSploit!');\n" + "</script>", true, false, MITM.this, new InputDialogListener() {
@Override
public void onInputEntered(String input) {
final String js = input.trim();
if (js.isEmpty() == false || js.startsWith("<script") == false) {
mSpoofSession = new SpoofSession();
try {
mSpoofSession.start(new OnSessionReadyListener() {
@Override
public void onSessionReady() {
System.getProxy().setFilter(new ProxyFilter() {
@Override
public String onDataReceived(String headers, String data) {
return data.replaceAll("(?i)</head>", js + "</head>");
}
});
}
@Override
public void onError(String error, int resId) {
error = error == null ? getString(resId) : error;
setSpoofErrorState(error);
}
});
activity.setVisibility(View.VISIBLE);
Toast.makeText(MITM.this, getString(R.string.tap_again), Toast.LENGTH_LONG).show();
} catch (ChildManager.ChildNotStartedException e) {
System.errorLogging(e);
Toast.makeText(MITM.this, getString(R.string.child_not_started), Toast.LENGTH_LONG).show();
}
} else
new ErrorDialog(getString(R.string.error), getString(R.string.error_js_code), MITM.this).show();
}
}).show();
}
}
}).show();
} else {
mCurrentActivity = null;
setStoppedState();
}
}
}, null));
mActions.add(new Action(getString(R.string.mitm_custom), getString(R.string.mitm_custom_desc), new OnClickListener() {
@Override
public void onClick(View v) {
if (!System.checkNetworking(MITM.this))
return;
final ProgressBar activity = (ProgressBar) v.findViewById(R.id.itemActivity);
if (activity.getVisibility() == View.INVISIBLE) {
setStoppedState();
new CustomFilterDialog(getString(R.string.custom_filter), MITM.this, new CustomFilterDialogListener() {
@Override
public void onInputEntered(final ArrayList<String> from, final ArrayList<String> to) {
if (from.isEmpty() == false && to.isEmpty() == false) {
try {
for (String exp : from) {
Pattern.compile(exp);
}
mSpoofSession = new SpoofSession();
mSpoofSession.start(new OnSessionReadyListener() {
@Override
public void onSessionReady() {
System.getProxy().setFilter(new ProxyFilter() {
@Override
public String onDataReceived(String headers, String data) {
for (int i = 0; i < from.size(); i++) {
data = data.replaceAll(from.get(i), to.get(i));
}
return data;
}
});
}
@Override
public void onError(String error, int resId) {
error = error == null ? getString(resId) : error;
setSpoofErrorState(error);
}
});
activity.setVisibility(View.VISIBLE);
Toast.makeText(MITM.this, getString(R.string.tap_again), Toast.LENGTH_LONG).show();
} catch (PatternSyntaxException e) {
new ErrorDialog(getString(R.string.error), getString(R.string.error_filter) + ": " + e.getDescription() + " .", MITM.this).show();
} catch (ChildManager.ChildNotStartedException e) {
System.errorLogging(e);
Toast.makeText(MITM.this, getString(R.string.child_not_started), Toast.LENGTH_LONG).show();
}
} else
new ErrorDialog(getString(R.string.error), getString(R.string.error_filter), MITM.this).show();
}
}).show();
} else
setStoppedState();
}
}));
}
use of org.csploit.android.gui.dialogs.InputDialog in project android by cSploit.
the class LoginCracker method onCreate.
public void onCreate(Bundle savedInstanceState) {
SharedPreferences themePrefs = getSharedPreferences("THEME", 0);
Boolean isDark = themePrefs.getBoolean("isDark", false);
if (isDark)
setTheme(R.style.DarkTheme);
else
setTheme(R.style.AppTheme);
super.onCreate(savedInstanceState);
if (!System.getCurrentTarget().hasOpenPorts())
new FinishDialog(getString(R.string.warning), getString(R.string.no_open_ports), this).show();
final ArrayList<String> ports = new ArrayList<String>();
for (Port port : System.getCurrentTarget().getOpenPorts()) ports.add(Integer.toString(port.getNumber()));
mProtocolAdapter = new ProtocolAdapter();
mPortSpinner = (Spinner) findViewById(R.id.portSpinner);
mPortSpinner.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, ports));
mPortSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> adapter, View view, int position, long id) {
String port = (String) adapter.getItemAtPosition(position);
int protocolIndex = mProtocolAdapter.getIndexByPort(port);
if (protocolIndex != -1)
mProtocolSpinner.setSelection(protocolIndex);
}
public void onNothingSelected(AdapterView<?> arg0) {
}
});
mProtocolSpinner = (Spinner) findViewById(R.id.protocolSpinner);
mProtocolSpinner.setAdapter(new ProtocolAdapter());
mProtocolSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> adapter, View view, int position, long id) {
int portIndex = mProtocolAdapter.getPortIndexByProtocol(position);
if (portIndex != -1)
mPortSpinner.setSelection(portIndex);
}
public void onNothingSelected(AdapterView<?> arg0) {
}
});
mCharsetSpinner = (Spinner) findViewById(R.id.charsetSpinner);
mCharsetSpinner.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, CHARSETS));
mCharsetSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> adapter, View view, int position, long id) {
if (CHARSETS_MAPPING[position] == null) {
new InputDialog(getString(R.string.custom_charset), getString(R.string.enter_chars_wanted), LoginCracker.this, new InputDialogListener() {
@Override
public void onInputEntered(String input) {
input = input.trim();
if (!input.isEmpty())
mCustomCharset = "aA1" + input;
else {
mCustomCharset = null;
mCharsetSpinner.setSelection(0);
}
}
}).show();
} else
mCustomCharset = null;
}
public void onNothingSelected(AdapterView<?> arg0) {
}
});
mUserSpinner = (Spinner) findViewById(R.id.userSpinner);
mUserSpinner.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, USERNAMES));
mUserSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> adapter, View view, int position, long id) {
String user = (String) adapter.getItemAtPosition(position);
if (user != null && user.equals("-- ADD --")) {
new InputDialog(getString(R.string.add_username), getString(R.string.enter_username), LoginCracker.this, new InputDialogListener() {
@Override
public void onInputEntered(String input) {
USERNAMES = Arrays.copyOf(USERNAMES, USERNAMES.length + 1);
USERNAMES[USERNAMES.length - 1] = "-- ADD --";
USERNAMES[USERNAMES.length - 2] = input;
mUserSpinner.setAdapter(new ArrayAdapter<String>(LoginCracker.this, android.R.layout.simple_spinner_item, USERNAMES));
mUserSpinner.setSelection(USERNAMES.length - 2);
}
}).show();
}
}
public void onNothingSelected(AdapterView<?> arg0) {
}
});
mMaxSpinner = (Spinner) findViewById(R.id.maxSpinner);
mMaxSpinner.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, LENGTHS));
mMinSpinner = (Spinner) findViewById(R.id.minSpinner);
mMinSpinner.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, LENGTHS));
mStartButton = (FloatingActionButton) findViewById(R.id.startFAB);
mStatusText = (TextView) findViewById(R.id.statusText);
mProgressBar = (ProgressBar) findViewById(R.id.progressBar);
mActivity = (ProgressBar) findViewById(R.id.activity);
mProgressBar.setMax(100);
mReceiver = new AttemptReceiver();
mStartButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (mRunning) {
setStoppedState();
} else {
setStartedState();
}
}
});
mWordlistPicker = new Intent();
mWordlistPicker.addCategory(Intent.CATEGORY_OPENABLE);
mWordlistPicker.setType("text/*");
mWordlistPicker.setAction(Intent.ACTION_GET_CONTENT);
if (Build.VERSION.SDK_INT >= 11)
mWordlistPicker.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
}
Aggregations