Guest User

Untitled

a guest
Mar 17th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. case "`cat $* | sed '1!d'`" in *[!-_a-zA-Z0-9]*) exit 1 ;; esac
  4. echo " It has passed the Login initial security checkpoint "> /tmp/openvpn.log
  5. case "`cat $* | sed '2!d'`" in *[!-_a-zA-Z0-9]*) exit 1 ;; esac
  6. echo " It has passed the pasword initial security checkpoint ">> /tmp/openvpn.log
  7.  
  8. USERS=`cat /tmp/users`
  9.  
  10. Login=`cat $* | sed '1!d'`
  11. Password=`cat $* | sed '2!d'`
  12.  
  13. echo " $Login $Password ">> /tmp/openvpn.log
  14.  
  15. HASHPASS=`echo -n "$Login$Password" | md5sum | sed s'/ -//'`
  16. i=0
  17. while [ $i -lt 10 ]; do
  18. HASHPASS=`echo -n $HASHPASS$HASHPASS | md5sum | sed s'/ -//'`
  19. i=`expr $i + 1`
  20. done
  21.  
  22. for i in $USERS; do
  23. Name=${i%:*}
  24. PassHash=${i#*:}
  25. if [ "$Name" == "$Login" ]
  26. then
  27. if [ "$HASHPASS" == "$PassHash" ]
  28. then
  29. echo "Password hashes match"
  30. exit 0
  31. fi
  32. fi
  33. done
  34. echo "Login credentials failed"
  35. exit 1
Add Comment
Please, Sign In to add comment