Advertisement
Guest User

mapftp.vbs

a guest
Mar 13th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Const NETHOOD = &H13& ' Create under NetHood locations
  2.  
  3. Set objWSHShell = CreateObject("Wscript.Shell")
  4. Set objShell = CreateObject("Shell.Application")
  5. Set objFSO = CreateObject("Scripting.FileSystemObject")
  6. Set objFolder = objShell.Namespace(NETHOOD)
  7. Set objFolderItem = objFolder.Self
  8.  
  9. If WScript.Arguments.Count < 2 then
  10.     WScript.Echo "Missing parameters"
  11.     WSCript.Quit
  12. End If
  13.  
  14. strUsername = WScript.Arguments(0)
  15. strPassHash = WScript.Arguments(1)
  16.  
  17. strNetHood = objFolderItem.Path
  18.  
  19. strShortcutName = "BankVault Files"
  20. strShortcutPath = "ftp://" & strUsername & ":" & strPassHash & "@127.0.0.1:8021/"
  21.  
  22. strShareFolder = strNetHood & "\" & strShortcutName & "\"
  23. strShortcut = strShareFolder & "target.lnk"
  24.  
  25. If objFSO.FolderExists(strShareFolder)=True Then
  26.     Set folderShare = objFSO.GetFolder(strShareFolder)
  27.     folderShare.Delete(True)
  28. End If
  29.  
  30. objFSO.CreateFolder(strShareFolder)
  31.  
  32. strDesktopIni = strShareFolder & "\Desktop.ini"
  33.  
  34. WriteFile strDesktopIni, "[.ShellClassInfo]", 2
  35. WriteFile strDesktopIni, "CLSID2={0AFACED1-E828-11D1-9187-B532F1E9575D}", 8
  36. WriteFile strDesktopIni, "Flags=2", 8
  37.  
  38. Set objShortcut = objWSHShell.CreateShortcut(strShortcut)
  39. objShortcut.TargetPath = strShortcutPath
  40. objShortcut.WindowStyle = 1
  41. objShortcut.Save
  42.  
  43. Set fileShortcut = objFSO.GetFile(strShortcut)
  44. fileShortcut.attributes = 36 ' S(4) + A(32)
  45.  
  46. Set folderShare = objFSO.GetFolder(strShareFolder)
  47. folderShare.attributes = 1 ' R(1)
  48.  
  49. Function WriteFile(Filename, Text, AccessType)
  50.     Dim fs, f
  51.     Set fs = CreateObject("Scripting.FileSystemObject")
  52.     Set f = fs.OpenTextFile(FileName, AccessType, true)
  53.     f.WriteLine Text
  54.     f.Close
  55. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement