anthony55 0 Posted November 15, 2011 Report Share Posted November 15, 2011 Bonjour, Voila j'ai peut etre un souci, enfaite je me suis apercu que mon ip externe ne changer plus apres un reboot de la box, j'ai toujours la meme ip. Est ce normal sachant que je suis en offre adsl ? Quote Link to post Share on other sites
omegatron 341 Posted November 15, 2011 Report Share Posted November 15, 2011 Bonsoir, Que vous ayez une ip dynamique attribuée par votre FAI n'implique pas nécessairement qu'elle change fréquemment ni même après une reconnexion. 1 Quote Link to post Share on other sites
Philippe_SFR 0 Posted November 22, 2011 Report Share Posted November 22, 2011 (edited) Bonjour anthony55, Comme l'indique omegatron, cela ne veut pas dire que votre IP va changer tous les jours. Il peut très bien rester le même très longtemps. Edited November 22, 2011 by Philippe_SFR Quote Link to post Share on other sites
IceCactus 1 Posted November 23, 2011 Report Share Posted November 23, 2011 Bonjour, Le fonctionnement du changement d'IP a changé depuis quelques temps. Il suffisait de redémarrer le modem pour changer d'IP, cela n'est plus le cas et l'IP est en pratique presque fixe maintenant. Pour changer l'IP, voir: Quote Link to post Share on other sites
modificationIP 0 Posted October 30, 2012 Report Share Posted October 30, 2012 Bonjour, L'astuce de quartier-maître m'a beaucoup aidé.Je me suis servi de cette idée de manière un peu différente, en écrivant une classe JAVA qui fonctionne utilise Selenium. http://code.google.com/p/selenium/downloads/detail?name=selenium-server-standalone-2.5.0.jar&can=4&q= pour télécharger selenium-server-standalone-2.5.0. Comme l'attribution d'un nouvel IP est très aléatoire (pas de nouvel IP ou utilisation d'un IP déjà utilisé dans le passé) j'ai une boucle qui teste si il y a bien eu modification d'IP (par une requête à whatismyip.com). import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.firefox.FirefoxProfile; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriverBackedSelenium; import org.junit.After; import org.junit.Before; import org.junit.Test; import java.net.URL; import java.net.URLConnection; import java.security.SecureRandom; import java.util.ArrayList; public class IPchange extends SeleneseTestCase { static ArrayList<String> ips; @Before public void setUp() throws Exception { FirefoxProfile profile=new FirefoxProfile(); WebDriver driver = new FirefoxDriver(); String baseUrl = "http://192.168.1.1/login?page_ref=/state"; selenium = new WebDriverBackedSelenium(driver, baseUrl); selenium.setTimeout("3000000"); ips=new ArrayList<String>(); String ip_init=getIP(); ips.add(ip_init); } @Test public void ChangeIP() throws Exception { boolean bool=true; String ip2=""; while(bool){ SecureRandom rando = new SecureRandom(); String id=new BigInteger(130, rando).toString(15);// génération d'un nouvel identifiant (cf l'astuce de quartier-maître) selenium.open("/login?page_ref=/state"); selenium.waitForPageToLoad("300000"); selenium.type("id=login", "admin"); selenium.type("id=password", "myPass");//écrire ici votre password (ou bien votre clep wep si vous n'avez jamais changé de pass) selenium.click("css=div.button_submit > button[name=\"submit_button\"]"); selenium.waitForPageToLoad("300000"); selenium.click("link=Réseau"); selenium.waitForPageToLoad("300000"); selenium.click("link=WAN"); selenium.waitForPageToLoad("300000"); selenium.type("id=ppp_login", id+"@neufpnp"); selenium.click("name=submit"); selenium.waitForPageToLoad("300000"); selenium.click("link=Déconnexion"); selenium.waitForPageToLoad("300000"); ip2=getIP(); bool=ips.contains(ip2); } ips.add(ip2); /* */ } private String getIP() throws IOException { try{ Thread.currentThread().sleep(30000);// Necessaire pour attendre que la connection internet se retablisse après un eventuel changement d'IP } catch(Exception ie){ } URL whatismyip = new URL("http://automation.whatismyip.com/n09230945.asp"); URLConnection connection = whatismyip.openConnection(); connection.setConnectTimeout(2000000); connection.addRequestProperty("Protocol", "Http/1.1"); connection.addRequestProperty("Connection", "keep-alive"); connection.addRequestProperty("Keep-Alive", "1000"); connection.addRequestProperty("User-Agent", "Web-Agent"); BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); String ip = in.readLine(); System.out.println(ip); return ip; } @After public void tearDown() throws Exception { selenium.stop(); } } Pour la classe Main : public class Main{ public static void main(String[] args) throws Exception { IPchange t=new IPchange(); t.setUp(); t.ChangeIP(); } Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.