@@ -29,6 +29,21 @@ public Console(String user, String pass, String uHash) {
29
29
//return this;
30
30
}
31
31
32
+ /**
33
+ *
34
+ * Get IP from console
35
+ *
36
+ * @param global Use global?
37
+ * @param attacked Get already attacked IPs?
38
+ */
39
+ public String getIP (boolean attacked , boolean global ) throws JSONException {
40
+ String result = null ;
41
+ JSONObject json = Utils .JSONRequest ("user::::pass::::uhash::::global" , username + "::::" + password + "::::" + userHash + "::::" + (global ?"1" :"0" ), "vh_network.php" );
42
+ JSONArray jSONArray = json .getJSONArray ("data" );
43
+ result = jSONArray .getJSONObject (0 ).getString ("ip" );
44
+ return result ;
45
+ }
46
+
32
47
/**
33
48
*
34
49
* Get IPs from console
@@ -37,16 +52,12 @@ public Console(String user, String pass, String uHash) {
37
52
* @param global Use global?
38
53
* @param attacked Get already attacked IPs?
39
54
*/
40
- public ArrayList <String > getIPs (int number , boolean attacked , boolean global ){
55
+ public ArrayList <String > getIPs (int number , boolean attacked , boolean global ) throws JSONException {
41
56
ArrayList <String > result = new ArrayList <String >();
42
57
ArrayList <String > temporary = new ArrayList <String >();
43
- int globali = 0 ;
44
- if (global ) {
45
- globali = 1 ;
46
- }
47
58
if (number > 10 ) {
48
59
for (int i = 10 ; i <= number + 9 ; i = i + 10 ) {
49
- JSONObject json = Utils .JSONRequest ("user::::pass::::uhash::::global" , username + "::::" + password + "::::" + userHash + "::::" + Integer . toString ( globali ), "vh_network.php" );
60
+ JSONObject json = Utils .JSONRequest ("user::::pass::::uhash::::global" , username + "::::" + password + "::::" + userHash + "::::" + ( global ? "1" : "0" ), "vh_network.php" );
50
61
JSONArray jSONArray = json .getJSONArray ("data" );
51
62
for (int j = 0 ; j <= jSONArray .length () - 1 ; j ++) {
52
63
JSONObject ip = jSONArray .getJSONObject (j );
@@ -58,7 +69,7 @@ public ArrayList<String> getIPs(int number, boolean attacked, boolean global){
58
69
result .add (temporary .get (k ));
59
70
}
60
71
} else {
61
- JSONObject json = Utils .JSONRequest ("user::::pass::::uhash::::global" , username + "::::" + password + "::::" + userHash + "::::" + Integer . toString ( globali ), "vh_network.php" );
72
+ JSONObject json = Utils .JSONRequest ("user::::pass::::uhash::::global" , username + "::::" + password + "::::" + userHash + "::::" + ( global ? "1" : "0" ), "vh_network.php" );
62
73
JSONArray jSONArray = json .getJSONArray ("data" );
63
74
for (int k = 0 ; k < number ; k ++) {
64
75
result .add (jSONArray .getJSONObject (k ).getString ("ip" ));
@@ -67,14 +78,31 @@ public ArrayList<String> getIPs(int number, boolean attacked, boolean global){
67
78
return result ;
68
79
}
69
80
81
+ public ScannedNode scanIP (String ip ) {
82
+ InputStream is ;
83
+ BufferedReader rd ;
84
+ ScannedNode result = null ;
85
+ try {
86
+ is = new URL (Utils .generateURL ("user::::pass::::target" , username + "::::" + password + "::::" + ip , "vh_scan.php" )).openStream ();
87
+ rd = new BufferedReader (new InputStreamReader (is , Charset .forName ("UTF-8" )));
88
+ String [] temp = ReadBigStringIn (rd );
89
+ result = new ScannedNode (temp );
90
+ result .setIP (ip );
91
+ TimeUnit .MILLISECONDS .sleep (100 );
92
+ } catch (InterruptedException |IOException e ) {
93
+ e .printStackTrace ();
94
+ }
95
+ return result ;
96
+ }
97
+
70
98
public List <ScannedNode > scanIPs (List <String > ips ) {
71
99
InputStream is ;
72
100
BufferedReader rd ;
73
101
List <ScannedNode > array = new ArrayList <>();
74
102
ScannedNode result ;
75
103
76
104
for (String ip : ips ) {
77
- try {
105
+ try {
78
106
is = new URL (Utils .generateURL ("user::::pass::::target" , username + "::::" + password + "::::" + ip , "vh_scan.php" )).openStream ();
79
107
rd = new BufferedReader (new InputStreamReader (is , Charset .forName ("UTF-8" )));
80
108
String [] temp = ReadBigStringIn (rd );
@@ -83,7 +111,6 @@ public List<ScannedNode> scanIPs(List<String> ips) {
83
111
array .add (result );
84
112
TimeUnit .MILLISECONDS .sleep (100 );
85
113
} catch (InterruptedException |IOException e ) {
86
- // TODO Auto-generated catch block
87
114
e .printStackTrace ();
88
115
}
89
116
}
@@ -94,15 +121,13 @@ public TransferResult transferTrojanTo(ScannedNode node) throws JSONException {
94
121
JSONObject json = Utils .JSONRequest ("user::::pass::::uhash::::target" , username + "::::" + password + "::::" + userHash + "::::" + node .getIP (), "vh_trTransfer.php" );
95
122
return new TransferResult (json , node .getIP ());
96
123
}
97
-
98
124
99
- public ArrayList <TransferResult > trTransferIPs (ArrayList <String > ips ) {
125
+ public ArrayList <TransferResult > transferTrojansTo (ArrayList <ScannedNode > nodes ) throws JSONException {
100
126
ArrayList <TransferResult > array = new ArrayList <TransferResult >();
101
127
TransferResult result ;
102
- for (int j = 0 ; j < ips .size (); j ++) {
103
-
104
- JSONObject json = Utils .JSONRequest ("user::::pass::::uhash::::target" , username + "::::" + password + "::::" + userHash + "::::" + ips .get (j ), "vh_trTransfer.php" );
105
- result = new TransferResult (json , ips .get (j ));
128
+ for (int j = 0 ; j < nodes .size (); j ++) {
129
+ JSONObject json = Utils .JSONRequest ("user::::pass::::uhash::::target" , username + "::::" + password + "::::" + userHash + "::::" + nodes .get (j ).getIP (), "vh_trTransfer.php" );
130
+ result = new TransferResult (json , nodes .get (j ).getIP ());
106
131
array .add (result );
107
132
}
108
133
return array ;
0 commit comments