forked from cSploit/android
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlugin.java
More file actions
126 lines (101 loc) · 3.34 KB
/
Copy pathPlugin.java
File metadata and controls
126 lines (101 loc) · 3.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*
* This file is part of the dSploit.
*
* Copyleft of Simone Margaritelli aka evilsocket <evilsocket@gmail.com>
*
* dSploit is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* dSploit is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with dSploit. If not, see <http://www.gnu.org/licenses/>.
*/
package org.csploit.android.core;
import android.content.Context;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;
import org.csploit.android.R;
import org.csploit.android.net.Target;
import org.csploit.android.net.Target.Exploit;
import org.csploit.android.net.Target.Port;
import org.csploit.android.net.metasploit.RPCClient;
public abstract class Plugin extends AppCompatActivity {
public static final int NO_LAYOUT = -1;
private int mNameStringId = -1;
private int mDescriptionStringId = -1;
private Target.Type[] mAllowedTargetTypes = null;
private int mLayoutId = 0;
private int mIconId = 0;
protected Child mProcess = null;
public Plugin(int nameStringId, int descStringId, Target.Type[] allowedTargetTypes, int layoutId, int iconResourceId){
mNameStringId = nameStringId;
mDescriptionStringId = descStringId;
mAllowedTargetTypes = allowedTargetTypes;
mLayoutId = layoutId;
mIconId = iconResourceId;
}
public Plugin(int nameStringId, int descStringId, Target.Type[] allowedTargetTypes, int layoutId){
this(nameStringId, descStringId, allowedTargetTypes, layoutId, R.drawable.action_plugin);
}
public int getName(){
return mNameStringId;
}
public int getDescription(){
return mDescriptionStringId;
}
public Target.Type[] getAllowedTargetTypes(){
return mAllowedTargetTypes;
}
public int getIconResourceId(){
return mIconId;
}
public boolean isAllowedTarget(Target target){
for(Target.Type type : mAllowedTargetTypes)
if(type == target.getType())
return true;
return false;
}
public boolean hasLayoutToShow(){
return mLayoutId != -1;
}
@Override
protected void onResume() {
super.onResume();
}
@Override
protected void onPause() {
super.onPause();
}
public void onActionClick(Context context){
}
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setTitle(System.getCurrentTarget() + " > " + getString( mNameStringId ) );
setContentView(mLayoutId);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
@Override
public boolean onOptionsItemSelected(MenuItem item){
switch(item.getItemId()){
case android.R.id.home:
onBackPressed();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
@Override
public void onBackPressed(){
super.onBackPressed();
overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_left);
}
public void onRpcChange(RPCClient currentValue) { }
}