mirror of
				https://github.com/jlu5/PyLink.git
				synced 2025-11-04 00:47:21 +01:00 
			
		
		
		
	Add command line mkpasswd utility & encrypted password example
This commit is contained in:
		
							parent
							
								
									b1e4b34b79
								
							
						
					
					
						commit
						c4351d61c6
					
				@ -49,9 +49,13 @@ login:
 | 
			
		||||
    accounts:
 | 
			
		||||
        # Creates an account with username "user1".
 | 
			
		||||
        user1:
 | 
			
		||||
            # Defines the password for the user.
 | 
			
		||||
            password: "somestring"
 | 
			
		||||
            # Defines the password for the user. You can encrypt passwords using the
 | 
			
		||||
            # 'mkpasswd' command or the 'pylink-mkpasswd' utility included with PyLink.
 | 
			
		||||
            password: "$6$rounds=617998$BwHhwX4wB5R0H9uw$Lyo.4icYjVSnSCDsjNIO5Ap5LAcyqLspBcUqVR0qlIB9o6vKU.WyrttHZum4dVW35cuc2wGP2SKa5Bv/svdiv1"
 | 
			
		||||
 | 
			
		||||
            # Determines whether the password given is in plain-text. Defaults to false
 | 
			
		||||
            # (plain text) for backwards compatibility.
 | 
			
		||||
            encrypted: true
 | 
			
		||||
 | 
			
		||||
servers:
 | 
			
		||||
    # Please note: these are only EXAMPLE link blocks. You should edit them and
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										17
									
								
								pylink-mkpasswd
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										17
									
								
								pylink-mkpasswd
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,17 @@
 | 
			
		||||
#!/usr/bin/env python3
 | 
			
		||||
"""
 | 
			
		||||
Password hashing utility for PyLink IRC Services.
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
import passlib
 | 
			
		||||
from passlib.apps import custom_app_context as pwd_context
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
    import argparse
 | 
			
		||||
 | 
			
		||||
    parser = argparse.ArgumentParser(description='Hashes a password for use with PyLink IRC Services.')
 | 
			
		||||
    parser.add_argument('password', help='specifies the password to hash')
 | 
			
		||||
    args = parser.parse_args()
 | 
			
		||||
 | 
			
		||||
    assert args.password, "Password cannot be empty!"
 | 
			
		||||
    print(pwd_context.encrypt(args.password))
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user