1
我用Volley
庫在我的應用程序,一切正常,但是當我發送一個請求,我可以看到我的服務器的以下如何隱藏Url或android volley中的參數值?
完整URL的參數
名稱
和其他值。
我也在Kali linux中用Ettercap工具檢查它,它顯示了我一樣。我的問題是現在是怎麼可以從用戶隱藏這個?
String url ="http://*******.com/login";
StringRequest strReq = new StringRequest(Request.Method.POST,
url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.d(TAG, "Login Response: " + response.toString());
hideDialog();
try {
JSONObject jObj = new JSONObject(response);
boolean error = jObj.getBoolean("error");
// Check for error node in json
if (!error) {
// user successfully logged in
// Create login session
// Now store the user in SQLite
String name = jObj.getString("name");
String email = jObj.getString("email");
String api = jObj.getString("apikey");
} else {
// Error in login. Get the error message
String errorMsg = jObj.getString("message");
Toast.makeText(getApplicationContext(),
errorMsg, Toast.LENGTH_LONG).show();
}
} catch (JSONException e) {
// JSON error
e.printStackTrace();
Toast.makeText(getApplicationContext(), "Json error: " + e.getMessage(), Toast.LENGTH_LONG).show();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.e(TAG, "Login Error: " + error.getMessage());
Toast.makeText(getApplicationContext(),
error.getMessage(), Toast.LENGTH_LONG).show();
hideDialog();
}
}) {
@Override
protected Map<String, String> getParams() {
// Posting parameters to login url
Map<String, String> params = new HashMap<String, String>();
params.put("email", email);
params.put("password", password);
return params;
}
};
// Adding request to request queue
MyApplication.getInstance().addToRequestQueue(strReq, tag_string_req);
}
這是我在Kali linux中的debuger和Ettercap的結果。
Email: [email protected] Pass:somthing INFO:http://****/mypath/login CONTENT:[email protected]&password=somthing&
使用帶證書固定的SSL。 – CommonsWare
從什麼用戶隱藏這個?用戶真的有'ettercap'嗎? – EJP
不要把密碼放在URL上,而是將它添加到標題或正文中。雖然人們仍然可以看到,所以你需要使用SSL作爲Commonsware的建議。 – Enzokie