x
Please log in with password to access chatbox.
Index | Back | Reply | New Topic
IP Change Automation
Static IP change automation | |
2009-01-06 22:03 | chafilandia.myminicity.com | If you have been assigned a group of static IP's by your ISP, you can use this small procedure to change around those IP's you have no use for. In the event that you are for example a network administrator, you probably qualify for using this procedure. I've tested it on XP but should work on any flavor of Windows.
1. For convenience I've renamed my Internet Connection to just "internet" (of course no quotes). 2. I've created two batch files: the first contains an infinite loop to keep the procedure going forever (or at least until you press CTRL-C), the second contains the commands needed to make the visits and change the IP number. I've named these two files as "ip-master.bat" and "ip-modifier.bat" 3. The ip-master.bat contains: :ciclic call ip-modifier First_Static_IP call ip-modifier Second_Static_IP call ip-modifier Third_Static_IP call ip-modifier Last_Static_IP goto ciclic Put your IP numbers one per line in the usual form "aaaa.bbbb.cccc.dddd" 4. The ip-modifier.bat contains: netsh interface IP set address internet static %1 IP_MASK GATEWAY_IP 1 taskkill /F /IM firefox.exe start firefox.exe -url "http://utopia.lv/exchange/?do=supermode" ping localhost -n 360 >NUL: The netsh command changes the IP and needs the IP_MASK given to you by the ISP (for example 255.255.255.224), the GATEWAY_IP normally used by your router or high-speed modem and the metric used by your networkd (most of the time is "1"). Note the word "internet": this is the name of your Internet connection, that in my case I renamed to just "internet" (just for convenience). The taskkill command closes firefox, just in case it is working. The start command reopens firefox and start the visits using supermode. The ping command waits 360 seconds for the visits to finish. Depending on your connection speed you can increase or decrease this parameter. 5. For this procedure to work properly you have to disable the crash resume feature on Firefox. Open Firefox Type: "about:config" in address bar (without quotes) Locate this parameter "browser.sessionstore.resume_from_crash" in the list Double click on that parameter to set it to "false" 6. This procedure should be implemented on a computer connected directly to the router/modem. To start just open a CMD windows and type "ip-master". I hope it helps someone out there. |
2009-01-06 22:56 | utopia.lv | Thanks Chafilandia!
Good thing about your script is, it does not require automation turned on with Supermode and will work even with pop-ups. I also use automation with static IPs, but I could not come up with "batch files only" solution. I will post my solution also so one can take the best from both worlds :). |
2009-01-06 23:51 | utopia.lv | To run my script you'll need to install powerful scripting program called autohotkey.
Also please create another Firefox Profile for Supermode automation. It really speeds everything up. Here's how: 1. Close Firefox and run the following command: firefox.exe -ProfileManager 2. Click "Create Profile" and enter "Supermode" and click "Finish". 3. Now you can create a new shortcut to run Firefox Supermode profile and it will work in parallel with your regular Firefox installation: firefox.exe -p Supermode -no-remote -url "http://utopia.lv/exchange/?do=supermode" 4. Launch the shortcut, install Supermode extension, restart. Please do not install any other add-ons, keep it clean! You can tune up some network parameters in about:config, Google it if you're interested. 5. Do what chafilandia.myminicity.com said above (#5) and you're done. Now create 3 files in the same folder (I put them on the root of c:\). ---=== loop.bat ===--- :Start @echo off REM taskkill /f /im firefox.exe taskkill /f /FI "WINDOWTITLE eq Utopia click exchange*" taskkill /f /FI "WINDOWTITLE eq Page Load Error*" echo wscript.sleep 10000 >%temp%\sleep.vbs wscript.exe %temp%\sleep.vbs start firefox.exe -p Supermode -no-remote -url "http://utopia.lv/exchange/?do=supermode" REM wait 30 minutes ( 60 seconds * 30 minutes * 1000 = 1800000) echo wscript.sleep 1800000 >%temp%\sleep.vbs wscript.exe %temp%\sleep.vbs GOTO Start This batch file will once every 30 minutes terminate Firefox process and restart it. Helps to fight Firefox memory leaks and web-page errors when Supermode halts. ---=== ip.ahk ===--- ipa = %A_IPAddress1% Loop, read, c:\ip.txt { Loop, parse, A_LoopReadLine, %A_Tab% { ipafile = %A_LoopField% if (zzz = 1) changeip(ipafile) if (ipa = ipafile) zzz = 1 if (!first) first = %ipafile% } } changeip(first) return changeip(ipanew) { run, netsh interface ip set address "internet" static %ipanew% IP_MASK GATEWAY_IP 1 ExitApp } This is the main script that changes IP addresses. I use same method as chafilandia.myminicity.com to change IP address, so see his comments above (#4). Basically you will need to replace IP_MASK and GATEWAY_IP with your subnet mask and gateway (router) IP addresses. If the script does not work for you and you have several network cards installed, replace %A_IPAddress1% with %A_IPAddress2% or %A_IPAddress3% or %A_IPAddress4%. ---=== ip.txt ===--- 123.456.789.1 123.456.789.2 123.456.789.3 123.456.789.4 123.456.789.5 This file contains all IP addresses you can use. It will apply each IP address in the same order as in file. When last IP is reached, it will start from the beginning. ======================== 1. Point Supermode extension to "ip.ahk" (for example: c:\ip.ahk). To do this click Tools --> Add-ons --> Supermode for utopia.lv --> Options --> c:\ip.ahk 2. Enable automation and save profile. 3. Run loop.bat. Enjoy! :) edit 2009-01-09: updated loop.bat edit 2009-01-12: scripts updated comment 2009-02-15: script has evolved much further: IP PING and ARP check to see if no duplicate IP exists on the network, IP change results logging. PM me if interested. |
2009-01-12 14:00 | hellowien | A short opinion on setting a break in batch-files:
I know, I was the first one here that came up with this 'ping localhost ...' for adding a break in batch file-routine. This is only a compromise and not really exactly in timing. This command only causes a delay by constantly pinging your own comp. Only another service running ... To time an exact sleep-command you should use vbs, especially for longer times like those 30 mins. mentioned above. Two lines will make a temporary vbs with timing in ms ( 1 s = 1000 ms) without the need of constant ping-service running. This temporary vbs is called within the batch file with Wscript. Here we go (30*60*1000 for 30 sec.): @ echo off echo wscript.sleep 1800000 >%temp%\sleep.vbs wscript.exe %temp%\sleep.vbs |
2009-01-12 14:19 | utopia.lv | Thanks hellowien!
I am impressed with your solution to create a vbs file from within batch file and execute it afterward. P.S. Scripts are updated. To wait 30 minutes one must enter echo wscript.sleep 1800000 >%temp%\sleep.vbs wscript.exe %temp%\sleep.vbs (1000 milliseconds * 60 seconds * 30 minutes = 1800000) |
2009-01-30 19:00 | chafilandia.myminicity.com | Another way to implement a delay in a batch file is via the legendary SLEEP command. This command is NOT standard, but you cand find it in the Windows Resource Kits. For your convenience I've uploaded it to RapidShare at:
http://rapidshare.com/files/191693676/sleep.zip.html For security reasons the file has an .html tag that you have to remove before unzip the file. The syntax is very simple: sleep [seconds] or sleep -m [miliseconds] This command is quite exact but I don't recommend its use to control real-time procedures. |
2009-06-15 06:19 | mph10 | I have a static ip, how can i find out if i have multiple ip extensions available? |
2009-07-15 00:08 | chafilandia.myminicity.com | It is uncommon (but not impossible) to have a single static IP. Along with the IP number(s) you should have received an IP mask that indicates how many IPīs you have. For example if your mask is 255.255.255.240 you should have a block of 16 IPīs (however you cannot use the first and last IPīs of the block). If you need further info about IP numbers I suggest you to check Wikipedia. |