modifié: m/fichier/conf

modifié:         m/loadConf.py
	modifié:         m/log.py
	modifié:         m/login.py
	modifié:         superTornado.py
	nouveau fichier: test/AllowTest
	nouveau fichier: test/ConfTest
	nouveau fichier: test/MiEmulator.py
	nouveau fichier: test/a
	nouveau fichier: test/botTest.py
	nouveau fichier: test/mfp.cookies
	nouveau fichier: test/testFichier.py
	nouveau fichier: test/testMISignaux.py
	modifié:         v/illegal.html
	modifié:         v/index.html
This commit is contained in:
sidya82 2014-03-30 22:11:36 +02:00
parent 160ab41dfe
commit 73a1d1e3e4
18 changed files with 2876 additions and 74 deletions

1769
log/activity.log Normal file

File diff suppressed because it is too large Load Diff

444
log/error.log Normal file
View File

@ -0,0 +1,444 @@
2014-03-30 14:32:54,209 :: ERROR :: ->WARNING : Camera Unreachable! Check Camera Configuration!
2014-03-30 14:32:54,210 :: ERROR :: Server Start Failed !
2014-03-30 14:33:04,042 :: ERROR :: ->WARNING : Camera Unreachable! Check Camera Configuration!
2014-03-30 15:21:06,988 :: ERROR :: ->WARNING : Camera Unreachable! Check Camera Configuration!
2014-03-30 17:06:08,864 :: ERROR :: ->WARNING : Camera Unreachable! Check Camera Configuration!
2014-03-30 17:06:18,790 :: ERROR :: Uncaught exception in /socket
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 322, in wrapper
return callback(*args, **kwargs)
File "superTornado.py", line 167, in open
self.send_signal_house('maison.request("GET", "/micom/say.php?source=toto&text=Connection%20a%20la%20camera%20autorisee")')
File "superTornado.py", line 219, in send_signal_house
GlobalVars.log.printL('maison = httplib.HTTPConnection("'+GlobalVars.iptDomo+'",'+ GlobalVars.portDomo+')',lvl.DEBUG)
AttributeError: class GlobalVars has no attribute 'iptDomo'
2014-03-30 17:06:18,862 :: ERROR :: Uncaught exception, closing connection.
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tornado/iostream.py", line 354, in wrapper
callback(*args)
File "/usr/lib/python2.7/site-packages/tornado/stack_context.py", line 331, in wrapped
raise_exc_info(exc)
File "/usr/lib/python2.7/site-packages/tornado/stack_context.py", line 302, in wrapped
ret = fn(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/tornado/httpserver.py", line 218, in _on_connection_close
callback()
File "/usr/lib/python2.7/site-packages/tornado/stack_context.py", line 331, in wrapped
raise_exc_info(exc)
File "/usr/lib/python2.7/site-packages/tornado/stack_context.py", line 302, in wrapped
ret = fn(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 293, in on_connection_close
self.on_close()
File "superTornado.py", line 209, in on_close
self.send_signal_house('maison.request("GET", "/micom/say.php?source=toto&text=Connection%20a%20la%20camera%20rompue")')
File "superTornado.py", line 219, in send_signal_house
GlobalVars.log.printL('maison = httplib.HTTPConnection("'+GlobalVars.iptDomo+'",'+ GlobalVars.portDomo+')',lvl.DEBUG)
AttributeError: class GlobalVars has no attribute 'iptDomo'
2014-03-30 17:06:18,922 :: ERROR :: Exception in callback <functools.partial object at 0x2606788>
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tornado/ioloop.py", line 477, in _run_callback
callback()
File "/usr/lib/python2.7/site-packages/tornado/stack_context.py", line 331, in wrapped
raise_exc_info(exc)
File "/usr/lib/python2.7/site-packages/tornado/stack_context.py", line 302, in wrapped
ret = fn(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/tornado/iostream.py", line 354, in wrapper
callback(*args)
File "/usr/lib/python2.7/site-packages/tornado/stack_context.py", line 331, in wrapped
raise_exc_info(exc)
File "/usr/lib/python2.7/site-packages/tornado/stack_context.py", line 302, in wrapped
ret = fn(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/tornado/httpserver.py", line 218, in _on_connection_close
callback()
File "/usr/lib/python2.7/site-packages/tornado/stack_context.py", line 331, in wrapped
raise_exc_info(exc)
File "/usr/lib/python2.7/site-packages/tornado/stack_context.py", line 302, in wrapped
ret = fn(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 293, in on_connection_close
self.on_close()
File "superTornado.py", line 209, in on_close
self.send_signal_house('maison.request("GET", "/micom/say.php?source=toto&text=Connection%20a%20la%20camera%20rompue")')
File "superTornado.py", line 219, in send_signal_house
GlobalVars.log.printL('maison = httplib.HTTPConnection("'+GlobalVars.iptDomo+'",'+ GlobalVars.portDomo+')',lvl.DEBUG)
AttributeError: class GlobalVars has no attribute 'iptDomo'
2014-03-30 17:07:27,874 :: ERROR :: ->WARNING : Camera Unreachable! Check Camera Configuration!
2014-03-30 17:07:38,578 :: ERROR :: Uncaught exception in /socket
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 322, in wrapper
return callback(*args, **kwargs)
File "superTornado.py", line 182, in open
self.send_image()
File "superTornado.py", line 242, in send_image
GlobalVars.log.printL(e,lvl.FAIL)
File "/home/sidya/Documents/iut/ptut/m/log.py", line 96, in printL
pMsg = bcolors.FAIL + pMsg + bcolors.ENDC
TypeError: cannot concatenate 'str' and 'exceptions.IOError' objects
2014-03-30 17:09:23,728 :: ERROR :: ->WARNING : Camera Unreachable! Check Camera Configuration!
2014-03-30 17:09:34,694 :: ERROR :: Uncaught exception in /socket
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 322, in wrapper
return callback(*args, **kwargs)
File "superTornado.py", line 182, in open
self.send_image()
File "superTornado.py", line 242, in send_image
GlobalVars.log.printL(e,lvl.FAIL)
File "/home/sidya/Documents/iut/ptut/m/log.py", line 96, in printL
pMsg = bcolors.FAIL + pMsg + bcolors.ENDC
TypeError: cannot concatenate 'str' and 'exceptions.IOError' objects
2014-03-30 17:12:01,751 :: ERROR :: ->WARNING : Camera Unreachable! Check Camera Configuration!
2014-03-30 17:12:13,861 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 17:12:16,871 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 17:12:19,881 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 17:12:22,891 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 17:12:25,901 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 17:12:28,911 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 17:12:31,921 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 17:15:30,298 :: ERROR :: ->WARNING : Camera Unreachable! Check Camera Configuration!
2014-03-30 18:02:32,924 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 18:02:32,924 :: ERROR :: Uncaught exception in /socket
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 322, in wrapper
return callback(*args, **kwargs)
File "superTornado.py", line 190, in on_message
self.send_image()
File "superTornado.py", line 243, in send_image
self.write_message("error")
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 178, in write_message
raise WebSocketClosedError()
WebSocketClosedError
2014-03-30 18:57:08,187 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 18:57:11,197 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 18:57:14,208 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 18:57:17,217 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 18:57:20,227 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 18:57:23,237 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 18:57:26,247 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 18:57:29,257 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 18:57:32,267 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 18:57:35,277 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 18:57:38,287 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 18:57:41,297 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 18:57:44,307 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 18:57:47,317 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 18:57:50,327 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 18:57:53,337 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 18:57:56,347 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 18:57:59,357 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 18:58:02,367 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 18:58:05,377 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 18:58:08,387 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 18:58:11,397 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 18:58:14,407 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 18:58:17,417 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 18:58:20,427 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 18:58:23,437 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 18:58:26,447 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 18:58:29,457 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 18:58:32,467 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 18:58:35,477 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 18:58:38,487 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 19:02:23,510 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 19:02:23,511 :: ERROR :: Uncaught exception in /socket
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 322, in wrapper
return callback(*args, **kwargs)
File "superTornado.py", line 190, in on_message
self.send_image()
File "superTornado.py", line 243, in send_image
self.write_message("error")
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 178, in write_message
raise WebSocketClosedError()
WebSocketClosedError
2014-03-30 19:08:41,704 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 19:08:41,704 :: ERROR :: Uncaught exception in /socket
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 322, in wrapper
return callback(*args, **kwargs)
File "superTornado.py", line 190, in on_message
self.send_image()
File "superTornado.py", line 243, in send_image
self.write_message("error")
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 178, in write_message
raise WebSocketClosedError()
WebSocketClosedError
2014-03-30 19:09:27,890 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 19:09:27,891 :: ERROR :: Uncaught exception in /socket
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 322, in wrapper
return callback(*args, **kwargs)
File "superTornado.py", line 190, in on_message
self.send_image()
File "superTornado.py", line 243, in send_image
self.write_message("error")
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 178, in write_message
raise WebSocketClosedError()
WebSocketClosedError
2014-03-30 19:12:34,657 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 19:12:34,657 :: ERROR :: Uncaught exception in /socket
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 322, in wrapper
return callback(*args, **kwargs)
File "superTornado.py", line 190, in on_message
self.send_image()
File "superTornado.py", line 243, in send_image
self.write_message("error")
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 178, in write_message
raise WebSocketClosedError()
WebSocketClosedError
2014-03-30 19:12:37,667 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 19:12:37,667 :: ERROR :: Uncaught exception in /socket
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 322, in wrapper
return callback(*args, **kwargs)
File "superTornado.py", line 190, in on_message
self.send_image()
File "superTornado.py", line 243, in send_image
self.write_message("error")
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 178, in write_message
raise WebSocketClosedError()
WebSocketClosedError
2014-03-30 19:22:29,177 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 19:22:29,177 :: ERROR :: Uncaught exception in /socket
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 322, in wrapper
return callback(*args, **kwargs)
File "superTornado.py", line 190, in on_message
self.send_image()
File "superTornado.py", line 243, in send_image
self.write_message("error")
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 178, in write_message
raise WebSocketClosedError()
WebSocketClosedError
2014-03-30 19:22:45,317 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 19:22:45,317 :: ERROR :: Uncaught exception in /socket
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 322, in wrapper
return callback(*args, **kwargs)
File "superTornado.py", line 190, in on_message
self.send_image()
File "superTornado.py", line 243, in send_image
self.write_message("error")
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 178, in write_message
raise WebSocketClosedError()
WebSocketClosedError
2014-03-30 19:25:41,673 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 19:25:41,674 :: ERROR :: Uncaught exception in /socket
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 322, in wrapper
return callback(*args, **kwargs)
File "superTornado.py", line 190, in on_message
self.send_image()
File "superTornado.py", line 243, in send_image
self.write_message("error")
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 178, in write_message
raise WebSocketClosedError()
WebSocketClosedError
2014-03-30 19:26:46,773 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 19:26:46,774 :: ERROR :: Uncaught exception in /socket
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 322, in wrapper
return callback(*args, **kwargs)
File "superTornado.py", line 190, in on_message
self.send_image()
File "superTornado.py", line 243, in send_image
self.write_message("error")
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 178, in write_message
raise WebSocketClosedError()
WebSocketClosedError
2014-03-30 19:28:25,120 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 19:28:25,120 :: ERROR :: Uncaught exception in /socket
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 322, in wrapper
return callback(*args, **kwargs)
File "superTornado.py", line 190, in on_message
self.send_image()
File "superTornado.py", line 243, in send_image
self.write_message("error")
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 178, in write_message
raise WebSocketClosedError()
WebSocketClosedError
2014-03-30 19:30:30,997 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 19:30:30,997 :: ERROR :: Uncaught exception in /socket
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 322, in wrapper
return callback(*args, **kwargs)
File "superTornado.py", line 190, in on_message
self.send_image()
File "superTornado.py", line 243, in send_image
self.write_message("error")
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 178, in write_message
raise WebSocketClosedError()
WebSocketClosedError
2014-03-30 19:38:25,513 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 19:38:25,514 :: ERROR :: Uncaught exception in /socket
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 322, in wrapper
return callback(*args, **kwargs)
File "superTornado.py", line 190, in on_message
self.send_image()
File "superTornado.py", line 243, in send_image
self.write_message("error")
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 178, in write_message
raise WebSocketClosedError()
WebSocketClosedError
2014-03-30 19:39:04,793 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 19:39:04,794 :: ERROR :: Uncaught exception in /socket
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 322, in wrapper
return callback(*args, **kwargs)
File "superTornado.py", line 190, in on_message
self.send_image()
File "superTornado.py", line 243, in send_image
self.write_message("error")
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 178, in write_message
raise WebSocketClosedError()
WebSocketClosedError
2014-03-30 19:39:41,963 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 19:39:41,964 :: ERROR :: Uncaught exception in /socket
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 322, in wrapper
return callback(*args, **kwargs)
File "superTornado.py", line 190, in on_message
self.send_image()
File "superTornado.py", line 243, in send_image
self.write_message("error")
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 178, in write_message
raise WebSocketClosedError()
WebSocketClosedError
2014-03-30 19:45:18,550 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 19:45:18,550 :: ERROR :: Uncaught exception in /socket
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 322, in wrapper
return callback(*args, **kwargs)
File "superTornado.py", line 190, in on_message
self.send_image()
File "superTornado.py", line 243, in send_image
self.write_message("error")
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 178, in write_message
raise WebSocketClosedError()
WebSocketClosedError
2014-03-30 19:46:19,370 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 19:46:19,370 :: ERROR :: Uncaught exception in /socket
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 322, in wrapper
return callback(*args, **kwargs)
File "superTornado.py", line 190, in on_message
self.send_image()
File "superTornado.py", line 243, in send_image
self.write_message("error")
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 178, in write_message
raise WebSocketClosedError()
WebSocketClosedError
2014-03-30 19:49:02,733 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 19:49:02,734 :: ERROR :: Uncaught exception in /socket
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 322, in wrapper
return callback(*args, **kwargs)
File "superTornado.py", line 190, in on_message
self.send_image()
File "superTornado.py", line 243, in send_image
self.write_message("error")
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 178, in write_message
raise WebSocketClosedError()
WebSocketClosedError
2014-03-30 19:51:07,270 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 19:51:10,280 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 19:53:25,483 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 19:53:28,493 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 19:54:55,283 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 19:54:58,293 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 19:57:16,233 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 19:57:19,243 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 20:11:38,057 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 20:11:41,067 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 20:17:03,077 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 20:17:06,087 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 20:42:24,303 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 20:42:27,313 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 20:42:56,890 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 20:42:59,900 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 20:45:28,953 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 20:45:31,963 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 20:59:52,060 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 20:59:55,070 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 20:59:58,080 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 20:59:58,080 :: ERROR :: Uncaught exception in /socket
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 322, in wrapper
return callback(*args, **kwargs)
File "superTornado.py", line 190, in on_message
self.send_image()
File "superTornado.py", line 243, in send_image
self.write_message("error")
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 178, in write_message
raise WebSocketClosedError()
WebSocketClosedError
2014-03-30 21:00:41,353 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 21:00:44,363 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 21:00:47,373 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 21:00:47,373 :: ERROR :: Uncaught exception in /socket
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 322, in wrapper
return callback(*args, **kwargs)
File "superTornado.py", line 190, in on_message
self.send_image()
File "superTornado.py", line 243, in send_image
self.write_message("error")
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 178, in write_message
raise WebSocketClosedError()
WebSocketClosedError
2014-03-30 21:01:09,833 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 21:01:12,843 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 21:01:15,853 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 21:01:15,853 :: ERROR :: Uncaught exception in /socket
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 322, in wrapper
return callback(*args, **kwargs)
File "superTornado.py", line 190, in on_message
self.send_image()
File "superTornado.py", line 243, in send_image
self.write_message("error")
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 178, in write_message
raise WebSocketClosedError()
WebSocketClosedError
2014-03-30 21:01:52,123 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 21:01:55,133 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 21:01:58,143 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 21:01:58,143 :: ERROR :: Uncaught exception in /socket
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 322, in wrapper
return callback(*args, **kwargs)
File "superTornado.py", line 190, in on_message
self.send_image()
File "superTornado.py", line 243, in send_image
self.write_message("error")
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 178, in write_message
raise WebSocketClosedError()
WebSocketClosedError
2014-03-30 21:05:00,373 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 21:05:03,383 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 21:05:06,393 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 21:05:06,393 :: ERROR :: Uncaught exception in /socket
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 322, in wrapper
return callback(*args, **kwargs)
File "superTornado.py", line 190, in on_message
self.send_image()
File "superTornado.py", line 243, in send_image
self.write_message("error")
File "/usr/lib/python2.7/site-packages/tornado/websocket.py", line 178, in write_message
raise WebSocketClosedError()
WebSocketClosedError
2014-03-30 21:08:10,170 :: ERROR :: ->WARNING : Camera Unreachable! Check Camera Configuration!
2014-03-30 21:08:13,179 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 21:08:16,190 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 21:08:19,200 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 21:08:19,200 :: ERROR :: 
2014-03-30 21:12:37,160 :: ERROR :: ->WARNING : Camera Unreachable! Check Camera Configuration!
2014-03-30 21:12:43,670 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 21:12:46,679 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 21:12:49,689 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 21:12:49,690 :: ERROR :: Failed Send data : Socket Close 
2014-03-30 21:20:00,449 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 21:20:03,460 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 21:20:06,470 :: ERROR :: [Errno socket error] [Errno 113] No route to host
2014-03-30 21:20:06,470 :: ERROR :: Failed Send data : Socket Close 

101
log/warning.log Normal file
View File

@ -0,0 +1,101 @@
2014-03-30 15:55:30,544 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 15:56:22,730 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 15:57:56,091 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 15:58:23,329 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 15:59:02,337 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 16:29:36,371 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 16:29:36,377 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 16:31:59,303 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 16:31:59,306 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 16:31:59,309 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 16:33:00,934 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 16:33:00,938 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 16:33:00,941 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 16:34:28,702 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 16:34:28,706 :: WARNING :: 405 POST /video (127.0.0.1) 0.33ms
2014-03-30 16:35:38,906 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 16:35:38,909 :: WARNING :: 405 POST /video (127.0.0.1) 0.32ms
2014-03-30 16:35:54,440 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 16:35:54,443 :: WARNING :: 405 POST /video (127.0.0.1) 0.34ms
2014-03-30 16:36:22,054 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 16:36:22,057 :: WARNING :: 405 POST /video (127.0.0.1) 0.57ms
2014-03-30 16:38:23,545 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 16:38:23,549 :: WARNING :: 405 POST /video (127.0.0.1) 0.33ms
2014-03-30 16:38:57,638 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 16:38:57,641 :: WARNING :: 405 POST /video (127.0.0.1) 0.33ms
2014-03-30 16:39:15,152 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 16:39:15,155 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 16:39:15,158 :: WARNING :: 405 POST /video (127.0.0.1) 0.32ms
2014-03-30 16:39:47,391 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 16:39:47,395 :: WARNING :: 405 POST /video (127.0.0.1) 0.36ms
2014-03-30 16:41:11,869 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 16:41:11,873 :: WARNING :: 404 POST //unauthorized (127.0.0.1) 0.59ms
2014-03-30 16:41:25,327 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 16:42:01,225 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 16:42:09,753 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 16:45:14,674 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 16:45:14,684 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 16:48:36,697 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 16:48:36,706 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 16:54:15,656 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 16:54:15,664 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 16:55:15,362 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 17:15:34,425 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 17:16:02,440 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 17:16:45,956 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 17:17:52,266 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 18:01:42,480 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 18:01:42,493 :: WARNING :: 404 GET /ocket (127.0.0.1) 0.30ms
2014-03-30 18:02:13,289 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 18:02:13,301 :: WARNING :: 404 GET /ocket (127.0.0.1) 0.30ms
2014-03-30 18:02:29,900 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:02:20,490 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:05:40,354 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:08:38,682 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:09:24,868 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:12:31,635 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:12:36,801 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:14:13,496 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:16:45,954 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:18:52,443 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:18:59,059 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:21:13,162 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:22:26,152 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:22:42,294 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:25:38,625 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:26:43,604 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:28:22,007 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:30:20,538 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:30:27,870 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:38:22,429 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:38:42,051 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:39:01,661 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:39:38,848 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:40:08,056 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:40:35,383 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:40:59,504 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:41:51,990 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:43:43,369 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:44:22,043 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:45:15,451 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:46:16,273 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:46:52,672 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:48:41,807 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:48:59,650 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:51:04,148 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:53:22,397 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:54:52,176 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 19:57:13,156 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 20:11:34,946 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 20:16:59,980 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 20:42:21,227 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 20:42:53,718 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 20:45:25,831 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 20:59:48,981 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 21:00:38,219 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 21:01:06,685 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 21:01:49,027 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 21:04:57,265 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 21:08:11,785 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 21:12:40,581 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1
2014-03-30 21:19:57,338 :: WARNING :: ->An unauthorized user try to access : 127.0.0.1

View File

@ -3,6 +3,8 @@ camera=192.168.1.13
portCamera=80
idUrlCamera=test:a
endUrlCamera=/image.jpg
serv=192.168.1.12
serv=127.0.0.1
portServ=80
ipDomoMi=192.168.16.150
portDomoMi=80

View File

@ -1,11 +1,18 @@
class LoadConf(object):
"""Loading configuration file"""
def __init__(self,path):
"""
Define file path for load config
"""
self.path = path
def loadValue(self, key):
"""
Return the value associate to the key into conf file (fichier/conf)
Else return "error"
"""
with open("m/fichier/conf", "r") as source :
with open(self.path , "r") as source :
for ligne in source:
data = ligne.rstrip('\r\n').split('=')
if data[0] == key :
@ -68,6 +75,18 @@ class LoadConf(object):
"""
def endUrlCamera(self) :
return self.loadValue("endUrlCamera")
"""
Return ipDomoMi configuration
Else "error"
"""
def ipDomo(self) :
return self.loadValue("ipDomoMi")
"""
Return portDomoMi configuration
Else "error"
"""
def portDomo(self) :
return self.loadValue("portDomoMi")

View File

@ -85,15 +85,15 @@ class Log(object):
pLvl : level of log message
"""
if pLvl == lvl.DEBUG :
pMsg = bcolors.DEBUG + pMsg + bcolors.ENDC
pMsg = bcolors.DEBUG + str(pMsg) + bcolors.ENDC
elif pLvl == lvl.INFO :
pMsg = bcolors.INFO + pMsg + bcolors.ENDC
pMsg = bcolors.INFO + str(pMsg) + bcolors.ENDC
elif pLvl == lvl.SUCCESS :
pMsg = bcolors.SUCCESS + pMsg + bcolors.ENDC
pMsg = bcolors.SUCCESS + str(pMsg) + bcolors.ENDC
elif pLvl == lvl.WARNING :
pMsg = bcolors.WARNING + pMsg + bcolors.ENDC
pMsg = bcolors.WARNING + str(pMsg) + bcolors.ENDC
elif pLvl == lvl.FAIL :
pMsg = bcolors.FAIL + pMsg + bcolors.ENDC
pMsg = bcolors.FAIL + str(pMsg) + bcolors.ENDC
self.logger.log(pLvl,pMsg)

View File

@ -1,11 +1,16 @@
import hashlib
import httplib
class Login(object):
"""
Login manager
"""
def __init__(self,path):
"""
Define file path for login information
"""
self.path = path
def checkLogin(self,pLog,pPasswd):
"""
Check if login and password are correct (in file fichier/allow)
@ -15,12 +20,12 @@ class Login(object):
return : true if correct login
false else
"""
hashMdp = hashlib.sha224(pPasswd).hexdigest()
with open("m/fichier/allow", "r") as source :
hashPasswd = hashlib.sha224(pPasswd).hexdigest()
with open(self.path, "r") as source :
for ligne in source :
data = ligne.rstrip('\n\r').split(',')
if data[0] == pLog :
if data[1] == hashMdp :
if data[1] == hashPasswd :
source.close()
return True
source.close()

View File

@ -26,7 +26,8 @@ class GlobalVars :
"""
Global vars for server
"""
config = LoadConf()
config = LoadConf("m/fichier/conf")
log = Log()
blind = False
ipCamera = ""
portCamera = ""
@ -34,13 +35,15 @@ class GlobalVars :
idCamera = ""
urlCamera = ""
portServ = ""
log = Log()
urlSocket = ""
ipDomo=""
portDomo=""
authorized = 0
unauthorized = 0
class BaseHandler(tornado.web.RequestHandler):
"""
Define BaseHandler for create the basis for session connection
@ -71,7 +74,7 @@ class MainHandler(BaseHandler):
iden = self.get_argument("id","")
paswd = self.get_argument("paswd","")
login = Login()
login = Login("m/fichier/allow")
autorise = login.checkLogin(iden, paswd)
self.set_secure_cookie("user", iden)
if autorise == True:
@ -161,34 +164,36 @@ class WSocketHandler(BaseHandler,tornado.websocket.WebSocketHandler):
if GlobalVars.blind == True:
GlobalVars.authorized + 1
GlobalVars.log.printL('->Send audio alarm authorized user',lvl.INFO)
self.send_signal_house('maison.request("GET", "micom/say.php?source=toto&text=Connection%20a%20la%20camera%20autorisee")')
self.send_signal_house('maison.request("GET", "/micom/say.php?source=toto&text=Connection%20a%20la%20camera%20autorisee")')
else:
GlobalVars.authorized + 1
GlobalVars.log.printL('->Send visual alarm authorized user',lvl.INFO)
self.send_signal_house('maison.request("GET", "micom/lamp.php?room=salon1&order=1")')
self.send_signal_house('maison.request("GET", "/micom/lamp.php?room=salon1&order=1")')
else :
GlobalVars.log.printL("->"+iden + ": Unauthorized user connection : " + self.request.remote_ip,lvl.WARNING)
if GlobalVars.blind == True:
GlobalVars.unauthorized + 1
GlobalVars.log.printL('->Send audio alarm unauthorized user',lvl.WARNING)
self.send_signal_house('maison.request("GET", "micom/say.php?source=toto&text=Connection%20a%20la%20camera%20non%20autorisee")')
self.send_signal_house('maison.request("GET", "/micom/say.php?source=toto&text=Connection%20a%20la%20camera%20non%20autorisee")')
else:
GlobalVars.unauthorized + 1
GlobalVars.log.printL('->Send visual alarm unauthorized user',lvl.WARNING)
self.send_signal_house('maison.request("GET", "micom/lamp.php?room=salon1&order=1")')
self.send_signal_house('maison.request("GET", "/micom/lamp.php?room=salon1&order=1")')
self.send_image()
def on_message(self,mesg):
def on_message(self,msg):
"""
Client Ask For Image
"""
GlobalVars.log.printL("->Demand Data Receive : " + self.request.remote_ip,lvl.INFO)
self.send_image()
try:
self.send_image()
except Exception, e :
GlobalVars.log.printL("->Failed Send data : Socket Close ",lvl.FAIL)
def on_close(self):
"""
Socket connection Connection->
Socket connection Connection
Alert unhabitant with the good signal
"""
GlobalVars.log.printL("->Websocket Closed : "+self.request.remote_ip,lvl.SUCCESS)
@ -203,24 +208,24 @@ class WSocketHandler(BaseHandler,tornado.websocket.WebSocketHandler):
if GlobalVars.blind == True:
if (GlobalVars.unauthorized == 0) and (GlobalVars.authorized == 0):
GlobalVars.log.printL('->Send Audio Alarm Deconnection User', lvl.INFO)
self.send_signal_house('maison.request("GET", "micom/say.php?source=toto&text=Connection%20a%20la%20camera%20rompue")')
self.send_signal_house('maison.request("GET", "/micom/say.php?source=toto&text=Connection%20a%20la%20camera%20rompue")')
else:
if (GlobalVars.unauthorized == 0) and (GlobalVars.authorized == 0):
GlobalVars.log.printL('->Send Visual Alarm Deconnection User ...',lvl.INFO)
self.send_signal_house('maison.request("GET", "micom/lamp.php?room=salon1&order=0")')
self.send_signal_house('maison.request("GET", "/micom/lamp.php?room=salon1&order=0")')
def send_signal_house(self, pRq) :
"""
Allow send pRq request to the house
"""
GlobalVars.log.printL('maison = httplib.HTTPConnection("192.168.16.150", 80)',lvl.DEBUG)
"""maison = httplib.HTTPConnection("192.168.16.150")"""
GlobalVars.log.printL('maison = httplib.HTTPConnection("'+GlobalVars.ipDomo+'",'+ GlobalVars.portDomo+')',lvl.DEBUG)
"""maison = httplib.HTTPConnection(GlobalVars.ipDomo,GlobalVars.portDomo)"""
try :
GlobalVars.log.printL(pRq,lvl.DEBUG)
"""maison.request("GET",pRq)"""
GlobalVars.log.printL("->Signal To House Send Successfully", lvl.SUCCESS)
except Exception, e :
GlobalVars.log.printL(e, lvl.FAIL)
GlobalVars.log.printL(e.value, lvl.FAIL)
GlobalVars.log.printL("->Signal To House Send Failed", lvl.FAIL)
def send_image(self) :
@ -262,6 +267,8 @@ if __name__ == "__main__":
GlobalVars.endUrlCamera = GlobalVars.config.endUrlCamera()
GlobalVars.ipServ = GlobalVars.config.ipServ()
GlobalVars.portServ = GlobalVars.config.portServ()
GlobalVars.ipDomo = GlobalVars.config.ipDomo()
GlobalVars.portDomo = GlobalVars.config.portDomo()
if GlobalVars.blind == "error" :
raise ConfigError("Failed Load Blind Configuration")
@ -277,6 +284,10 @@ if __name__ == "__main__":
raise ConfigError("Failed Load IP Server Configuration")
if GlobalVars.portServ == "error" :
raise ConfigError("Failed Load Port Server Configuration")
if GlobalVars.ipDomo == "error" :
raise ConfigError("Failed Load IP Domotic Configuration")
if GlobalVars.portDomo == "error" :
raise ConfigError("Failed Load Port Domotic Configuration")
except ConfigError as e :
GlobalVars.log.printL(e.value,lvl.FAIL)
GlobalVars.log.printL("Configuration Loading Failed ! Check Configuration File !",lvl.FAIL)
@ -292,9 +303,11 @@ if __name__ == "__main__":
GlobalVars.log.printL(" +End url Camera : " + GlobalVars.endUrlCamera,lvl.INFO)
GlobalVars.log.printL(" +Ip Server : " + GlobalVars.ipServ,lvl.INFO)
GlobalVars.log.printL(" +Port Server : " + GlobalVars.portServ,lvl.INFO)
GlobalVars.log.printL(" +IP Domotic : " + GlobalVars.ipDomo,lvl.INFO)
GlobalVars.log.printL(" +Port Domotic : " + GlobalVars.portDomo,lvl.INFO)
print ""
GlobalVars.urlSocket = 'ws://'+GlobalVars.ipServ+':'+GlobalVars.portCamera+'/socket'
GlobalVars.urlSocket = 'ws://'+GlobalVars.ipServ+':'+GlobalVars.portServ+'/socket'
GlobalVars.urlCamera = 'http://'+GlobalVars.idUrlCamera+'@'+GlobalVars.ipCamera+':'+GlobalVars.portCamera+GlobalVars.endUrlCamera
GlobalVars.log.printL("->Ping camera ...",lvl.INFO)

17
test/AllowTest Normal file
View File

@ -0,0 +1,17 @@
4u8jq3J9hEG0ZQ,79af5b0417d02392e22eeea9af539acddf1b7df16c6bf3a83e661774
7HLP,3bd969da01f586774021e72ef6eb802d38e1c263760f3f56b5812760
eU65FDk3c,2e687f8b8b0f97e2951b7b69ac45baf291df1e8a0cb01bd90624e2b0
4NiX4,6ead98789bc7cdcc2fa7702cfe3b10ee280e1d8608fd258a25782045
CsFd4lwXk9,8f61eaa23a728901322d0596cfbf25da27e212162d897fa95d7ac9ac
nghz,64b00fd3a24a5b2ab169cc3891b0d65c6c65e695532eaff2c7259cbd
wSUyyNNKNTlvr,06386e5d7c243bf66f1cd717ebdab48ca33bf75f408da9c95c3fd30a
0s01eGWoY8aGplb,f9a26c9c8e474c73d61ebb2fbadb72b2743c1cb84e1a92abdf433fe7
9HA1lzbFEuYf1rXpKe,df4e71601e2a93f5d17e9599f25acd249f3fb20cf57ed8e1d56aba76
1w,0599c5153b82f9f3a47f45014165e5648edd4e0ff90d5b544d74b629
Qky5HF,50557d97b6dd5abfc4e86ba4ff4e1f4b92b17908fa42791aaf70bc66
hTtP,f92d7aa3b3243d461489c61ef4d536fa01fdf0dfab68d60dd354940f
NohoYCOrW0nw0Zie,af6c0bb741cc5725e6e09eb731cb958e6b67b2e30a65ff8ea7b23394
Ahpx9i65RKUoQTaqc,f5a43e2f60a96ffbe7d75d7f6cfa62bbd170ef7ab36dcc4a233e2a4b
SJEtTanO2FNFUd7MYU,fe6e47c833c2850fd02fa9ed4e17a32e334cf5897ec73a6749466ad8
B8T9ua3vks2YZYCL4Ag,a2bafbc1dcdd406d9717092d497937e9061e400943658827191b53a9
JP,95cbc8568bc02f258132fddf1344a6e558f94c39d20284ee3237f325

16
test/ConfTest Normal file
View File

@ -0,0 +1,16 @@
VgS4Ia4IvUHC5niHmNR1=ExiJILtyduI
EXTM=lu6ltwn5vYU07mFupP4
0=m4VYOt7MHSZCijA2kPv
0RH0gFjtlFDxg6=JB
0gbS8=duM7RL
TN=hqkUnUdp
3tynRJm91uvM=9t
KmO=s2vnpx
1DZ7EL8mmUT7=Ck
hWMNcDWfdj=xZsqrp3ctcfR0
GWVF2moK=CfFlLHozTeiBj7Rh
jin5jmoevE5msN=9T5
muM=bkRp
cgUGnl8n1=5AGUXFkpSzs
Jb7YlVGMcd6s2=agXT2nzPYkbS
B=y0j02B

29
test/MiEmulator.py Normal file
View File

@ -0,0 +1,29 @@
"""Import Tornado Server"""
import sys
import tornado.ioloop
import tornado.web
import tornado.httpserver
import tornado.websocket
import tornado.options
from tornado.ioloop import PeriodicCallback
f = open("requestToMi", "w")
class MainHandler(tornado.web.RequestHandler):
def get(self):
print "lol"
application = tornado.web.Application([
(r"/lol", MainHandler)])
if __name__ == "__main__":
try :
tornado.options.parse_command_line()
http_server = tornado.httpserver.HTTPServer(application)
http_server.listen(80)
tornado.ioloop.IOLoop.instance().start()
except Exception, e :
print e
sys.exit(1)

0
test/a Normal file
View File

206
test/botTest.py Normal file
View File

@ -0,0 +1,206 @@
import urllib, urllib2
import cookielib, time
import random
import string
import socket
import sys
from websocket import create_connection#sudo pip install websocket-client
from urllib import urlopen
ignore_discard=True
# url for website
base_url = 'http://127.0.0.1/'
# cookies
cookie_file = 'mfp.cookies'
cj = cookielib.MozillaCookieJar(cookie_file)
# set up opener to handle cookies, redirects etc
opener = urllib2.build_opener(
urllib2.HTTPRedirectHandler(),
urllib2.HTTPHandler(debuglevel=0),
urllib2.HTTPSHandler(debuglevel=0),
urllib2.HTTPCookieProcessor(cj)
)
# we are not a python, we are a browser :)
browser = 'Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.9.0.6) Gecko/2009020619 Gentoo Iceweasel/3.0.6'
opener.addheaders = [('User-agent',
(browser))
]
print "Hello, I'm botTest :)"
print "I'm here for test MI camera server."
print "I'm not a python script for the server, I'm a browser : \n" + browser.replace(";","")
print "\nI'm starting test with video page where an unconnect user can't normaly access :"
print "PATH: /video"
print "TYPE REQUEST : GET"
print "DATA SEND : -"
print ""
resp = opener.open(base_url+"video")
if resp.geturl()== base_url:
print("OK : redirection to /")
else:
print("NOK : not redirect to / !")
cj.save()
print "\nI will know try to connect with bad login information :"
print "PATH: /"
print "TYPE REQUEST : POST"
print "DATA SEND :"
login = ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in range(random.randint(5,10)))
paswd = ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in range(random.randint(5,10)))
print "login => " + login
print "paswd => " + paswd
print ""
login_data = urllib.urlencode({
'id' : login,
'paswd' : paswd,
})
resp = opener.open(base_url, login_data)
if resp.geturl()== base_url+"unauthorized":
print("OK : redirection to /unauthorized")
else:
print("NOK : not redirect to /unauthorized !")
cj.save()
print "\nI will now try to force access to camera :"
print "PATH: /unauthorized "
print "TYPE REQUEST : POST"
print "DATA SEND :"
print "illegalAccess => 1"
print ""
login_data = urllib.urlencode({
'illegalAccess' : '1',
})
resp = opener.open(base_url+"unauthorized", login_data)
if resp.geturl()== base_url+"video":
print("OK : redirection to /video")
else:
print("NOK : not redirect to /video !")
cj.save()
print "\nI will now try to not force access to camera :"
print "PATH: /unauthorized "
print "TYPE REQUEST : POST"
print "DATA SEND :"
print "illegalAccess => 0"
print ""
login_data = urllib.urlencode({
'illegalAccess' : "0",
})
resp = opener.open(base_url+"unauthorized", login_data)
if resp.geturl()== base_url:
print("OK : redirection to /")
else:
print("NOK : not redirect to / !")
cj.save()
print "\nI will now try to connect with good user information :"
print "PATH: / "
print "TYPE REQUEST : POST"
print "DATA SEND :"
login = "jmi"
paswd = "azerty"
print "login => " + login
print "paswd => " + paswd
print ""
login_data = urllib.urlencode({
'id' : login,
'paswd' : paswd,
})
resp = opener.open(base_url, login_data)
if resp.geturl()== base_url+"video":
print("OK : redirection to /video")
else:
print("NOK : not redirect to /video !")
cj.save()
print "\nNow I have acess to /video i will try to connect to websocket to aquire image :"
print "PATH: /socket "
print "TYPE REQUEST : GET"
print "DATA SEND :"
try :
val =""
for cookie in cj :
if cookie.name =="user" :
val = cookie.value
ws = create_connection("ws://127.0.0.1/socket",\
header={"Cookie:user="+val})
print "Sending"
ws.send("Asf for data")
print "Sent"
print "Receiving..."
result = ws.recv()
print "Rep : " + result
if result == "error":
print "NOK : Response From Socket But Is An Error"
else:
print "OK : Receive Some Data From Socket. Can't Guaranted Is Image"
ws.close()
except Exception, e :
print "NOK : Failed To Connect To Websocket And Received Data"
cj.save()
print "\nI will now try to disconnet :"
print "PATH: / "
print "TYPE REQUEST : GET"
print "DATA SEND : - "
resp = opener.open(base_url+"disconnection")
if resp.geturl()== base_url:
print("OK : redirection to /")
else:
print("NOK : not redirect to / !")
cj.save()
print "\nI'm now test video for check if i am disconnected :"
print "PATH: /video"
print "TYPE REQUEST : GET"
print "DATA SEND : -"
print ""
resp = opener.open(base_url+"video")
if resp.geturl()== base_url:
print("OK : redirection to /")
else:
print("NOK : not redirect to / !")
cj.save()
print "\nNow I Will Try To Connect To The Websocket then I not connected :"
print "PATH: /socket "
print "TYPE REQUEST : GET"
print "DATA SEND :"
try :
val =""
for cookie in cj :
if cookie.name =="user" :
val = cookie.value
ws = create_connection("ws://127.0.0.1/socket",\
header={"Cookie:user="+val})
print "Sending"
ws.send("Asf for data")
print "Sent"
print "Receiving..."
result = ws.recv()
print "Rep : " + result
if result == "error":
print "NOK : Response From Socket But Is An Error"
else:
print "NOK : Receive Some Data From Socket. Can't Guaranted Is Image"
ws.close()
except Exception, e :
print "OK : Failed To Connect To Websocket And Received Data"
cj.save()
print "\nI have finished to test MI camera server."
print "Good Bye."

4
test/mfp.cookies Normal file
View File

@ -0,0 +1,4 @@
# Netscape HTTP Cookie File
# http://www.netscape.com/newsref/std/cookie_spec.html
# This is a generated file! Do not edit.

151
test/testFichier.py Normal file
View File

@ -0,0 +1,151 @@
import random
import string
import hashlib
import sys
sys.path[:0]=['../']
from m.log import *
from m.loadConf import *
from m.login import *
class testConf(object):
"""
Test on Conf File Loading
"""
def createConf(self) :
"""
Create a random conf file named ConfTest.
Save key ,value in self.assos[].
"""
print "Create Random Conf File"
f = open("ConfTest", "w")
j = random.randint(5,20)
self.assos = [""]*j
for i in range (0,j) :
key=''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in range(random.randint(1,20)))
value = ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in range(random.randint(1,20)))
self.assos[i] = [key,value]
f.write(key+"="+value+"\n")
f.close()
print "Random Conf File Create"
def testLoadConf(self,LoadConfObject) :
"""
Test loadValue method LoadConf object
"""
print "\nTesting All Valid Keys"
err=0
for key,value in self.assos :
confValue = LoadConfObject.loadValue(key)
if confValue == "error" :
print "NOK : Error an valid key give return an error"
err +=1
if value == confValue :
print "OK : Succesfull Load Config Value"
else :
print " NOK : Value return is not the right value"
err +=1
if err>0:
print "TEST FAIL : all key were not load succesfully"
else :
print "TEST SUCESSFULL : all key were load succesfully"
print "\nTesting invalid keys"
err = 0
for i in range(10):
confValue = LoadConfObject.loadValue(
''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in range(random.randint(1,20))))
if confValue != "error":
print "NOK : An value was return"
err += 1
else :
print "OK : return an error"
if err>0:
print "TEST FAIL : don't return only error'"
else :
print "TEST SUCESSFULL : return only error"
class testLogin(object):
def createAllowFile(self) :
"""
Create a allow file named AllowTest.
Save key ,value in self.assos[].
"""
print "Create Allow File"
f = open("AllowTest", "w")
j = random.randint(5,20)
self.assos = [""]*j
for i in range (0,j) :
name=''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in range(random.randint(1,20)))
passwd = ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in range(random.randint(1,20)))
hashPasswd = hashlib.sha224(passwd).hexdigest()
self.assos[i] = [name,passwd]
f.write(name+","+hashPasswd+"\n")
f.close()
print "Random Allow File Create"
def testLogin(self,LoginObject) :
"""
Test CheckLogin method LoadConf object
"""
print "\nTesting Valid Login Information "
err=0
for name,passwd in self.assos :
value = LoginObject.checkLogin(name,passwd)
if value == True:
print "OK : Return True"
else :
print "NOK : Return False"
err +=1
if err==0:
print "TEST SUCESSFULL : all login were succesfull"
else :
print "TEST FAIL: all login were not succesfull"
print "\nTesting invalid keys"
err = 0
for i in range(10):
value = LoginObject.checkLogin(
''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in range(random.randint(1,20))),
''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in range(random.randint(1,20))))
if value == True:
print "NOK : Return True"
err += 1
else :
print "OK : Return False"
if err>0:
print "TEST FAIL : Login Ok With Invalid Information"
else :
print "TEST SUCESSFULL : Login Not Ok With Invalid Information"
if __name__ == "__main__":
print "START TEST LOADCONFIG METHODS"
test= testConf()
test.createConf();
config = LoadConf("ConfTest")
test.testLoadConf(config);
print "\nEND TEST CONFIG FILE LOADING METHODS"
print "\nSTART TEST LOGIN METHODS"
test = testLogin()
test.createAllowFile()
login = Login("AllowTest")
test.testLogin(login)
print "\nEND TEST LOGIN METHODS"

26
test/testMISignaux.py Normal file
View File

@ -0,0 +1,26 @@
import httplib
import time
maison = httplib.HTTPConnection("192.168.16.150", 80)
maison.request("GET","/micom/say.php?source=toto&text=Connection%20a%20la%20camera%20autorisee")
print 'maison.request("GET","/micom/say.php?source=toto&text=Connection%20a%20la%20camera%20autorisee")'
time.sleep(5)
maison.request("GET","/micom/say.php?source=toto&text=Connection%20a%20la%20camera%20non%20autorisee")
print 'maison.request("GET","/micom/say.php?source=toto&text=Connection%20a%20la%20camera%20non%20autorisee")'
time.sleep(5)
maison.request("GET","/micom/say.php?source=toto&text=Connection%20a%20la%20camera%20rompue")
print 'maison.request("GET","/micom/say.php?source=toto&text=Connection%20a%20la%20camera%20rompue")'
time.sleep(5)
maison.request("GET","/micom/lamp.php?room=cuisine1&order=1")
print 'maison.request("GET","/micom/lamp.php?room=cuisine1&order=1")'
time.sleep(5)
maison.request("GET","/micom/lamp.php?room=cuisine1&order=0")
print 'maison.request("GET","/micom/lamp.php?room=cuisine1&order=0")'
time.sleep(5)
maison.request("GET","/micom/lamp.php?room=salon1&order=1")
print 'maison.request("GET","/micom/lamp.php?room=salon1&order=1")'
time.sleep(5)
maison.request("GET","/micom/lamp.php?room=salon1&order=0")
print 'maison.request("GET","/micom/lamp.php?room=salon1&order=0")'

View File

@ -6,7 +6,7 @@
<title>Acces camera</title>
</head>
<body>
<h2>Acces securise camera</h2>
<h2>Acces non autorisé camera</h2>
<form action="/unauthorized" method="post">
<p>Forcer l'acces a la camera :</p>
Oui : <input type="radio" name="illegalAccess" value=1>

View File

@ -1,45 +1,45 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Page d'identification</title>
<link rel="stylesheet" type="text/css" href="style/styles.css">
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico" />
<link rel="shortcut icon" type="image/gif" href="images/favicon.gif" />
<script type="text/javascript">
// Si aucun login et mot de passe n'ont été saisis alors :
function checkForm(form) {
if(form.username.value == "" && form.password.value == "") {
alert('Veuillez saisir votre login et votre mot de passe svp !')
return false;
}
}
</script>
</head>
<body>
<!-- Login Logo -->
<div id="login-logo">
<img src="images/iut.jpg" alt="IUT Logo">
</div>
<!-- Login Form -->
<div id="login-form">
<!-- Header -->
<h2>Page d'identification</h2>
<!-- Form -->
<form id="sw-login" method="POST" action="/">
<!-- Username -->
<div class="field">
<label for="username">Identifiant</label>
<input id="username" name="id" type="text">
</div>
<!-- Password -->
<div class="field">
<label for="password">Mot de passe</label>
<input id="password" name="paswd" type="password">
</div>
<!-- On click on the submit button run the checkFrom function -->
<input type="submit" value="Connexion" onclick="return checkForm(form);">
</form>
</div>
</body>
</html>
<!DOCTYPE HTML>
<html>
<head>
<title>Page d'identification</title>
<link rel="stylesheet" type="text/css" href="style/styles.css">
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico" />
<link rel="shortcut icon" type="image/gif" href="images/favicon.gif" />
<script type="text/javascript">
// Si aucun login et mot de passe n'ont été saisis alors :
function checkForm(form) {
if(form.username.value == "" && form.password.value == "") {
alert('Veuillez saisir votre login et votre mot de passe svp !')
return false;
}
}
</script>
</head>
<body>
<!-- Login Logo -->
<div id="login-logo">
<img src="images/iut.jpg" alt="IUT Logo">
</div>
<!-- Login Form -->
<div id="login-form">
<!-- Header -->
<h2>Page d'identification</h2>
<!-- Form -->
<form id="sw-login" method="POST" action="/">
<!-- Username -->
<div class="field">
<label for="username">Identifiant</label>
<input id="username" name="id" type="text">
</div>
<!-- Password -->
<div class="field">
<label for="password">Mot de passe</label>
<input id="password" name="paswd" type="password">
</div>
<!-- On click on the submit button run the checkFrom function -->
<input type="submit" value="Connexion" onclick="return checkForm(form);">
</form>
</div>
</body>
</html>