@@ -29,6 +29,21 @@ public Console(String user, String pass, String uHash) {
2929 //return this;
3030 }
3131
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+
3247 /**
3348 *
3449 * Get IPs from console
@@ -37,16 +52,12 @@ public Console(String user, String pass, String uHash) {
3752 * @param global Use global?
3853 * @param attacked Get already attacked IPs?
3954 */
40- public ArrayList <String > getIPs (int number , boolean attacked , boolean global ){
55+ public ArrayList <String > getIPs (int number , boolean attacked , boolean global ) throws JSONException {
4156 ArrayList <String > result = new ArrayList <String >();
4257 ArrayList <String > temporary = new ArrayList <String >();
43- int globali = 0 ;
44- if (global ) {
45- globali = 1 ;
46- }
4758 if (number > 10 ) {
4859 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" );
5061 JSONArray jSONArray = json .getJSONArray ("data" );
5162 for (int j = 0 ; j <= jSONArray .length () - 1 ; j ++) {
5263 JSONObject ip = jSONArray .getJSONObject (j );
@@ -58,7 +69,7 @@ public ArrayList<String> getIPs(int number, boolean attacked, boolean global){
5869 result .add (temporary .get (k ));
5970 }
6071 } 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" );
6273 JSONArray jSONArray = json .getJSONArray ("data" );
6374 for (int k = 0 ; k < number ; k ++) {
6475 result .add (jSONArray .getJSONObject (k ).getString ("ip" ));
@@ -67,14 +78,31 @@ public ArrayList<String> getIPs(int number, boolean attacked, boolean global){
6778 return result ;
6879 }
6980
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+
7098 public List <ScannedNode > scanIPs (List <String > ips ) {
7199 InputStream is ;
72100 BufferedReader rd ;
73101 List <ScannedNode > array = new ArrayList <>();
74102 ScannedNode result ;
75103
76104 for (String ip : ips ) {
77- try {
105+ try {
78106 is = new URL (Utils .generateURL ("user::::pass::::target" , username + "::::" + password + "::::" + ip , "vh_scan.php" )).openStream ();
79107 rd = new BufferedReader (new InputStreamReader (is , Charset .forName ("UTF-8" )));
80108 String [] temp = ReadBigStringIn (rd );
@@ -83,7 +111,6 @@ public List<ScannedNode> scanIPs(List<String> ips) {
83111 array .add (result );
84112 TimeUnit .MILLISECONDS .sleep (100 );
85113 } catch (InterruptedException |IOException e ) {
86- // TODO Auto-generated catch block
87114 e .printStackTrace ();
88115 }
89116 }
@@ -94,15 +121,13 @@ public TransferResult transferTrojanTo(ScannedNode node) throws JSONException {
94121 JSONObject json = Utils .JSONRequest ("user::::pass::::uhash::::target" , username + "::::" + password + "::::" + userHash + "::::" + node .getIP (), "vh_trTransfer.php" );
95122 return new TransferResult (json , node .getIP ());
96123 }
97-
98124
99- public ArrayList <TransferResult > trTransferIPs (ArrayList <String > ips ) {
125+ public ArrayList <TransferResult > transferTrojansTo (ArrayList <ScannedNode > nodes ) throws JSONException {
100126 ArrayList <TransferResult > array = new ArrayList <TransferResult >();
101127 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 ());
106131 array .add (result );
107132 }
108133 return array ;
0 commit comments