Advertisement
Guest User

vbs-eula

a guest
Jan 29th, 2016
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2. <head>
  3.  
  4. <!--Hides all basic windows GUI functions such as Taskbar and Close button -->
  5. <HTA:APPLICATION  
  6.   APPLICATIONNAME="LOGIN"  
  7.   VERSION="1.0"  
  8.   BORDER="none"  
  9.   INNERBORDER="no"  
  10.   CAPTION="no"  
  11.   SYSMENU="no"
  12.   MAXIMIZEBUTTON="no"  
  13.   MINIMIZEBUTTON="no"  
  14.   ICON="NO"  
  15.   SCROLL="no"  
  16.   SCROLLFLAT="yes"  
  17.   SINGLEINSTANCE="yes"  
  18.   WINDOWSTATE="maximize"  
  19.   SHOWINTASKBAR="no"  
  20.   CONTEXTMENU="no"  
  21.   SELECTION="no"/>
  22.  
  23.  
  24. <script language="VBScript">
  25.     Set objShell = CreateObject("WScript.Shell")    
  26.     Set fso = CreateObject("Scripting.FileSystemObject")
  27.     System = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System\"
  28.     DisableTaskMgr
  29.     dim currentDir : currentDir = objShell.CurrentDirectory 'Finds the scripts current directory'
  30.    'TO DO: Check whether UserName method below can be used over network'
  31.    UserName = objShell.ExpandEnvironmentStrings("%USERNAME%") 'Grabs the username of the current user'
  32.    pathToConfig = currentDir & "/config.ini"
  33.     pathToKeyFile = "C:/sys/"
  34.    
  35.  
  36.     'Gets the current version number from config file'
  37.    If fso.FileExists(pathToConfig) Then 'Makes sure that the config file exists'
  38.      Set ConfigFile = fso.GetFile(pathToConfig) 'Config file contains only the version number'
  39.      If ConfigFile.Size > 0 Then 'This makes sure that there is a version number set inside the config file'
  40.        Set versionFile = fso.OpenTextFile(pathToConfig, 1)
  41.         Version = versionFile.ReadAll
  42.       Else
  43.         EnableTaskMgr
  44.         window.close 'If config file cannot be reached then the script will end prematurely and will be shown next time the user logs in once the config file can be reached.'
  45.      End If
  46.     Else
  47.       window.close
  48.     End If
  49.     On Error Resume Next
  50.     versionFile.close
  51.  
  52.     'Searches C:/sys/ for keyfile'
  53.    If fso.FileExists(pathToKeyFile & Version) Then
  54.       EnableTaskMgr
  55.       window.close
  56.     Else
  57.     End If
  58.  
  59.     sub Postpone
  60.     ChkOne = pathToKeyFile & Version & "-1"
  61.     ChkTwo = pathToKeyFile & Version & "-2"
  62.     ChkThree = pathToKeyFile & Version & "-3"
  63.    
  64.       If fso.FileExists(ChkThree) Then
  65.         'Call Javascript for disabling postpone button'
  66.        MsgBox "Maximum number of Postpone attempts used. You must now choose to either Accept or Decline the Policy."
  67.       ElseIf fso.FileExists(ChkTwo) Then
  68.         'Delete file ChkTwo - Create file ChkThree'
  69.        fso.DeleteFile(ChkTwo)
  70.         Set objFile = fso.CreateTextFile(ChkThree)
  71.         window.close
  72.       ElseIf fso.FileExists(ChkOne) Then
  73.         'Delete file ChkOne - Create file ChkTwo'
  74.        fso.DeleteFile(ChkOne)
  75.         Set objFile = fso.CreateTextFile(ChkTwo)
  76.         window.close
  77.       Else
  78.         'Create file ChkOne'
  79.        Set objFile = fso.CreateTextFile(ChkOne)
  80.         window.close
  81.       End If
  82.     end sub
  83.  
  84.     sub DisableTaskMgr
  85.       objShell.RegWrite System, "REG_SZ"
  86.       objShell.RegWrite System & "/DisableTaskMgr", 1, "REG_DWORD"
  87.     end sub
  88.  
  89.     sub EnableTaskMgr
  90.       objShell.RegWrite System, "REG_SZ"
  91.       objShell.RegWrite System & "/DisableTaskMgr", 0, "REG_DWORD"
  92.     end sub
  93.  
  94.     sub Logon 'Method only runs when user clicks "I Accept"'
  95.      On Error Resume Next
  96.       Call EnableTaskMgr
  97.       If Not (fso.FileExists(currentDir & "/store/" & LCase(UserName) & ".csv")) Then
  98.         On Error Resume Next
  99.         Set objFile = fso.CreateTextFile(currentDir & "/store/" & LCase(UserName) & ".csv", True)
  100.         objFile.close
  101.       Else      
  102.       End If
  103.       Set objCSVFile = fso.OpenTextFile(currentDir & "/store/" & UserName & ".csv", 2, True)
  104.       objCSVFile.Write(UserName & "," & Now & "," & Version)
  105.       objCSVFile.Close
  106.       On Error Resume Next
  107.       fso.CreateTextFile("C:/sys/" & Version)
  108.       window.close  
  109.     end sub
  110.  
  111.     sub Logoff 'Method only runs when user clicks "I Decline"'
  112.      objShell.Run "shutdown /l"
  113.     end sub
  114. </script>
  115.  
  116. <script type="text/javascript">
  117.   function checkfile()
  118.   {
  119.     var fileLocation = "C:/sys/"
  120.     var regex = new RegExp('\w+\-3');
  121.    if(fso.FileExists(fileLocation + regex)) {
  122.       alert("File found successfully");
  123.     } else {
  124.       alert("File not found.");
  125.     }
  126.   }
  127.   window.onload = checkfile;
  128. </script>
  129.  
  130. <style type="text/css">
  131. body{margin:40px;font-family:Arial}hr{margin-bottom:15px;height:1px;background-color:#004c99}.title{margin-bottom:16px;font-size:18px}img{width:199px;height:71.5px;margin-bottom:75px}.main_text{margin-bottom:20px}.button{float:right;margin-left:10px;background-color:#00265D;border:1px solid #004c99;display:inline-block;color:#fff;font-family:arial;font-size:15px;font-weight:700;padding:9px 25px;text-decoration:none;cursor:pointer}
  132. </style>
  133. </head>
  134.  
  135. <body>
  136.     <img src="assets/NG-Bailey.png" alt="Company Logo">
  137.     <div class="title">Relevant End User Licence Agreement</div>
  138.     <hr>
  139.     <object data="assets/policy.pdf" type="application/pdf" width="100%" height="60%" alt="End User License Agreement">If you cannot see the above document, please contact the IT Service Desk</object>
  140.     <hr>
  141.     <h6>If you cannot see the above document, please contact the IT Service Desk</h6>
  142.     <h4>By clicking "I Accept" you are agreeing to the above document.</h4>
  143.     <div>
  144.         <a href onClick="Logoff" class="button">I Decline</a>
  145.     </div>    
  146.     <div>
  147.         <a href onClick="Logon" class="button">I Accept</a>
  148.     </div>
  149.     <div>
  150.       <a href onClick="Postpone" class="button" id="btnPostpone">Postpone</a>
  151.     </div>
  152. </body>
  153. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement