コード例 #1
0
 def handle(self):
     # self.request is the TCP socket connected to the client
     char = self.request.recv(1024)
     if len(char) == 1:
         len_secret = ord( char )
         self.request.send('a')
         secret = ''
         while len(secret) < len_secret:
           chunk = self.request.recv( len_secret - len(secret) )
           secret = secret + chunk
         b = BTSync()
         r = b.register_secret( secret )
         self.request.sendall( str(r) )
     self.request.shutdown(2)
     self.request.close()
コード例 #2
0
#!/usr/bin/env python

from btsync import BTSync
from config import host,port,user,pswd

b=BTSync(host,port,user,pswd)

secrets=b.get_registerd_secrets()

for secret in secrets:
    print secret
コード例 #3
0
#!/usr/bin/env python
from btsync import BTSync

b = BTSync()

print 'listen : {0}:{1}'.format(b.host, b.port)
print b.get_os()
print b.get_version()
print b.get_speed()
コード例 #4
0
ファイル: remove_secrets.py プロジェクト: ywrac/python-btsync
from btsync import BTSync
from config import host, port, user, pswd
import sys


secrets=sys.argv[1]

b=BTSync(host, port, user, pswd)

for secretWithN in open(secrets):
    print b.remove_folder(secretWithN.strip())

コード例 #5
0
#!/usr/bin/env python
from btsync import BTSync
import sys

secret = sys.argv[1]
b = BTSync()

print b.register_secret(secret)
コード例 #6
0
ファイル: btsyncasia.py プロジェクト: ywrac/python-btsync
 def __init__(self, host='localhost', 
              port='14888', user='******', 
              pswd='password', prefix='/BTSync'):
     self.prefix=prefix
     BTSync.__init__(self,host,port,user,pswd)
コード例 #7
0
ファイル: get_encryption.py プロジェクト: yawara/my-gc
#!/usr/bin/env python
import sys
from btsync import BTSync

secret = sys.argv[1]
b = BTSync()

print b.get_encryption(secret)
コード例 #8
0
#!/usr/bin/env python
from btsync import BTSync

b = BTSync()

print 'listen : {0}:{1}'.format(b.host,b.port)
print b.get_os()
print b.get_version()
print b.get_speed()
コード例 #9
0
#!/usr/bin/env python
from btsync import BTSync
import sys

secrets_file = sys.argv[1]
b = BTSync()

for secretWithN in open(secrets_file,'r'):
  print b.register_secret(secretWithN.strip())
コード例 #10
0
#!/usr/bin/env python
from btsync import BTSync

b = BTSync()

for folder in b.get_folders():
  print folder['secret']
コード例 #11
0
#!/usr/bin/env python
import sys
import os
import time

from btsync import BTSync

DB_PREFIX = '/Users/ywr/BTSync/db/ywr/'
RESCAN_INTERVAL = 5

if not os.path.exists(DB_PREFIX):
    sys.exit("Not Found: " + DB_PREFIX)

b = BTSync()

while True:
    print 'sleep for', RESCAN_INTERVAL, 'seconds...'
    time.sleep(RESCAN_INTERVAL)
    secrets = os.listdir(DB_PREFIX)
    if secrets == []:
        print 'secrets is empty, continue'
        continue
    for secret in secrets:
        if b.validate_secret(secret):
            print 'valid secret:', secret
            print 'try to register', secret
            msg = b.register_secret(secret)
            print msg
            if msg['error'] in {0, 200}:
                try:
                    os.rmdir(DB_PREFIX + secret)
コード例 #12
0
#!/usr/bin/env python
import sys
import os
import time

from btsync import BTSync

DB_PREFIX='/Users/ywr/BTSync/db/ywr/'
RESCAN_INTERVAL=5

if not os.path.exists(DB_PREFIX):
    sys.exit("Not Found: " + DB_PREFIX)

b = BTSync()

while True:
    print 'sleep for', RESCAN_INTERVAL, 'seconds...'
    time.sleep(RESCAN_INTERVAL)
    secrets = os.listdir(DB_PREFIX)
    if secrets == []:
        print 'secrets is empty, continue'
        continue
    for secret in secrets:
        if b.validate_secret(secret):
            print 'valid secret:', secret
            print 'try to register', secret
            msg = b.register_secret(secret)
            print msg
            if msg['error'] in {0,200}:
                try:
                    os.rmdir(DB_PREFIX+secret)
コード例 #13
0
ファイル: register_secrets.py プロジェクト: yawara/my-gc
#!/usr/bin/env python
from btsync import BTSync
import sys

secrets_file = sys.argv[1]
b = BTSync()

for secretWithN in open(secrets_file, 'r'):
    print b.register_secret(secretWithN.strip())