pootisspencer 1 Posted July 8, 2017 As title says, doesn't return the login info in a RandomSolver instance
pootisspencer 1 Author 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?
pootisspencer 1 Author 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
Dinh 496 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
pootisspencer 1 Author 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
Soldtodie 76 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.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.