Advertisement
Guest User

Publish IP to web

a guest
Jun 14th, 2012
2,057
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $ipsite = (new-object net.webclient).DownloadString("http://myip.ru")
  2.  
  3. if ($ipsite -cmatch '(?s)<TD bgcolor=white align=center valign=middle>([0-9]{1,3}?\.[0-9]{1,3}?\.[0-9]{1,3}?\.[0-9]{1,3}?)</TD>') {
  4.     $ip = $matches[1]
  5. } else {
  6.     Write-Error "Cannot get ip!"; return
  7. }
  8.  
  9. $redirtemp = '<?xml version="1.0" encoding="utf-8"?>
  10. <!DOCTYPE html
  11.   PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  12.   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
  13.  
  14. <html xmlns="http://www.w3.org/1999/xhtml">
  15. <head>
  16. <title>
  17. Dynamic IP Page
  18. </title>
  19. </head>
  20. <body>
  21. The IP now is: ' + $ip +' <br></br>
  22. <a href="http://' + $ip +'">Router Control</a><br></br>
  23. <a href="http://' + $ip +':6566/gui/">Torrent Client Control</a><br></br>
  24. <a href="http://wmorein.com/rdpcreator/remote.php?servername=' + $ip +'">RDP Session (to Laptop)</a><hr></hr>
  25. Updated at ' + [string](Get-Date) +'
  26. </body>
  27. </html>'
  28.  
  29. $redirtemp > redir.xhtml
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement