Guest User

Untitled

a guest
Jul 19th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.19 KB | None | 0 0
  1. def dumps(self, ip, port, username):
  2.  
  3.         # returns bytes which represent the data
  4.  
  5.         #print (self.fbit,' ', type(self.fbit).__name__)
  6.  
  7.         #db_path = realpath('iaxdb.db')
  8.  
  9.         conn = sqlite3.connect('/usr/local/src/dionaea/modules/python/scripts/iax/iaxdb.db')
  10.  
  11.         print(conn)
  12.  
  13.         c = conn.cursor()
  14.  
  15.         print(c)
  16.  
  17.         if (self.dst_call_no == 0):
  18.  
  19.             a = (struct.pack('>2HI2H', self.fbit << 15 | generate_rand_src(), self.rbit << 15 | self.src_call_no, self.timestamp+1, self.o_seq_no << 8 |self.i_seq_no+1, self.frame_type << 8 | 14))
  20.  
  21.         else:
  22.  
  23.             a = (struct.pack('>2HI2H', self.fbit << 15 | self.dst_call_no, self.rbit << 15 | self.src_call_no, self.timestamp+1, self.o_seq_no << 8 |self.i_seq_no+1, self.frame_type << 8 | 14))
  24.  
  25.         a += self.packs(14, 2, 3)
  26.  
  27.         rand = str(generate_rand9())
  28.  
  29.         username = str(username, 'utf-8')
  30.  
  31.         #query = 'update credentials set salt={:s} where username={:s}'.format(rand,username)
  32.  
  33.         query = 'create table randomname(one char(5), two char(5))'
  34.  
  35.         result = conn.execute(query)
  36.  
  37.         print(result)
  38.  
  39.         conn.commit()
  40.  
  41.         c.close()
  42.  
  43.         a += self.packs(15, 9, rand)
  44.  
  45.         a += self.packs(6, len(str(username, 'utf-8')), str(username, 'utf-8'))    
  46.  
  47.         return a
Add Comment
Please, Sign In to add comment