Lemures Posted August 20, 2009 Share Posted August 20, 2009 I'm currently working with a program (http://web.me.com/cwakamo/Connor_Wakamos_Software/Balance.html) that exports data by hosting it on iPhone. When you hit export, it hosts the raw data at http://<ip>:<port>/BalanceData.txt. I would like to write a program that I can run on my computer that grabs this data, parses it appropriately, and appends it to an excel spreadsheet. However, the ports are randomly assigned and are between 49152 and 65535. Any of the available open port scanners I can find on these forums take a good half a second minimum per port. This means it could take longer than two hours to find and grab the data, which is, of course, unacceptable. Are there any easier ways to do this? Link to comment Share on other sites More sharing options...
JSThePatriot Posted August 20, 2009 Share Posted August 20, 2009 (edited) I'm currently working with a program (http://web.me.com/cwakamo/Connor_Wakamos_Software/Balance.html) that exports data by hosting it on iPhone. When you hit export, it hosts the raw data at http://<ip>:<port>/BalanceData.txt. I would like to write a program that I can run on my computer that grabs this data, parses it appropriately, and appends it to an excel spreadsheet. However, the ports are randomly assigned and are between 49152 and 65535. Any of the available open port scanners I can find on these forums take a good half a second minimum per port. This means it could take longer than two hours to find and grab the data, which is, of course, unacceptable. Are there any easier ways to do this? For $i = 49152 To 65535 Step 1 If INetGet("http://123.123.122.123:" & $i & "/BalanceData.txt") Then ExitLoop Next MsgBox(0, "Port Number", "Port: " & $i) Try the above and see if it accomplishes what you're looking for. Edit01: This may take a while as well, but it will eventually get the job done. How long does it take for this text file to be deleted? I also assume this way you may get someone else's data? So you should be very careful. Regards, Jarvis Edited August 20, 2009 by JSThePatriot AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
Lemures Posted August 20, 2009 Author Share Posted August 20, 2009 I've tried the INetGet command exactly as you've described, and it takes nearly a second per port. Way too long. I'll be the only one on the network, so I'm not worried about grabbing others' data. The easiest way, I think, is to scan for open ports. I'm considering just setting up a batch file with nmap, having it drop all of the open ports to a txt file, then reading in that txt file. *shrug*. Not sure yet. Everything is just too slow. Yes, I could manually type in the port, but I want this to be as automated as possible. Link to comment Share on other sites More sharing options...
monoceres Posted August 20, 2009 Share Posted August 20, 2009 Maybe you can use a multi-process approach? I.e. calling the InetGet as an parameter to the autoit exe. This would logically make the entire process take ~0.5 seconds. Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
Lemures Posted August 20, 2009 Author Share Posted August 20, 2009 I'm not certain if I want to run 16,000+ processes at the same time... :-\ Link to comment Share on other sites More sharing options...
monoceres Posted August 20, 2009 Share Posted August 20, 2009 I'm not certain if I want to run 16,000+ processes at the same time... :-\Ok, reasonable thought.How long does a simple TCPConnect take? Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
BrettF Posted August 20, 2009 Share Posted August 20, 2009 Maybe something like this? Opt ("TCPTIMEOUT", 50); 50ms timeout. Virtually could be down to about 25 depending on network speed... ;) TCPShutdown () For $i = 49152 To 65535 Step 1 If TCPConnect ("123.123.122.123", $i) <> -1 Then ExitLoop Next MsgBox(0, "Port Number", "Port: " & $i) Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Lemures Posted August 20, 2009 Author Share Posted August 20, 2009 The TCPConnect also takes about half a second per, even with the timeout. Maybe I'm doing something wrong. Oh well. I'm starting to think nmap is my only real option, I can get through the port range in a little over a minute if I get the settings right. Still, I'd rather do it in autoit. Link to comment Share on other sites More sharing options...
JSThePatriot Posted August 21, 2009 Share Posted August 21, 2009 The TCPConnect also takes about half a second per, even with the timeout. Maybe I'm doing something wrong.Oh well. I'm starting to think nmap is my only real option, I can get through the port range in a little over a minute if I get the settings right. Still, I'd rather do it in autoit.nmap can be called over the command line, you could still do it in AutoIt. Have AutoIt control nmap, read the results of open ports, and only try those ports for your data.Jarvis AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
jvanegmond Posted August 21, 2009 Share Posted August 21, 2009 (edited) nmap uses a whole different strategy. It scans ports on a fire and forget basis (I think), this means it can scan hundreds of ports at once, all going into a timeout while nmap is already working on trying to establish the next connection. Unfortunately, you can't do a number of things with AutoIt (because it was designed that way). One of them is threading, another is establishing only the first half of the TCP connection. As for a solution, JSThePatriot is right on the money. : ) Edited August 21, 2009 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
JSThePatriot Posted August 21, 2009 Share Posted August 21, 2009 nmap uses a whole different strategy. It scans ports on a fire and forget basis (I think), this means it can scan hundreds of ports at once, all going into a timeout while nmap is already working on trying to establish the next connection. Unfortunately, you can't do a number of things with AutoIt (because it was designed that way). One of them is threading, another is establishing only the first half of the TCP connection.As for a solution, JSThePatriot is right on the money. : )Why thank you sir! AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now