Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import math
- import random
- Big_S=list('QWERTYUIOPASDFGHJKLZXCVBNM')
- Low_S=list('qwertyuiopasdfghjklzxcvbnm')
- Num_S=list('1234567890')
- lb=3
- ll=3
- ln=3
- Pass=""
- PassA=""
- m = ['6001','6002','6003','6004']
- h = ['6005','6006','6007','6008','6009']
- vh = ['6000', '7000', '8000','9000']
- za = ['9260', '9261', '9262', '9263']
- def Big():
- for i in range(lb):
- global Pass
- Pass=""
- n=random.randrange(len(Big_S))
- Pass=Pass+Big_S[n]
- return Pass
- def Low():
- for i in range(ll):
- global Pass
- n=random.randrange(len(Low_S))
- Pass=Pass+Low_S[n]
- return Pass
- def Num():
- for i in range(ln):
- global Pass
- n=random.randrange(len(Num_S))
- Pass=Pass+Num_S[n]
- return Pass
- def All():
- global PassA
- PassA = ""
- if lb>0:
- PassA=Big()
- if ll>0:
- PassA=Low()
- if ln>0:
- PassA=Num()
- PassR=list(PassA)
- random.shuffle(PassR)
- PassEnd=""
- for i in range(len(PassR)):
- PassEnd=PassEnd+PassR[i]
- return PassEnd
- def writeUsers(i,b,hou,roo):
- o = 0;
- for it in vh:
- if it == str(i):
- i=za[o];
- o+=1;
- global f
- global f1
- global f2
- global m
- global h
- print("Executing: " + str(i) + "/" + str(b))
- Passwd = All();
- Dlpn = "DLPN_ua_user"
- for mains in m:
- if mains == str(i):
- Dlpn = "DLPN_ua_main"
- for mains in h:
- if mains == str(i):
- Dlpn = "DLPN_ua_house"
- if len(str(i)) < 3:
- f1.write(str(i)+"\t\t\t"+Passwd+"\t\t"+Dlpn+"\t"+str(hou)+"\t\t"+str(roo)+"\n");
- else:
- f1.write(str(i)+"\t\t"+Passwd+"\t\t"+Dlpn+"\t"+str(hou)+"\t\t"+str(roo)+"\n");
- l = ['['+ str(i)+']', 'fullname = '+ str(i), 'registersip = no', 'host = dynamic', 'callgroup = 1', 'mailbox = '+ str(i),
- 'call-limit = 100', 'type = peer', 'username = '+ str(i), 'transfer = yes', 'callcounter = yes', 'context = '+Dlpn,
- 'cid_number = '+ str(i), 'hasvoicemail = no', 'vmsecret = ', 'email =', 'threewaycalling = no', 'hasdirectory = no',
- 'callwaiting = no', 'hasmanager = no', 'hasagent = no', 'hassip = yes', 'hasiax = no', 'secret = ' +Passwd, 'nat = force_rport,comedia',
- 'canreinvite = no', 'directmedia = no', 'dtmfmode = info', 'insecure = no', 'pickupgroup = 1', 'macaddress = '+ str(i),
- 'autoprov = yes', 'label = '+str(i), 'LINEKEYS = 1', '', '', 'linenumber = ', 'disallow = all', 'allow = ulaw,h264,alaw,h263,g722']
- for item in l:
- f.write(item+"\n")
- nuls = "";
- nuls = "";
- if roo < 10:
- nuls = "00";
- if roo > 9:
- nuls = "0";
- if roo > 99:
- nuls = "";
- if (roo !=0):
- f2.write("exten = "+str(hou)+nuls+str(roo)+",1,Goto(ringroups-custom-"+str(hou)+nuls+str(roo)+",s,1)\n");
- f = open('out_users.conf','w')
- f1 = open('out_secrets.text','w')
- f2 = open('out_extention.conf','w')
- f1.write("Username:\tPassword:\tRole:\t\t\tHouse:\tRoom:\n");
- #panels main 1 - 4
- for i in range(1, 5):
- writeUsers("600"+str(i),6005,0,0)
- #panels house 5 - 9
- for i in range(5, 9):
- writeUsers("600"+str(i),6010,i-4,0)
- f2.write("[ringgroups]\n");
- #links
- for j in range(0, 298):
- writeUsers(str(6010+j),6306,str(1),j+1)
- for j in range(0, 360):
- writeUsers(str(7001+j),7360,str(2),j+1)
- for j in range(0, 192):
- writeUsers(str(8001+j),8192,str(3),j+1)
- for j in range(0, 156):
- writeUsers(str(9001+j),9156,str(4),j+1)
- #groups
- for j in range(0, 298):
- nuls = "";
- if j+1 < 10:
- nuls = "00";
- if j+1 > 9:
- nuls = "0";
- if j+1 > 99:
- nuls = "";
- f2.write("\n[ringroups-custom-"+str(1)+nuls+str(j+1)+"]\n")
- f2.write("exten = s,1,NoOp(House"+str(1)+"_Room"+str(j+1)+")\n")
- mess = "exten = s,1,Dial(SIP/" + str(6010+j) + ",35,${DIALOPTIONS}i)\n"
- f2.write(mess);
- f2.write("exten = s,1,Hangup\n");
- for j in range(0, 360):
- nuls = "";
- if j+1 < 10:
- nuls = "00";
- if j+1 > 9:
- nuls = "0";
- if j+1 > 99:
- nuls = "";
- f2.write("\n[ringroups-custom-"+str(2)+nuls+str(j+1)+"]\n")
- f2.write("exten = s,1,NoOp(House"+str(2)+"_Room"+str(j+1)+")\n")
- mess = "exten = s,1,Dial(SIP/" + str(7001+j) + ",35,${DIALOPTIONS}i)\n"
- f2.write(mess);
- f2.write("exten = s,1,Hangup\n");
- for j in range(0, 192):
- nuls = "";
- if j+1 < 10:
- nuls = "00";
- if j+1 > 9:
- nuls = "0";
- if j+1 > 99:
- nuls = "";
- f2.write("\n[ringroups-custom-"+str(3)+nuls+str(j+1)+"]\n")
- f2.write("exten = s,1,NoOp(House"+str(3)+"_Room"+str(j+1)+")\n")
- mess = "exten = s,1,Dial(SIP/" + str(8001+j) + ",35,${DIALOPTIONS}i)\n"
- f2.write(mess);
- f2.write("exten = s,1,Hangup\n");
- for j in range(0, 156):
- nuls = "";
- if j+1 < 10:
- nuls = "00";
- if j+1 > 9:
- nuls = "0";
- if j+1 > 99:
- nuls = "";
- f2.write("\n[ringroups-custom-"+str(4)+nuls+str(j+1)+"]\n")
- f2.write("exten = s,1,NoOp(House"+str(4)+"_Room"+str(j+1)+")\n")
- mess = "exten = s,1,Dial(SIP/" + str(9001+j) + ",35,${DIALOPTIONS}i)\n"
- f2.write(mess);
- f2.write("exten = s,1,Hangup\n");
- f2.close();
- f1.close();
- f.close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement