use of org.csploit.android.gui.dialogs.FinishDialog in project android by cSploit.
the class ExploitFinder method setStartedState.
private void setStartedState() {
mSearchProgress.setVisibility(View.VISIBLE);
final Target target = System.getCurrentTarget();
mSearchFloatingActionButton.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_stop_24dp));
buttonPlayed = true;
job = Search.searchExploitForServices(target, new Search.Receiver<Exploit>() {
private boolean somethingFound = false;
@Override
public void onItemFound(final Exploit exploit) {
somethingFound = true;
ExploitFinder.this.runOnUiThread(new Runnable() {
@Override
public void run() {
target.addExploit(exploit);
mAdapter.notifyDataSetChanged();
}
});
}
@Override
public void onFoundItemChanged(Exploit exploit) {
ExploitFinder.this.runOnUiThread(new Runnable() {
@Override
public void run() {
mAdapter.notifyDataSetChanged();
}
});
}
@Override
public void onEnd() {
ExploitFinder.this.runOnUiThread(new Runnable() {
@Override
public void run() {
mSearchProgress.setVisibility(View.GONE);
mSearchFloatingActionButton.setImageDrawable(ContextCompat.getDrawable(getBaseContext(), R.drawable.ic_play_arrow_24dp));
buttonPlayed = false;
if (System.getCurrentExploits().size() == 0) {
new FinishDialog(getString(R.string.warning), getString(R.string.no_exploits_found), ExploitFinder.this).show();
} else if (!somethingFound) {
new ErrorDialog(getString(R.string.warning), getString(R.string.no_exploits_found), ExploitFinder.this).show();
}
}
});
}
});
}
use of org.csploit.android.gui.dialogs.FinishDialog in project android by cSploit.
the class ExploitFinder 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);
Target t = System.getCurrentTarget();
if (!t.hasOpenPorts())
new FinishDialog(getString(R.string.warning), getString(R.string.no_open_ports), this).show();
else if (!t.hasOpenPortsWithService())
new FinishDialog(getString(R.string.warning), getString(R.string.no_infos_on_target), this).show();
mSearchFloatingActionButton = (FloatingActionButton) findViewById(R.id.searchToggleButton);
mSearchProgress = (ProgressBar) findViewById(R.id.searchActivity);
mListView = (ListView) findViewById(android.R.id.list);
mAdapter = new ExploitAdapter();
UIThread = this;
mListView.setAdapter(mAdapter);
mListView.setOnItemClickListener(listener);
mSearchFloatingActionButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (buttonPlayed) {
setStoppedState();
} else {
setStartedState();
}
}
});
}
use of org.csploit.android.gui.dialogs.FinishDialog 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);
}
use of org.csploit.android.gui.dialogs.FinishDialog in project android by cSploit.
the class Sessions 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);
UIThread = this;
if (System.getMsfRpc() == null) {
new FinishDialog(getString(R.string.error), "MSF RPC not connected", Sessions.this).show();
return;
}
mResults = System.getCurrentTarget().getSessions();
mListView = (ListView) findViewById(android.R.id.list);
mAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, mResults);
mListView.setAdapter(mAdapter);
mListView.setOnItemClickListener(clickListener);
mListView.setOnItemLongClickListener(longClickListener);
new Thread(new Runnable() {
@Override
public void run() {
System.getMsfRpc().updateSessions();
runOnUiThread(new Runnable() {
@Override
public void run() {
if (mResults.isEmpty()) {
new FinishDialog(getString(R.string.warning), getString(R.string.no_opened_sessions), Sessions.this).show();
} else {
mAdapter.notifyDataSetChanged();
}
}
});
}
}).start();
}
use of org.csploit.android.gui.dialogs.FinishDialog in project android by cSploit.
the class ActionFragment method onViewCreated.
@Override
public void onViewCreated(View v, Bundle savedInstanceState) {
SharedPreferences themePrefs = getActivity().getSharedPreferences("THEME", 0);
Boolean isDark = themePrefs.getBoolean("isDark", false);
if (isDark) {
getActivity().setTheme(R.style.DarkTheme);
v.setBackgroundColor(ContextCompat.getColor(getActivity(), R.color.background_window_dark));
} else {
getActivity().setTheme(R.style.AppTheme);
v.setBackgroundColor(ContextCompat.getColor(getActivity(), R.color.background_window));
}
mTarget = org.csploit.android.core.System.getCurrentTarget();
if (mTarget != null) {
getActivity().setTitle("cSploit > " + mTarget);
((AppCompatActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
theList = (ListView) getActivity().findViewById(R.id.android_list);
mAvailable = System.getPluginsForTarget();
ActionsAdapter mActionsAdapter = new ActionsAdapter();
theList.setAdapter(mActionsAdapter);
theList.setOnItemClickListener(new ListView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (System.checkNetworking(getActivity())) {
Plugin plugin = mAvailable.get(position);
System.setCurrentPlugin(plugin);
if (plugin.hasLayoutToShow()) {
Toast.makeText(getActivity(), getString(R.string.selected) + getString(plugin.getName()), Toast.LENGTH_SHORT).show();
startActivity(new Intent(getActivity(), plugin.getClass()));
getActivity().overridePendingTransition(R.anim.fadeout, R.anim.fadein);
} else
plugin.onActionClick(getActivity().getApplicationContext());
}
}
});
} else {
new FinishDialog(getString(R.string.warning), getString(R.string.something_went_wrong), getActivity()).show();
}
}
Aggregations