Skip to content

Instantly share code, notes, and snippets.

@andr-04 andr-04/
Created Sep 21, 2018

What would you like to do?
Replace passwords in Yate
#!/usr/bin/env python
import asyncore
from libyate import Yate
def replace_passwords(params):
passwords = {
# 'user': 'pass'
user_n, pass_n = None, None
for n, pair in enumerate(params):
if pair[0] == 'username':
user_n = n
elif pair[0] == 'password':
pass_n = n
if user_n is not None and pass_n is not None:
username = params[user_n][1].lower()
if username in passwords:
params[pass_n][1] = passwords[username]
class YateApp:
def __init__(self): = Yate() = self.retenv = True # due to bug in
def retenv(self, d):
if d == "incoming":
def main(self):"user.login")
if __name__ == '__main__':
a = YateApp()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.