Add scripts
This commit is contained in:
		
							parent
							
								
									0a85d80ebc
								
							
						
					
					
						commit
						60b23d05f5
					
				
							
								
								
									
										11
									
								
								app/scripts/googly.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								app/scripts/googly.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,11 @@
 | 
				
			|||||||
 | 
					import  json
 | 
				
			||||||
 | 
					import  requests
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def recaptcha(captcha, secret):
 | 
				
			||||||
 | 
					    url     = "https://www.google.com/recaptcha/api/siteverify"
 | 
				
			||||||
 | 
					    myobj   = {
 | 
				
			||||||
 | 
					        "secret"    : secret,
 | 
				
			||||||
 | 
					        "response"  : captcha
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    response = json.loads(requests.post(url, data = myobj).text)
 | 
				
			||||||
 | 
					    return response
 | 
				
			||||||
							
								
								
									
										13
									
								
								app/scripts/loggorilla.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								app/scripts/loggorilla.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,13 @@
 | 
				
			|||||||
 | 
					import datetime
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def prcss(loc, msg):
 | 
				
			||||||
 | 
					    print(f"[loggorilla][{datetime.datetime.now()}][\033[32mprcss\033[39m][\033[95m{loc}\033[39m] {msg}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def accss(loc, msg):
 | 
				
			||||||
 | 
					    print(f"[loggorilla][{datetime.datetime.now()}][\033[36maccss\033[39m][\033[95m{loc}\033[39m] {msg}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def fyinf(loc, msg):
 | 
				
			||||||
 | 
					    print(f"[loggorilla][{datetime.datetime.now()}][\033[93mfyinf\033[39m][\033[95m{loc}\033[39m] {msg}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def error(loc, msg):
 | 
				
			||||||
 | 
					    print(f"[loggorilla][{datetime.datetime.now()}][\033[31merror\033[39m][\033[95m{loc}\033[39m] {msg}")
 | 
				
			||||||
							
								
								
									
										5
									
								
								app/scripts/saltedkey.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								app/scripts/saltedkey.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					import  bcrypt
 | 
				
			||||||
 | 
					import  hashlib
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def token(username, hashed):
 | 
				
			||||||
 | 
					    return hashlib.sha1( (username+username[:3]+hashed[-6:]).encode() ).hexdigest()
 | 
				
			||||||
							
								
								
									
										23
									
								
								app/scripts/sendwave.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								app/scripts/sendwave.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,23 @@
 | 
				
			|||||||
 | 
					from    email.mime.multipart    import MIMEMultipart
 | 
				
			||||||
 | 
					from    email.mime.text         import MIMEText
 | 
				
			||||||
 | 
					import  smtplib
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def smtp(config):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    msg = MIMEMultipart('alternative')
 | 
				
			||||||
 | 
					    msg['Subject'   ] = config['subject'    ]
 | 
				
			||||||
 | 
					    msg['From'      ] = config['from'       ]
 | 
				
			||||||
 | 
					    msg['To'        ] = config['to'         ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    part1 = MIMEText(config['text'], 'plain')
 | 
				
			||||||
 | 
					    part2 = MIMEText(config['html'], 'html' )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    msg.attach(part1)
 | 
				
			||||||
 | 
					    msg.attach(part2)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    smtp_server = smtplib.SMTP(config['server']['host'], config['server']['port'])
 | 
				
			||||||
 | 
					    smtp_server.ehlo()
 | 
				
			||||||
 | 
					    smtp_server.starttls()
 | 
				
			||||||
 | 
					    smtp_server.login( config['login']['email'], config['login']['password'] )
 | 
				
			||||||
 | 
					    smtp_server.sendmail('&&&&&&', config['to'], msg.as_string() )
 | 
				
			||||||
 | 
					    smtp_server.quit()
 | 
				
			||||||
							
								
								
									
										23
									
								
								app/scripts/tokenguard.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								app/scripts/tokenguard.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,23 @@
 | 
				
			|||||||
 | 
					from cryptography.hazmat.primitives import serialization
 | 
				
			||||||
 | 
					import jwt
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def encode(payload, id_rsa, passphrase):
 | 
				
			||||||
 | 
					    private_key = open(id_rsa, 'r').read()
 | 
				
			||||||
 | 
					    key         = serialization.load_ssh_private_key(private_key.encode(), password=passphrase)
 | 
				
			||||||
 | 
					    token       = jwt.encode(
 | 
				
			||||||
 | 
					        payload     = payload,
 | 
				
			||||||
 | 
					        key         = key,
 | 
				
			||||||
 | 
					        algorithm   = 'RS256'
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					    return token
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def decode(token, id_rsa):
 | 
				
			||||||
 | 
					    public_key  = open(id_rsa, 'r').read()
 | 
				
			||||||
 | 
					    key         = serialization.load_ssh_public_key(public_key.encode())
 | 
				
			||||||
 | 
					    header      = jwt.get_unverified_header(token)
 | 
				
			||||||
 | 
					    payload     = jwt.decode(
 | 
				
			||||||
 | 
					        jwt         = token,
 | 
				
			||||||
 | 
					        key         = key,
 | 
				
			||||||
 | 
					        algorithms  = [header['alg'], ]
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					    return payload
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user