home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / MUR_PIN1.ZIP / PIN.PPS < prev    next >
Encoding:
Text File  |  1993-08-20  |  8.8 KB  |  234 lines

  1. ;                               (93-08-20)
  2. ;
  3. ;   This idea of the PIN is originaly from USA and Scott Carpenter, modified
  4. ;   by Peter Laur / Murphys, Ulf Svanlund / Oasen and Rikard Elofsson / Kemlab.
  5. ;
  6. ;   The program does 3 separate checks to see if a user has been qualified to
  7. ;   be asked for the PIN code. In this setup the following is default:
  8. ;
  9. ;   --------------------------------------------------------------------------
  10. ;                    Ask for PIN every 50'th call
  11. ;                               *or*
  12. ;            When Security Violations exceed 10 in integers
  13. ;                               *or*
  14. ;              When Password Failed exceeds 5 in integers
  15. ;   --------------------------------------------------------------------------
  16. ;        (Note: All 3 functions are totaly independent of each other.)
  17. ;
  18. ;  You can change the defaults below to suit your needs of security. If a user
  19. ;  fails to answer he's PIN, I punish him down to seclevel 8 and refuses him
  20. ;  access to our system until he has been verified by us on phone. To store
  21. ;  the Security Violations & Password Failures we use the Note (PSA) Line 5.
  22. ;  You *must* have the Notes, Statistic & Verification (PSA) installed to use
  23. ;  this PPE...! (Only PCBoard v15.0)
  24. ;
  25. ;  The menus & PPE in this package must be in c:\pcb\ppe\pin or be changed.
  26. ;  At my system I have Security specific logon files like level 103 and at
  27. ;  the top of the @-menu just add: !C:\PCB\PPE\PIN\PIN.PPE or whatever path
  28. ;  you use after compilation.
  29. ;
  30. ;  If you make updates or mods, please upload them to Salt Air so we all can
  31. ;  learn and use the new versions...
  32. ;
  33. ;
  34. ;                     Best wishes: Peter Laur / Murphys PCBoard BBS, Sweden
  35. ;                                                   (2:204/481@fidonet)
  36. ;
  37. ;          (Compiled with PPLC by Ulf Svanlund at Oasen PCBoard BBS)
  38. ;──────────────────────────────────────────────────────────────────────────────
  39. ;▒▒▒▒▒ SET ALL VARIABLES ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  40. ;──────────────────────────────────────────────────────────────────────────────
  41. string pin
  42. string pin2
  43. string test
  44. string test2
  45. string anytext
  46. string secerr_str
  47. string pwderr_str
  48. integer i
  49. integer pos
  50. integer logons
  51. integer secerr
  52. integer pwderr
  53. integer number
  54. integer maxtries
  55. integer sec_limit
  56. integer pwd_limit
  57. integer log_limit
  58. integer old_secerr
  59. integer old_pwderr
  60.  
  61. let maxtries=2           ; Max 3 answer attempts at the PIN questions
  62. anytext = " 1234567890"
  63. ;──────────────────────────────────────────────────────────────────────────────
  64. ;▒▒▒▒▒ SET SECURITY, PASSWORD AND LOGON LIMITS ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  65. ;──────────────────────────────────────────────────────────────────────────────
  66. sec_limit=10             ; Every 10'th Security Violation starts PIN
  67. pwd_limit=5              ; Every 5'th Password Failure starts PIN
  68. log_limit=50             ; Every 50'th Logon from the user starts PIN
  69.  
  70. ;──────────────────────────────────────────────────────────────────────────────
  71. ;▒▒▒▒▒ GET USERINFO ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  72. ;──────────────────────────────────────────────────────────────────────────────
  73. getuser
  74. secerr=u_stat(10)
  75. pwderr=u_stat(14)
  76.  
  77. ;──────────────────────────────────────────────────────────────────────────────
  78. ;▒▒▒▒▒ READ OLD VALUES FROM NOTES LINE 5 ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  79. ;──────────────────────────────────────────────────────────────────────────────
  80. pos = instr(U_NOTES(4), "|")
  81. if (pos = 0) then
  82.     secerr_str = string(secerr)
  83.     pwderr_str = string(pwderr)
  84.     u_notes(4) = secerr_str + "|" + pwderr_str
  85.     putuser
  86. endif
  87. if (strip(u_ver," ")="") goto newuser
  88. old_secerr = mid(U_NOTES(4), 1, pos - 1)
  89. old_pwderr = mid(U_NOTES(4), pos + 1, 10)
  90.  
  91. ;──────────────────────────────────────────────────────────────────────────────
  92. ;▒▒▒▒▒ COMPARE OLD/NEW VALUES AND TAKE ACTION ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  93. ;──────────────────────────────────────────────────────────────────────────────
  94. if (secerr - old_secerr => sec_limit) goto verify
  95. if (pwderr - old_pwderr => pwd_limit) goto verify
  96.  
  97. ;──────────────────────────────────────────────────────────────────────────────
  98. ;▒▒▒▒▒ CHECK THE USER REGULARLY ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  99. ;──────────────────────────────────────────────────────────────────────────────
  100. let logons=u_logons() / log_limit
  101. if (u_logons() - logons * log_limit = 0) goto verify
  102. goto end
  103.  
  104. ;──────────────────────────────────────────────────────────────────────────────
  105. ;▒▒▒▒▒ NEWUSER ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  106. ;──────────────────────────────────────────────────────────────────────────────
  107. :newuser
  108. dispfile "c:\pcb\ppe\pin\newuser",graph
  109. newline
  110. inputstr "Please enter your Personal Identification Number PIN: ",pin,@X0E,4,anytext,echodots
  111. if (pin="1234") goto nice_try
  112. if (pin="4321") goto nice_try
  113. if (pin="1000") goto nice_try
  114. if (pin="1111") goto nice_try
  115. if (pin="2000") goto nice_try
  116. if (pin="2222") goto nice_try
  117. if (pin="3000") goto nice_try
  118. if (pin="3333") goto nice_try
  119. if (pin="4000") goto nice_try
  120. if (pin="4444") goto nice_try
  121. if (pin="5000") goto nice_try
  122. if (pin="5555") goto nice_try
  123. if (pin="6000") goto nice_try
  124. if (pin="6666") goto nice_try
  125. if (pin="7000") goto nice_try
  126. if (pin="7777") goto nice_try
  127. if (pin="8000") goto nice_try
  128. if (pin="8888") goto nice_try
  129. if (pin="9000") goto nice_try
  130. if (pin="9999") goto nice_try
  131. if (pin="0000") goto nice_try
  132. if (len(pin) <> 4) goto nice_try
  133. goto check
  134.  
  135. ;──────────────────────────────────────────────────────────────────────────────
  136. ;▒▒▒▒▒ CHECK ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  137. ;──────────────────────────────────────────────────────────────────────────────
  138. :check
  139. newline
  140. newline
  141. inputstr "Please re-enter your PIN again to compare: ",pin2,@X0E,4,anytext,echodots
  142. println "@CLS@@X0E"
  143. if (pin=pin2) then
  144.   goto finish
  145. else
  146.   goto wrong
  147. endif
  148.  
  149. ;──────────────────────────────────────────────────────────────────────────────
  150. ;▒▒▒▒▒ NICE TRY! ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  151. ;──────────────────────────────────────────────────────────────────────────────
  152. :nice_try
  153. newline
  154. dispfile "c:\pcb\ppe\pin\nicetry",graph
  155. goto newuser
  156.  
  157. ;──────────────────────────────────────────────────────────────────────────────
  158. ;▒▒▒▒▒ WRONG ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  159. ;──────────────────────────────────────────────────────────────────────────────
  160. :wrong
  161. newline
  162. println "@CLS@@X00@X0CThe PIN entered do not match!@XFF"
  163. goto newuser
  164.  
  165. ;──────────────────────────────────────────────────────────────────────────────
  166. ;▒▒▒▒▒ FINISHED ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  167. ;──────────────────────────────────────────────────────────────────────────────
  168. :finish
  169. dispfile "c:\pcb\pin\ppe\pinwarn",graph
  170. let u_ver=pin
  171. putuser
  172. goto end
  173.  
  174. ;──────────────────────────────────────────────────────────────────────────────
  175. ;▒▒▒▒▒ VERIFY ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  176. ;──────────────────────────────────────────────────────────────────────────────
  177. :verify
  178. newline
  179. inputstr "Please enter your Personal Identification Number PIN: ",test,@X0E,4,anytext,echodots
  180.  
  181. if (test=u_ver) then
  182.  
  183.       if (secerr - old_secerr => sec_limit) then
  184.          secerr_str = string(secerr)
  185.       else
  186.          secerr_str = string(old_secerr)
  187.       endif
  188.   
  189.       if (pwderr - old_pwderr => pwd_limit) then
  190.          pwderr_str = string(pwderr)
  191.       else
  192.          pwderr_str = string(old_pwderr)
  193.       endif
  194.  
  195.   u_notes(4) = secerr_str + "|" + pwderr_str
  196.   putuser
  197.   goto end
  198. else
  199.   log "Invalid PIN entered ("+test+")",false
  200.   goto screwed_up
  201. endif
  202.  
  203. ;──────────────────────────────────────────────────────────────────────────────
  204. ;▒▒▒▒▒ SCREWED UP ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  205. ;──────────────────────────────────────────────────────────────────────────────
  206. :screwed_up
  207. newline
  208. println "@X00@X0CThe PIN you have entered is incorrect!@XFF"
  209. newline
  210. inputstr "Please re-enter your PIN: ",test2,@X0E,4,anytext,echodots
  211. if ((test2 <> u_ver) & (maxtries > 1)) then
  212.   log "Invalid PIN entered ("+test2+")",false
  213.   dec maxtries
  214.   goto screwed_up
  215. else if (test2=u_ver)
  216.   goto end
  217. endif
  218.  
  219. message 0,"SYSOP",u_name(),"Invalid PIN","R",0,false,false,"c:\pcb\ppe\pin\sysmsg"
  220. log "Invalid PIN entered ("+test2+")",false
  221. log "4 Invalid PIN attempts - Automatic Disconnect",false
  222. dispfile "c:\pcb\ppe\pin\hangup",graph
  223. let u_sec = 8
  224. putuser
  225. delay 200
  226. hangup
  227. end
  228.  
  229. ;──────────────────────────────────────────────────────────────────────────────
  230. ;▒▒▒▒▒ END ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
  231. ;──────────────────────────────────────────────────────────────────────────────
  232. :end
  233. end
  234.