pootisspencer 1 Share Posted July 8, 2017 As title says, doesn't return the login info in a RandomSolver instance Link to comment Share on other sites More sharing options...
Manly 879 Share Posted July 8, 2017 I think u have to be logged in to fetch these Link to comment Share on other sites More sharing options...
pootisspencer 1 Author Share Posted July 8, 2017 I think u have to be logged in to fetch these Aww, so there isnt any other way on fetching it? Link to comment Share on other sites More sharing options...
Dinh 496 Share Posted July 8, 2017 im pretty sure that you can NOT access those fields Link to comment Share on other sites More sharing options...
Nex 2542 Share Posted July 8, 2017 im pretty sure that you can NOT access those fields this. Link to comment Share on other sites More sharing options...
pootisspencer 1 Author Share Posted July 8, 2017 im pretty sure that you can NOT access those fields getMethodContext().getClient().getPassword() What do you mean? It's only going to be used in a local script anyway Link to comment Share on other sites More sharing options...
Dinh 496 Share Posted July 8, 2017 getMethodContext().getClient().getPassword() What do you mean? It's only going to be used in a local script anyway You still cant access those fields you probably will get an error in your console doing that Link to comment Share on other sites More sharing options...
pootisspencer 1 Author Share Posted July 8, 2017 You still cant access those fields you probably will get an error in your console doing that No errors, oh well, hope I can atleat file IO with this bot Link to comment Share on other sites More sharing options...
Soldtodie 76 Share Posted July 8, 2017 String[][] parameters; @Override public void onStart() { parameters = getFieldParameters("Client.username", "Client.password"); } public String[][] getFieldParameters(String... fieldNames) { String[][] parameters = new String[fieldNames.length][]; int index = 0; int indexIn = 0; URL url; try { url = new URL("http://cdn.dreambot.org/hooks.txt"); Scanner in = new Scanner(url.openStream()); while(in.hasNextLine()) { String line = in.nextLine(); for(String field : fieldNames) { if(line.startsWith(field + " ")) { String[] split = line.split(" "); parameters[index] = new String[split.length]; for(String str : split) { parameters[index][indexIn++] = str; } index++; indexIn = 0; } } } in.close(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return parameters; } public String getUsername() { if(parameters != null && getClient().isLoggedIn()) { for(String[] arr : parameters) { if(arr[0].equals("Client.username")) { Field f = getLoader().getField(arr[1], arr[2]); try { Object obj = f.get(getLoader()); if(obj != null) { return obj.toString(); } } catch (IllegalAccessException e) { e.printStackTrace(); } } } } return null; } public String getPassword() { if(parameters != null && getClient().isLoggedIn()) { for(String[] arr : parameters) { if(arr[0].equals("Client.password")) { Field f = getLoader().getField(arr[1], arr[2]); try { Object obj = f.get(getLoader()); if(obj != null) { return obj.toString(); } } catch (IllegalAccessException e) { e.printStackTrace(); } } } } return null; } @Override public int onLoop() { log(getUsername()); log(getPassword()); return 2000; } It's not allowed on sdn scripts. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.