Advertisement
jcunews

xor.vbs

Sep 5th, 2022
1,812
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if wsh.arguments.count < 3 then
  2.   wsh.echo "Usage: xor {xor value} {source file} {destination file}"
  3.   wsh.quit
  4. end if
  5. xval = cbyte(wsh.arguments(0))
  6. set ds = createobject("adodb.stream")
  7. ds.open
  8. ds.type = 1
  9. ds.loadfromfile wsh.arguments(1)
  10. ds.position = 0
  11. ds.type = 2
  12. ds.charset = "x-user-defined"
  13. s = ds.readtext(ds.size)
  14. l = len(s)
  15. d = ""
  16. for i = 1 to l
  17.   d = d & chr(asc(mid(s, i, 1)) xor xval)
  18. next
  19. ds.position = 0
  20. ds.seteos
  21. ds.writetext d
  22. ds.savetofile wsh.arguments(2), 2
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement