+ Post New Thread
Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 36
General Chat Thread, Progam/Scripting Challenge - where am I in General; ...
  1. #16
    budgester's Avatar
    Join Date
    Jan 2006
    Location
    Enfield, Middlesex
    Posts
    486
    Thank Post
    4
    Thanked 38 Times in 30 Posts
    Rep Power
    25
    How about a gps dongle for you laptop.

    Bluetooth® GPS Receiver > Maplin

    Then you could use google maps as well, and plot your location on a map.

    Then they would even know if your down the pub or still at home.

    Or send it to your twitter account, the opportunities for invasion of your privacy are endless.

    Buddy Beacon

  2. #17
    Sirbendy's Avatar
    Join Date
    Nov 2005
    Posts
    2,305
    Thank Post
    8
    Thanked 205 Times in 155 Posts
    Rep Power
    111
    hmm. No idea on the actual code side, but...

    If each site has a different IP setup, a script that conditionally checks the IP and then uploads different files to a webserver using FTP, depending on the condition?

  3. #18
    TechSupp's Avatar
    Join Date
    Mar 2007
    Location
    South Yorkshire
    Posts
    1,995
    Thank Post
    326
    Thanked 127 Times in 107 Posts
    Rep Power
    42
    Whats up with a mobile phone? I have the same situation and that just about covers all eventualities for contact.

  4. #19
    budgester's Avatar
    Join Date
    Jan 2006
    Location
    Enfield, Middlesex
    Posts
    486
    Thank Post
    4
    Thanked 38 Times in 30 Posts
    Rep Power
    25
    Quote Originally Posted by Sirbendy View Post
    hmm. No idea on the actual code side, but...

    If each site has a different IP setup, a script that conditionally checks the IP and then uploads different files to a webserver using FTP, depending on the condition?
    Nooooooo....

    You'd be wanting to scp, if you've got a publically available ftp server on the internet you are asking to be abused.

  5. #20

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    10,052
    Thank Post
    3,583
    Thanked 1,123 Times in 1,025 Posts
    Rep Power
    377
    Quote Originally Posted by budgester View Post
    Nooooooo....

    You'd be wanting to scp, if you've got a publically available ftp server on the internet you are asking to be abused.
    you mean sftp or whats scp ?

  6. #21

    powdarrmonkey's Avatar
    Join Date
    Feb 2008
    Location
    Alcester, Warwickshire
    Posts
    4,867
    Thank Post
    412
    Thanked 778 Times in 651 Posts
    Rep Power
    182
    Quote Originally Posted by mac_shinobi View Post
    you mean sftp or whats scp ?
    Same difference to all intents and purposes (sftp leverages scp which leverages ssh).

  7. Thanks to powdarrmonkey from:

    mac_shinobi (4th March 2009)

  8. #22

    matt40k's Avatar
    Join Date
    Jun 2008
    Location
    Ipswich
    Posts
    4,522
    Thank Post
    374
    Thanked 677 Times in 551 Posts
    Rep Power
    166
    WTf?!? Why would you want "Ftp" it? You can setup an ASP\PHP webpage to accept the input from the client then update the database (mysql) which the end user would see the result of.

    All the client would need to do it scrap the IP address from his machine, then use HTTP service to POST it to the ASP\PHP webpage.

    I think I'm sing out of the same book as David Hicks.

    Using SFTP would mean you need 3rd party files etc. "My" way is a "simple" VBS script and a PHP\ASP webpage.

  9. #23

    SimpleSi's Avatar
    Join Date
    Jun 2005
    Location
    Lancashire
    Posts
    5,829
    Thank Post
    1,476
    Thanked 595 Times in 446 Posts
    Rep Power
    170
    Many ideas - ta

    I updated google maps on my Omnia and set up Latitude - but I think people will have to logon to a google account to see it so maybe not what I'm after

    (but handy to track daughters )

    My thoughts were to go down the FTP route to start with but I like the idea of picking up IP direct using the $SERVER['REMOTE_ADDR'] - so I added it to my help desk front page just to test it out tmrrw when at school to see what IP it returns (it gives my home ip now but need to see if it gives out LEA 10.xxx.yyy.zzz when at a school)

    If that doesn't work, then I'll try out the parsing locally and then uploading using $POST/$GET (but how do I script an http request - didn't quite understand the wget code )

    For those wondering why I want this and why not change a calendar manually

    1. I'll forget

    2. The challenge

    3. Its all part of my attempts to help teachers help themselves - the number of times somethings gone wrong and I asked why they didn't call me as I was just 1 mile away and they say - we didn't know

    So if it helps me to help them - then its worth it

    regards

    Simon

  10. #24

    SimpleSi's Avatar
    Join Date
    Jun 2005
    Location
    Lancashire
    Posts
    5,829
    Thank Post
    1,476
    Thanked 595 Times in 446 Posts
    Rep Power
    170
    Web server doesn't pick up 10.xxx.yyy.zzz address using $REMOTE

    so using this modified VBS code
    Code:
    strComputer = "."
    Dim result
    
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colItems = objWMIService.ExecQuery _
        ("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
    
    For Each objItem in colItems
    '    Wscript.Echo objItem.MACAddress
        For Each strAddress in objItem.IPAddress
    	if left(strAddress,3) = "10." then
    '        	Wscript.Echo strAddress
    		result=WriteFileText("c:\ipaddress.txt",strAddress)
    	end if
        Next
    Next
    
    
    
    Function WriteFileText(sFilePath, sText)
        Dim objFSO 'As FileSystemObject
        Dim objTextFile 'As Object
       
        Const ForReading = 1
        Const ForWriting = 2
        Const ForAppending = 8
       
        Set objFSO = CreateObject("Scripting.FileSystemObject")
        Set objTextFile = objFSO.CreateTextFile(sFilePath, True)
       
        ' Write a line.
        objTextFile.Write (sText)
    
        objTextFile.Close
        'objTextFile.Close
    
    End Function
    which gives me my school LAN address - now how to get c:\ipaddress.txt onto the webserver via a script?

    regards
    Simon

  11. #25

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    10,052
    Thank Post
    3,583
    Thanked 1,123 Times in 1,025 Posts
    Rep Power
    377
    Last edited by mac_shinobi; 5th March 2009 at 08:34 AM.

  12. #26

    SYNACK's Avatar
    Join Date
    Oct 2007
    Posts
    11,271
    Thank Post
    884
    Thanked 2,749 Times in 2,322 Posts
    Blog Entries
    11
    Rep Power
    785
    Just a random idea but since you are playing in VBS and WMI anyway you could do it all in VBS if your webserver runs windows by using WinRM and WMI

    If you install WinRM on the server and client then you can run WMI querys over the net, the code from below allows you to raname files through WMI so you should be able to copy a premade html template with your location to be location.html depending on which school you were in.

    Rename or copy a file (VBScript) - Windows Server Cookbook

    A completely random solution but uses some pretty cool toys and allows you to stick to native VBS. The other options listed above are probably easier though.

  13. #27

    SimpleSi's Avatar
    Join Date
    Jun 2005
    Location
    Lancashire
    Posts
    5,829
    Thank Post
    1,476
    Thanked 595 Times in 446 Posts
    Rep Power
    170
    Well I've gone for the simple ftp the ipaddress.txt file up to webserver and then check its contents on my main php index page and display cross ref my ip with the school.

    Current code is in 2 files - one vbs and one bat (you don't seem to be able to jsut ftp in vbs without extra components)
    Code:
    strComputer = "."
    Dim result
    
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colItems = objWMIService.ExecQuery _
        ("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")
    
    For Each objItem in colItems
    '    Wscript.Echo objItem.MACAddress
        For Each strAddress in objItem.IPAddress
    	if left(strAddress,3) = "10." then
    '        	Wscript.Echo strAddress
    		result=WriteFileText("c:\ipaddress.txt",strAddress)
    	end if
        Next
    Next
    
    Set WShell = CreateObject("WScript.Shell")
    'WShell.Run WShell.ExpandEnvironmentStrings("%COMSPEC%") "/c c:\ftpipaddress.bat" 
    WShell.Run("%COMSPEC% /K c:\ftpipaddress.bat"), 1, True 
    
    
    Function WriteFileText(sFilePath, sText)
        Dim objFSO 'As FileSystemObject
        Dim objTextFile 'As Object
       
        Const ForReading = 1
        Const ForWriting = 2
        Const ForAppending = 8
       
        Set objFSO = CreateObject("Scripting.FileSystemObject")
        Set objTextFile = objFSO.CreateTextFile(sFilePath, True)
       
        ' Write a line.
        objTextFile.Write (sText)
    
        objTextFile.Close
    End Function
    and
    Code:
    @echo off
    echo user *********> ftpcmd.dat
    echo ********>> ftpcmd.dat
    echo bin>> ftpcmd.dat
    echo put c:\ipaddress.txt>> ftpcmd.dat
    echo quit>> ftpcmd.dat
    ftp -n -s:ftpcmd.dat www.*********.sch.uk
    del ftpcmd.dat
    exit
    @synack - as usual you suggestion is good but I don't have that sort of access to the server (and no idea if its windows or linux )

    Ta for suggestions and if anyone has a more elegant all-in-one script (maybe a bat file that can parse the output of ipconfig to find a 10.* address - my dos bat coding not good enough for that )

    regards

    Simon
    Attached Thumbnails Attached Thumbnails Progam/Scripting Challenge - where am I-untitled.png  

  14. #28

    SimpleSi's Avatar
    Join Date
    Jun 2005
    Location
    Lancashire
    Posts
    5,829
    Thank Post
    1,476
    Thanked 595 Times in 446 Posts
    Rep Power
    170
    PS just noticed the Critical alert from another school so I'm off

    regards

    Simon

  15. #29

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    10,052
    Thank Post
    3,583
    Thanked 1,123 Times in 1,025 Posts
    Rep Power
    377
    @echo off

    ipconfig | find "IP Address" > ip.txt
    type ip.txt
    pause

  16. #30

    SimpleSi's Avatar
    Join Date
    Jun 2005
    Location
    Lancashire
    Posts
    5,829
    Thank Post
    1,476
    Thanked 595 Times in 446 Posts
    Rep Power
    170


    I like your thinking

    Yes - that would find the line with IP

    in it and I could parse the rest of it in PHP so it is a solution

    But I was looking for the DOS guru who can make tea using the cmd line and just extract the first 10.xxx.yyy.zzz address it finds active


    regards

    Simon



SHARE:
+ Post New Thread
Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. Anyone care for a challenge
    By contink in forum Hardware
    Replies: 0
    Last Post: 25th January 2008, 02:53 PM
  2. Replies: 10
    Last Post: 14th September 2007, 08:59 PM
  3. A Challenge
    By sqdge in forum How do you do....it?
    Replies: 7
    Last Post: 6th August 2007, 12:35 PM
  4. A challenge!
    By Halfmad in forum General Chat
    Replies: 12
    Last Post: 31st July 2007, 02:40 PM
  5. Challenge
    By SteveT in forum General Chat
    Replies: 12
    Last Post: 30th April 2006, 09:27 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •