Advertisement
Guest User

Untitled

a guest
Feb 18th, 2017
2,054
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.17 KB | None | 0 0
  1. # Nz2 for Antichat
  2.  
  3. login = 'admin'
  4. password = 'admin'
  5. file = open('IPs.txt','r')
  6. xml = open('ip_out.xml','w')
  7. def main():
  8.     start_file='''<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
  9. <Organization groups="2" grade="1" modifiedTime="0">
  10.    <Department coding="001" encode="" id="0" name="root" type="0">
  11.    '''
  12.     end_file='''
  13.        </Department>
  14. </Organization>'''
  15.     k = 1001
  16.     xml.write(start_file)
  17.  
  18.     for string in file.readlines():
  19.         line = string.rstrip('\n')
  20.  
  21.         temp = '<Device id="'+str(k)+'" title="'+line+'" desc="" ip="'+line+'" port="37777" manufacturer="" type="1" model="" user="'+login+'" password="'+password+'" p2pServerIp="" p2pServerPort="0" p2pServerKey="" p2pDevUuid="" p2pRemotePort="0" logintype="0" cardsn="" rights="" alertout="0" status="1" m_ChannelCount="" VideoOutCount="" AlarmInCount="0" AlarmOutCount="0" SerialNum="" subType="1" ProtocolType="0" RtspPort="0" AutoLogin="1">\n            </Device>'
  22.         xml.write(temp)
  23.         k += 1
  24.     xml.write(end_file)
  25.     xml.close()
  26.     file.close()
  27.     print('Файл готов импортируйте в Smart Pss')
  28. if __name__ == '__main__':
  29.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement