Line | |
---|
1 | import imp |
---|
2 | import time |
---|
3 | import os.path |
---|
4 | from xmlrpclib import * |
---|
5 | |
---|
6 | |
---|
7 | |
---|
8 | |
---|
9 | import threading |
---|
10 | import time |
---|
11 | import random |
---|
12 | |
---|
13 | SOL_SLEEP_TIME=300 |
---|
14 | |
---|
15 | class SignOfLife: |
---|
16 | |
---|
17 | def __init__(self): |
---|
18 | |
---|
19 | PLUGIN_PATH="/usr/share/n4d/python-plugins/" |
---|
20 | obj=imp.load_source("DiscoverUsers",PLUGIN_PATH + "DiscoverUsers.py") |
---|
21 | |
---|
22 | self.discover=obj.DiscoverUsers() |
---|
23 | t=threading.Thread(target=self.send_sign) |
---|
24 | t.setDaemon(True) |
---|
25 | t.start() |
---|
26 | |
---|
27 | #def init |
---|
28 | |
---|
29 | def send_sign(self): |
---|
30 | |
---|
31 | while True: |
---|
32 | |
---|
33 | time.sleep(SOL_SLEEP_TIME + int(SOL_SLEEP_TIME*random.random())) |
---|
34 | ret=self.discover.discover() |
---|
35 | print "" |
---|
36 | print "[SignOfLife] Sending client list..." |
---|
37 | |
---|
38 | try: |
---|
39 | server=ServerProxy("https://server:9779",allow_none=True) |
---|
40 | server.register_client("","ClientManager",ret) |
---|
41 | except Exception as e: |
---|
42 | print "[SignOfLife] Connection to server error..." |
---|
43 | print e |
---|
44 | |
---|
45 | |
---|
46 | #def send_sign |
---|
47 | |
---|
48 | #class SignOfLine |
---|
49 | |
---|
50 | if __name__=="__main__": |
---|
51 | |
---|
52 | sof=SignOfLife() |
---|
53 | while True: |
---|
54 | pass |
---|
Note: See
TracBrowser
for help on using the repository browser.