pork Posted October 19, 2013 Share Posted October 19, 2013 (edited) EDIT import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; public class IPListener { private static final String MY_IP_URL = "http://my-ip.heroku.com/"; private static final String BAT_TO_RUN = "run.bat"; public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(new URL(MY_IP_URL).openConnection().getInputStream())); String initialIP = reader.readLine(); reader.close(); System.out.println("Initial IP: " + initialIP); System.out.println("Listening for change in IP address..."); while (true) { reader = new BufferedReader(new InputStreamReader(new URL(MY_IP_URL).openConnection().getInputStream())); String currentIP = reader.readLine(); reader.close(); if (!initialIP.equals(currentIP)) { System.out.println("IP changed from " + initialIP + " to " + currentIP); Runtime.getRuntime().exec("cmd /c start " + BAT_TO_RUN); System.out.println(BAT_TO_RUN + " executed."); break; } } } } Came up with this but it spams the website every few milliseconds... they'll prob block me. The file run.bat is executed on IP change so you can put commands in there to kill java.exe or javaw.exe processes. Edited October 20, 2013 by pork Link to comment Share on other sites More sharing options...
ScorpioZ Posted October 19, 2013 Share Posted October 19, 2013 Well an easy fix would be to just get a new VPN. What are you currently using? Link to comment Share on other sites More sharing options...
pork Posted October 19, 2013 Author Share Posted October 19, 2013 Witopia. But there is always a chance that any vpn could disconnect or my internet could disconnect and reconnect to runescape before reconnecting to VPN. I need a way to have my bots close if my ip address changes. Changing vpns isn't a solution for me because it can happen on any other one. Link to comment Share on other sites More sharing options...
Anon Posted October 19, 2013 Share Posted October 19, 2013 (edited) Code for ip changer killer package ipchange; import java.net.InetAddress; import java.net.UnknownHostException; import javax.swing.JFrame; public class IpChange { private static String ip; private static void kill(String string) { try { Runtime.getRuntime().exec("taskkill /F /IM " + string).waitFor(); } catch (Exception e) {} } public static void main(String[] args) throws UnknownHostException, InterruptedException { ip = InetAddress.getLocalHost().getHostAddress(); JFrame frame = new JFrame(); frame.setVisible(true); while(true) { System.out.println(InetAddress.getLocalHost().getHostAddress()); if(!ip.equalsIgnoreCase(InetAddress.getLocalHost().getHostAddress())) { kill("javaw.exe"); break; } Thread.sleep(5000); } } } Here is download link https://www.dropbox.com/s/0w27kzkx3de417k/IpChange.jar Also keep the JFRAME that it pops up open.... that is for the purpose of that it is still running It will kill osbot when you disconnect from vpn Cheers Edited October 19, 2013 by Anon Link to comment Share on other sites More sharing options...