Guest User

Untitled

a guest
Sep 30th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. public static void main(String[] args) throws IOException, InterruptedException {
  2. String ip = "192.168.1.1";
  3. String userName = "username";
  4. String password = "password";
  5.  
  6. // creating credentials
  7. Process p = Runtime.getRuntime().exec("cmdkey /generic:"+ip+" /user:"+userName+" /pass:"+password );
  8. p.destroy();
  9.  
  10. Process exec = Runtime.getRuntime().exec("mstsc /v: "+ip+" /console");
  11.  
  12. Thread.sleep(30000);
  13.  
  14. // deleting credentials
  15. Process p1 = Runtime.getRuntime().exec("cmdkey /delete:"+ip);
  16. p1.destroy();
  17. }
Add Comment
Please, Sign In to add comment