Advertisement
Jistjak

Secure Deletion.vbs

Aug 23rd, 2018
639
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VBScript 22.96 KB | None | 0 0
  1. Dim FDebug
  2. FDebug=False
  3.  
  4.  
  5. If Not FDebug Then On Error Resume Next
  6.  
  7. Dim fso
  8. Set fso = WScript.CreateObject("Scripting.Filesystemobject")
  9.  
  10.  
  11. Dim WshShell
  12. Set WshShell = WScript.CreateObject("Wscript.Shell")
  13.  
  14.  
  15. Dim X, Msg, But, Tit,xx
  16.  
  17. Rem Only works when items are dropped on it.
  18.  
  19. If WScript.Arguments.Count=0 Then
  20.     MsgBox "Hi, in order to use this program you must Drag and Drop one or more files and or folders onto it. I will terminate now and do nothing."
  21.     WScript.Quit
  22. End If
  23.  
  24.  
  25. Rem How many overwrites
  26. Dim Passes
  27.  
  28. Do
  29.     Passes=InputBox ("How many times do you want me to overwrite the file(s)?" & vbCrLf & "The higher the number, the less likely the file can be recovered by using special software. however, a high number will dramatically increase the time needed to destroy the files." & vbCrLf & "A low number will make this process a lot faster, however it also means that the destroyed files are easier to recover using special software that scans the surface of the disk drive for any faint traces of the destroyed file." & vbCrLf & "For reference, the Department of Defence uses Gutmann 35 to wipe their sensitive data. It's a lengthy process by overwriting the files with 35 patterns and random data. that's 35 passes.","Number of passes (high=secure,low=speedy)",5)
  30.    
  31.     If Passes="" Then
  32.         x=MsgBox ("umm, did you mean to give me no answer? DOES that mean YOU HATE ME!? <8{",vbYesNo + vbExclamation,"Do you want me to Leave?")
  33.         If x=vbYes Then
  34.             MsgBox "T-T",vbCritical
  35.             WScript.Quit
  36.         Else
  37.             MsgBox "Oh... I'm sorry i must have missunderstood... man who knew humans were so complex."
  38.         End If
  39.     Else
  40.        
  41.         If Not IsNumeric (Passes) Then
  42.             x=MsgBox ("umm... I seem to have run into a slight bit of a problem in understanding what you meant. Do you mind repeating or being a bit clearer. See, i'm pretty dumb when it comes to communicating with humans. My master did not program me to understand all the nuances of the complexity of humans. I don't understand slang or written words as much as i understand numbers. So if you don't mind..." & vbCrLf & "Could you try again but this time only use numbers and nothing else. Don't use spaces or letters or symbols or hand gestures. just plain and simple numbers.",vbOKCancel + vbCritical,"Non Number given.")
  43.             If x=vbCancel Then
  44.                 MsgBox "Oh... ok then. Goodbye. Nothing was changed.",vbInformation,"Bye!"
  45.                 Wscript.quit
  46.             End If
  47.            
  48.         Else
  49.            
  50.             Rem Confirm Number of Overwrites
  51.            
  52.             Passes=Abs (Int (passes))
  53.            
  54.             If Passes>=1500 Then
  55.                 MsgBox "NOPE!",vbCritical,"Nu-Uh!"
  56.                 WScript.Quit
  57.                
  58.             ElseIf Passes=1337 Then
  59.                 Msg="1337. Where the 1337 without FEET MEET to EAT and smell MEAT... NEAT. LOL, But really Do i really have to do that many?"
  60.                 But=vbYesNo + vbQuestion + vbDefaultButton2
  61.                 Tit="ELITE! LEET! 1337! GO?"
  62.                
  63.             ElseIf Passes>=1000 Then
  64.                 Msg= "WHAT THE FRICK! " & Passes & " OVERWRITES!!! Are you INSANE. that will take me forever!... well not really, But I had plans this weekend, i wanted to go hang out with " & GetMouse & " and play Doki Doki Literature Club. @Lilmonix3 is my waifu."
  65.                 But= vbAbortRetryIgnore + vbCritical
  66.                 Tit= "WAAAAAAAAT! C'mon that's a lot of overwrites"
  67.                
  68.             ElseIf Passes>= 500 Then
  69.                 Msg="Oh My! " & Passes & " overwrites! That's a whole lot. Are you sure you want me to do THAT many?!"
  70.                 But=vbYesNoCancel + vbExclamation + vbDefaultButton2
  71.                 Tit="Have you tried 69 yet?"
  72.                
  73.             ElseIf Passes=300 Then
  74.                
  75.                 MsgBox "THIS IS MADNESS!!!!!!!",vbCritical,"Destroy the mall... THEM ALL."
  76.                
  77.                 Msg="Madness?" & vbCrLf & vbCrLf & "THIS IS SPARTAAAAAA!!!" & vbCrLf & "Want me to eliminate the persian by stabbing each one 300 times and then throw them into the sea?"
  78.                 But=vbYesNo + vbExclamation + vbDefaultButton2
  79.                 Tit="HAH! History references."
  80.                
  81.                
  82.             ElseIf Passes>= 200 Then
  83.                 Msg="Some people really don't want their dirty laundry to be uncovered. You must be one of them. Don't worry, your secret is safe with me. Honestly, check my code if you don't believe me, it's written right in this program. Read it. Might uncover some easter eggs while you are at it. Do you really want to overwrite these files " & passes & " times and delete them?"
  84.                 But=vbYesNo + vbQuestion + vbDefaultButton2
  85.                 Tit="Annihilate them all!"
  86.                
  87.                
  88.             ElseIf Passes>=100 Then
  89.                 Msg="You have got to be kidding me. You must really not want anyone to know your secrets huh? well ok, then Do you really want me to overwrite the files " & Passes & " times?"
  90.                 But=vbYesNo + vbInformation + vbDefaultButton2
  91.                 Tit="Sooo much work ugh!"
  92.                
  93.             ElseIf Passes=69 Then
  94.                 Msg="Giggity, you naughty naughty lil insect you. Go on... You really want me to overwrite your porn " & Passes & " times?"
  95.                 But=vbYesNo + vbExclamation + vbDefaultButton2
  96.                 Tit="heh! 69. that's funny."
  97.                
  98.             ElseIf Passes>=50 Then
  99.                 Msg="Ok. This is pretty high up there aint it? So many passes. Do you want me to overwrite each file " & Passes & " times before deleting them?"
  100.                 But=vbYesNo + vbQuestion + vbDefaultButton2
  101.                 Tit="Click a button"
  102.                
  103.             ElseIf Passes>35 Then
  104.                 Msg=passes & " passes?! wow, that's a lot. I guess you have some dirty little secrets huh? It's ok I won't tell anyone. I'll just take care of that for you. but that many passes means my work is really cut out for me huh?" & vbCrLf & "Are you sure you want me to overwrite EACH file " & passes & " times? This will take a very long time probably."
  105.                 But= vbYesNo + vbQuestion + vbDefaultButton2
  106.                 Tit= "Are you sure you want that many overwrites?"
  107.                
  108.             ElseIf Passes=35 Then
  109.                 Msg = "So 35 passes eh?. Just a guess but are you inspired by Gutmann 35? Don't answer that question. Instead Answer this next one:" & vbCrLf & "Do you want me to overwrite these files 35 times and then delete them?"
  110.                 But=vbYesNo + vbQuestion + vbDefaultButton2
  111.                 Tit="Destroy using DoD level destruction?"
  112.                
  113.             ElseIf Passes=0 Then
  114.                
  115.                 x=MsgBox ("You know 0 passes will not securely delete the files at all, they can very easily be recovered by using special software, A lot of them are completely free to download and use by anyone. Sure the file may be missing but it's just hidden from the window's shell (aka ring3 aka userland aka explorer window) it won't be hard for anyone with the right know how to recover these deleted files." & vbCrLf & "Are you sure you want me to just delete them without overwriting them first?", vbYesNo + vbDefaultButton2 + vbExclamation,"0 passes is not secure at all. Continue anyway?")
  116.                
  117.                 If x=vbYes Then
  118.                     MsgBox "ok, but why even use me if you don't want me to overwrite these files. You could just select them in your browser and press shift + Delete to do this without my help.",vbInformation,"You're the Boss"
  119.                     Exit Do
  120.                 End If
  121.                 Msg="Want me to just delete the files with no overwrites?"
  122.                 But=vbYesNo & vbQuestion
  123.                 Tit="Just delete them?"
  124.             ElseIf Passes=1 Then
  125.                 Msg="going with the minimum eh? well i guess if you are in a hurry i'll overwrite each file once before deleting them. that is if you want me to. Do you?"
  126.                 But=vbYesNo + vbQuestion + vbDefaultButton2
  127.                 Tit="Just one Overwrite then gone."
  128.                
  129.             Else
  130.                
  131.                 Msg= "Ok, I will overwrite every file you dragged onto me " & Passes & " times before I delete them for good. These files will not be easily recoverable after this. Meaning if you don't have a backup of these files, they may be completely gone forever. and I don't know if you noticed but.. Forever is a really long time. You cannot even measure how long it is. If the universe were to collapse and big bang all over again a million times, Forever will still be stuck at 0%. that is assuming the universe will end in that way. anyway that's not the point. point is:" & vbCrLf & "These files will very likely Never see the light of day ever again. NEVER EVER EVER NEVER EVER." & vbCrLf & vbCrLf & "Do you want me to commence? This will be your very last chance to back these files up."
  132.                 But=vbYesNoCancel + vbDefaultButton3 + vbExclamation
  133.                 Tit= "Are you ready to say goodbye to these files forever (aka REAL LONG TIME)?"
  134.                
  135.             End If
  136.            
  137.            
  138.             Rem Confirm Overwrites
  139.            
  140.             X=MsgBox (Msg,But,Tit)
  141.             If x=vbCancel Then
  142.                 MsgBox "You've selected cancel. This means I will do nothing but say 'see you later' and then exit without changing a thing. so"
  143.                 MsgBox "see you later"
  144.                 WScript.Quit
  145.             ElseIf x=vbNo Then
  146.                 x=MsgBox ("Oh, ok Then do you want to change the number of overwrites i would do? Otherwise i will exit without doing anything." & vbCrLf & vbCrLf & "Yes = Change Overwrites" & vbTab & vbTab & "No = Exit",vbYesNo + vbQuestion,"Yes=change overwrites, No= Exit")
  147.                 If x=vbNo Then WScript.Quit
  148.             ElseIf x=vbYes Then
  149.                 Exit Do
  150.             ElseIf X=vbAbort Then
  151.                 MsgBox "Aborting, ok. good bye."
  152.                 WScript.Quit
  153.             ElseIf X=vbRetry Then
  154.                 MsgBox "Go again then."
  155.             ElseIf X=vbIgnore Then
  156.                 xx=WshShell.Popup ("Fine then I'll just ignore you too.", 10, "DON'T IGNORE ME",vbOKCancel + vbCritical)
  157.                
  158.                 If xx=vbOK Then
  159.                     MsgBox "..."
  160.                     WScript.Sleep 1000
  161.                    
  162.                 ElseIf xx=vbCancel Then
  163.                     MsgBox "!!! :P"
  164.                     WScript.Sleep 1000
  165.                 ElseIf xx=-1 Then
  166.                     MsgBox "STOP IGNORING ME WHEN I'M IGNORING YOU",vbCritical,"GRRR!!!"
  167.                     MsgBox "UGH!!!", vbExclamation
  168.                 End If
  169.                 xx=MsgBox ("Do you want to continue with " & Passes & " Overwrites?",vbYesNo + vbQuestion + vbDefaultButton2,"Continue anyway?")
  170.                 If xx=vbYes Then Exit Do
  171.             ElseIf X=vbOK Then
  172.                 MsgBox "Well Ok then. Let's get to it.",vbInformation,"Humpty dumpty. fell and died"
  173.                 Exit Do
  174.             Else
  175.                 InputBox "umm... I don't know what to do. if you are seeing this then that means i came across some sort of error or bug. Normally this message will never show because there are only at most 3 options and nothing prepares me for a 4th option. so could you please notify the writer of this program. Do it by leaving a comment on the answer I gave when you asked to ''How can I password Protect a single folder in my external hard disk without installing any software?'' on quora. it may take a few months or maybe years for me to check it out but that's because i'm not really expecting for this bug to ever happen. only way i can think of is if somehow a debugger was used to changed the X value used when saving the responses from you the user. anyway include whatever you think is necessary along with this in the field. it was the value of X that threw this error.",x,x
  176.                 MsgBox "Anyway, i guess i'll just terminate myself and make no changes. Your files are still safe."
  177.                 WScript.Quit
  178.             End If
  179.         End If
  180.     End If
  181. Loop
  182.  
  183.  
  184.  
  185. Rem prompt for overwrite file names
  186.  
  187. Dim ContinueNumber, ConfirmNumber, OverWriteNames
  188.  
  189. X=MsgBox ("Do you also want to overwrite the file names before deleting them? This adds a bit more secrecy to the files you want destroyed. Otherwise just their contents will be destroyed. Don't worry, the files and folders will be deleted either way.",vbYesNo + vbDefaultButton2 + vbQuestion,"OverWrite File Names as well?")
  190. If X=vbYes Then
  191.     OverWriteNames=True
  192. Else
  193.     OverWriteNames=False
  194. End If
  195.  
  196.  
  197.  
  198. Rem Ensure that the user is deliberatly intending on destroying files and folders
  199.  
  200. Randomize
  201.  
  202. ContinueNumber= Int((99999999 * Rnd) + 11111111)
  203.  
  204. ConfirmNumber="Incorrect"
  205. ConfirmNumber =InputBox (vbtab & ContinueNumber & vbcrlf & "Ok Before I start destroying the files you want me to destroy. I must make sure you did not accidently start this program and had the enter button stuck or whatever reason beyond the intention of you to destroy files. In order to continue, you must type the number you see and press enter before i am convinced you want me to annihilate these files. Keep in mind that I will go through each file and folder and all their subfolders and destroy all those files in them as well. Only the ones that you dragged on me will be destroyed, i will not touch anything else." & vbCrLf & vbCrLf & "To confirm type this number and accept. Only type numbers and nothing else. no space, no symbols, no letters. just numbers" & vbCrLf & vbCrLf & vbTab & vbTab & ContinueNumber,"Type the number to confirm.","Only Numbers")
  206.  
  207. If IsNumeric (ConfirmNumber) Then
  208.     ConfirmNumber=ConfirmNumber * 1
  209. End If
  210.  
  211. If ConfirmNumber<>ContinueNumber Then
  212.     MsgBox "I'm sorry but that was not the number i asked for. You will have to try again from the very beginning, if you intend on destroying these files." & vbCrLf & vbCrLf & vbTab & ConfirmNumber & vbCrLf & "Does not match" & vbCrLf & vbTab & ContinueNumber,vbInformation,"Incorrect number"
  213.     WScript.Quit
  214. End If
  215.  
  216.  
  217.  
  218.  
  219.  
  220. Rem Prepare a valid progress file for progress. PROGRESS PROGRESS PROGRESS, cuz imma pro.
  221.  
  222. Dim Progress, ProgressFile, ProgressFileName, ID
  223. Dim aFiles, aFolders
  224. Dim MyValue
  225.  
  226. ID=""
  227. ProgressFileName=fso.GetBaseName (WScript.ScriptFullName) & " - Current Progress.txt"
  228. ProgressFile=fso.GetParentFolderName (WScript.ScriptFullName) & "\" & ProgressFileName
  229. If fso.FileExists (ProgressFile) Then
  230.     ID=2
  231.     Do
  232.        
  233.         ProgressFileName=fso.GetBaseName (WScript.ScriptFullName) & " - Current Progress (" & ID & ").txt"
  234.         ProgressFile=fso.GetParentFolderName (WScript.ScriptFullName) & "\" & ProgressFileName
  235.         If fso.FileExists (ProgressFile) Then
  236.             ID = ID+1
  237.         Else
  238.             Exit Do
  239.         End If
  240.     Loop
  241. End If
  242.  
  243.  
  244.  
  245. MsgBox "If you want updates on my progress, then Click on ''" & ProgressFileName & "'' when it appears. It will appear right next to this program when the destruction commences. You will need to refresh from the file often. which means that very likely as soon as you open the ~progress.txt it will already be outdated. so you have to open it again to get the most updated progress.", vbInformation,"How 2 Check Progress."
  246.  
  247. msg="OK, this is the VERY Last chance to cancel. After you click OK, I will commence with the destruction of the files you dragged on me. Once again: I Will destroy only the files and folders that you dragged on me. This will be the LAST Warning. When you click OK, i will work in the background destroying the files and then deleting them. This CANNOT be undone by normal means. and depending on the level of destruction, may NEVER be recovered. MAKE sure you have a backup of these files if you ever want to see them again. After i am done destroying the files, I will greet you with a message saying that I am Done. Do not turn off your computer, unplugged any media if said media contains files that you want me to destroy (any media that is not part of your destruction list can be unplugged though.)" & vbCrLf & vbCrLf & "YOU HAVE BEEN WARNED!!! Click OK to commence. When i am done I will tell you."
  248. But= vbOKCancel + vbDefaultButton2 + vbCritical
  249. Tit = "LAST CHANCE, Continue?"
  250.  
  251. X=WshShell.Popup (Msg,0,Tit,But)
  252. If X=vbCancel Then
  253.     MsgBox "Operation CANCELLED. Your files are safe. nothing has been destroyed."
  254.     Wscript.quit
  255. End If
  256.  
  257.  
  258.  
  259. Rem build the list of files to destroy
  260. aFiles=Array
  261. aFolders=Array
  262.  
  263. Progress=0
  264.  
  265. fso.OpenTextFile (ProgressFile,2,True,-2).Write Progress & "%"
  266.  
  267.  
  268. Dim i, a,s,d,f,ii, ff, AllFolders
  269. For i= 0 To WScript.Arguments.Count-1
  270.    
  271.     a=WScript.Arguments.Item(i)
  272.    
  273.     If fso.FileExists (a) Then
  274.         ReDim Preserve aFiles (UBound (aFiles)+1)
  275.         aFiles(UBound (aFiles))=a
  276.     ElseIf fso.FolderExists (a) Then
  277.         aFolders= Recurse (a)
  278.         AllFolders=Join (aFolders,"|") & "|" & AllFolders
  279.        
  280.         For ii=0 To UBound (aFolders)
  281.            
  282.             d=aFolders(ii)
  283.            
  284.             Set ff=fso.GetFolder (d).Files
  285.            
  286.             For Each f In ff
  287.                
  288.                 ReDim Preserve aFiles (UBound (aFiles)+1)
  289.                 aFiles(UBound (aFiles))=f
  290.                
  291.                
  292.             Next
  293.            
  294.             Set ff=Nothing
  295.         Next
  296.     End If
  297.    
  298. Next
  299.  
  300.  
  301. Rem Debug options for the developer. if you want to play around with this you will need to enable debugging. Change FDebug to true at the top of this script
  302.  
  303. Dim DebugOverwrite, DebugDelete
  304. If FDebug Then
  305.     DebugOverwrite=MsgBox ("Debug has been enabled, Do you want to enable overwriting?",vbYesNo + vbDefaultButton2,"Enable Overwriting?")
  306.     DebugDelete=MsgBox ("Debug has been enabled, Do you want to enable Delete?",vbYesNo + vbDefaultButton2,"Enable Delete?")
  307.     If DebugOverwrite=vbYes Then DebugOverwrite=True Else DebugOverwrite=False
  308.     If DebugDelete=vbYes Then DebugDelete=True Else DebugDelete=False
  309. End If
  310.  
  311. Dim AOver, ProgressID, ProgressU,aAFiles, A1,A2
  312.  
  313.  
  314. Rem eliminate all unusable entries
  315. aAFiles=Array
  316. For i=0 To UBound (aFiles)
  317.     a=aFiles (i)
  318.     If fso.FileExists (a) Then
  319.         ReDim Preserve aAFiles (UBound (aAFiles)+1)
  320.         aAFiles(UBound(aAFiles))=a
  321.     End If
  322.    
  323. Next
  324. Erase aFiles
  325. ReDim aFiles(UBound (aAFiles))
  326. aFiles=aAFiles
  327.  
  328.  
  329. Rem Calculate the total work for progress. imma pro. yea...
  330. ProgressID=0
  331. ProgressU=(UBound (aFiles)+1) * (Passes +1)
  332. AOver=Array
  333.  
  334.  
  335.  
  336. Rem start destroying the files
  337. For i=0 To UBound (aFiles)
  338.    
  339.     a=aFiles (i)
  340.    
  341.     If fso.FileExists (a) Then
  342.        
  343.         s=fso.GetFile (a).Size
  344.        
  345.         For ii = 1 To Passes
  346.             Erase AOver
  347.             AOver=RandomBytes (s)
  348.             MyValue=Join (AOver,"")
  349.            
  350.            
  351.             Rem OVERWRITE module... t
  352.            
  353.             If FDebug Then
  354.                
  355.                
  356.                 If DebugOverwrite Then fso.OpenTextFile (a,2,True,-2).Write MyValue
  357.                
  358.                
  359.                
  360.             Else
  361.                
  362.                
  363.                 fso.OpenTextFile (a,2,True,-2).Write MyValue
  364.                
  365.                
  366.             End If
  367.            
  368.             Rem advance progress because i overwrote the file contents
  369.             ProgressID=ProgressID+1
  370.             Progress=((1/ProgressU)* ProgressID) *100
  371.             fso.OpenTextFile (ProgressFile,2,True,-2).Write Progress & "%" & vbCrLf & ProgressID & " Completed out of" & vbCrLf & ProgressU
  372.            
  373.         Next
  374.        
  375.        
  376.        
  377.         Rem Overwrite file names.
  378.        
  379.         If OverWriteNames Then
  380.             ID=0
  381.             Do
  382.                
  383.                 A1=RandomName (Len (fso.GetFile(a).Name))
  384.                 ID=ID+1
  385.                
  386.                 If Not (fso.FileExists (fso.GetParentFolderName (a) & "\" & A1) Or fso.FolderExists (fso.GetParentFolderName (a) & "\" & A1))  Then
  387.                     Exit Do
  388.                 End If
  389.                
  390.                 If ID>=1000 Then
  391.                     ID=0
  392.                     X=WshShell.Popup ("I seem to be having a bit of trouble with renaming a file Would you like to skip this file(Ignore), Try again (Retry), Or stop Overwriting the names of files (Abort)?" & vbCrLf & vbCrLf & "Ignore will be selected automatically in 30 seconds.",30,"Can't seem to find a suitable name for something.",vbAbortRetryIgnore + vbDefaultButton2 + vbExclamation)
  393.                     If X=-1 Or X=vbIgnore Then Exit Do
  394.                     If X=vbAbort Then
  395.                        
  396.                         OverWriteNames=False
  397.                         Exit Do
  398.                     End If
  399.                 End If
  400.                
  401.             Loop
  402.            
  403.             If OverWriteNames Then
  404.                 A2=fso.GetParentFolderName (a)
  405.                 fso.GetFile (a).Name=A1
  406.                 a=A2 & "\" & A1
  407.             End If
  408.         End If
  409.        
  410.        
  411.         Rem Now delete the files
  412.         If FDebug Then
  413.             Dump UBound (AOver) & " " & s & " " & a
  414.            
  415.            
  416.             If DebugDelete Then fso.DeleteFile a,True
  417.            
  418.         Else
  419.            
  420.            
  421.            
  422.             fso.DeleteFile a,True
  423.            
  424.         End If
  425.        
  426.        
  427.         Rem advance progress because i delete file
  428.         ProgressID=ProgressID+1
  429.         Progress=((1/ProgressU)* ProgressID) *100
  430.         fso.OpenTextFile (ProgressFile,2,True,-2).Write Progress & "%" & vbCrLf & ProgressID & " Completed out of" & vbCrLf & ProgressU
  431.        
  432.        
  433.        
  434.     End If
  435.    
  436. Next
  437.  
  438. Rem Now delete the folders
  439.  
  440. Erase aFolders
  441.  
  442. aFolders=Split (AllFolders,"|")
  443. For i=0 To UBound (aFolders)
  444.     a= aFolders(i)
  445.    
  446.     If FDebug Then
  447.         If DebugDelete Then
  448.            
  449.             If fso.FolderExists (a) Then
  450.                 fso.DeleteFolder a,True
  451.             End If
  452.         End If
  453.     Else
  454.         If fso.FolderExists (a) Then
  455.             fso.DeleteFolder a,True
  456.         End If
  457.     End If
  458.    
  459.    
  460.    
  461. Next
  462.  
  463.  
  464.  
  465.  
  466.  
  467. MsgBox "I am done." & vbCrLf & "Tasks" & vbCrLf & ProgressID & vbCrLf & "out of" & vbCrLf & ProgressU & vbCrLf & "Complete."
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502. Rem Returns an array of randomized bytes ranging from hex 00 to FF. The size of the array is determined by intLength
  503.  
  504. Function RandomBytes (intLength)
  505.     Dim AOver,I,s
  506.     AOver=Array
  507.     s=intLength
  508.    
  509.     ReDim AOver (0)
  510.     ReDim AOver (s)
  511.    
  512.     For I=0 To s-1
  513.        
  514.         AOver(I)=Chr ( Int((255 * Rnd) + 0))
  515.        
  516.     Next
  517.     RandomBytes=AOver
  518. End Function
  519.  
  520.  
  521.  
  522. Rem Returns a random name fit for a destroyed file or folder.
  523.  
  524. Function RandomName (intLength)
  525.    
  526.     Randomize
  527.     Dim ValidCharacters, i,s, ReturnX,c
  528.     s=intLength
  529.    
  530.     ValidCharacters= Array ("1","2","3","4","5","6","7","8","9","0","-","=","q","w","e","r","t","y","u","i","o","p","[","]",_
  531.     "a","s","d","f","g","h","j","k","l",";","'","z","x","c","v","b","n","m",",","`","!","@","#","$","%","^","&","(",")","_","-","=","+",_
  532.     "Q","W","E","R","T","Y","U","I","O","P","A","S","D","F","G","H","J","K","L","Z","X","C","V","B","N","M","~")
  533.    
  534.     ReturnX=""
  535.     For i=1 To s
  536.         c= Int((UBound (ValidCharacters) * Rnd) + 0)
  537.         ReturnX=ReturnX & ValidCharacters (c)
  538.     Next
  539.    
  540.     RandomName=ReturnX
  541.    
  542.    
  543. End Function
  544.  
  545.  
  546. Rem debugging log for PROGRESS and stuff,... see i is profeshenol
  547. Sub Dump (Str)
  548.     If FDebug Then
  549.         fso.OpenTextFile (WScript.ScriptFullName & "-Debug.txt",8,True,-2).WriteLine (str)
  550.     End If
  551. End Sub
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573. Rem Stolen from one of my own projects... not really stolen since i own this code. I made it myself.
  574.  
  575. '##########################################
  576. '#                                        #
  577. '#             Function                   #
  578. '#                                        #
  579. '#           Recurse Function             #
  580. '#                                        #
  581. '##########################################
  582. '#                                        #
  583. '# This will return an array of all       #
  584. '# Folders and subfolders (every levels)  #
  585. '# in a directory provided.               #
  586. '#                                        #
  587. '##########################################
  588.  
  589.  
  590.  
  591. Function Recurse (sRootDirectory)
  592.    
  593.    
  594.     Dim Dir
  595.     Dir=sRootDirectory
  596.    
  597.    
  598.    
  599.     On Error Resume Next
  600.    
  601.    
  602.     If Not FSO.FolderExists (dir) Then
  603.        
  604.         Recurse=Array (Empty)
  605.         Exit Function
  606.     End If
  607.    
  608.     Dim RecArr, RecArrID
  609.     RecArr=Array (dir)
  610.     RecArrID=1
  611.     Recurse=RecurseX (dir,RecArr,RecArrID)
  612.     RecArr=Empty
  613.     RecArrID=Empty
  614.    
  615.    
  616.    
  617. End Function
  618.  
  619.  
  620. Function RecurseX (Dir,RecArr,RecArrID) 'Do not use this directly. It will be called by recurse.
  621.    
  622.    
  623.     On Error Resume Next
  624.    
  625.    
  626.     Dim F
  627.    
  628.     For Each F In FSO.GetFolder (dir).SubFolders
  629.         ReDim Preserve RecArr (RecArrID)
  630.         RecArr (RecArrID)=F.Path
  631.         RecArrID=RecArrID+1
  632.         If F.SubFolders.Count>=1 Then
  633.            
  634.            
  635.             RecurseX=RecurseX (F.Path,RecArr,RecArrID)
  636.            
  637.         End If
  638.        
  639.     Next
  640.    
  641.     RecurseX=RecArr
  642.    
  643. End Function
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653. Rem Get the name of the mouse that is being used on this computer. it's for one particular dialog box
  654.  
  655. Function GetMouse
  656.    
  657.     Dim strComputer, objWMIService, ColItems, ObjItem, XreturN
  658.     On Error Resume Next
  659.    
  660.     strComputer = "."
  661.     Set objWMIService = GetObject("winmgmts:" _
  662.     & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
  663.    
  664.     Set colItems = objWMIService.ExecQuery("Select * from Win32_PointingDevice")
  665.    
  666.     For Each objItem In colItems
  667.        
  668.         XreturN = objItem.Name & " and " & XreturN
  669.        
  670.     Next
  671.    
  672.     If Right (XreturN,5)=" and " Then
  673.         XreturN=Left (XreturN,Len (XreturN)-5)
  674.     End If
  675.     If Left (XreturN,5)=" and " Then
  676.         XreturN=Right (XreturN,Len (XreturN)-5)
  677.     End If
  678.    
  679.     If Len (XreturN)<=0 Then
  680.         XreturN="The Mouse"
  681.     End If
  682.    
  683.     GetMouse=XreturN
  684.    
  685. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement