Ejemplo n.º 1
0
 def config(self, num_type, verbosity=None):
     for i in self.type_foobar:
         if self.type_foobar.index(i) == num_type - 1:
             subprocess.Popen("taskkill /f /im foobar2000.exe")
             if os.path.isdir(os.path.join(self.prog_path, 'foobar2000')):
                 os.rmdir(os.path.join(self.prog_path, 'foobar2000'))
             if os.path.isdir(
                     os.path.join(os.getenv('appdata'), 'foobar2000')):
                 os.rmdir(os.path.join(os.getenv('appdata'), 'foobar2000'))
             os.chdir(self.prog_path)
             os.system("mklink /d \"%s\\foobar2000\" \"%s\"" %
                       (self.prog_path, configset.read_config('TYPE', i)))
             os.chdir(os.getenv('appdata'))
             if os.path.isdir(os.path.join(os.getenv('appdata'), i)):
                 os.system("mklink /d \"%s\\foobar2000\" \"%s\"" %
                           (os.getenv('appdata'),
                            os.path.join(os.getenv('appdata'), i)))
             else:
                 if os.path.isdir(
                         os.path.join(os.getenv('appdata'),
                                      configset.read_config('APPDATA', i))):
                     os.system("mklink /d \"%s\\foobar2000\" \"%s\"" %
                               (os.getenv('appdata'),
                                configset.read_config('APPDATA', i)))
                 else:
                     self.error = "Please re-config your config file for section:APPDATA, option: %s" % (
                         i)
                     return False
     return True
Ejemplo n.º 2
0
 def pcloud(self, url_download, username = None, password = None, name = None, folderid = '0', foldername = None, downloadit = False, download_path = "."):
     #if not username:
         #username = raw_input('PCloud Username: '******'PClouse Password: '******''
     if configset.read_config('PCLOUD', 'PATH', 'aglink.ini'):
         PARENT_PATH = configset.read_config('PCLOUD', 'PATH', 'aglink.ini')
         sys.path.append(PARENT_PATH)
         PCLOUD_MODULE = os.path.basename(PARENT_PATH)
         PARENT_PATH = os.path.dirname(PARENT_PATH)
         if configset.read_config('PCLOUD', 'NAME', 'aglink.ini'):
             PCLOUD_MODULE = configset.read_config('PCLOUD', 'NAME', 'aglink.ini')
     elif os.getenv('PCLOUD_MODULE'):
         PARENT_PATH = os.getenv('PCLOUD_MODULE')
         sys.path.append(PARENT_PATH)
         PCLOUD_MODULE = os.path.basename(PARENT_PATH)
         PARENT_PATH = os.path.dirname(PARENT_PATH)
     else:
         PARENT_PATH = os.path.join(os.path.dirname(os.path.dirname(__file__)),'test')
         sys.path.append(os.path.join(PARENT_PATH, 'pypcloud'))
     debug.debug(PARENT_PATH = PARENT_PATH, debug = True)
     debug.debug(PCLOUD_MODULE = PCLOUD_MODULE, debug = True)
     sys.path.append(PARENT_PATH)
     try:
         import importlib
         pcloud = importlib.import_module(PCLOUD_MODULE)
         PCloud = pcloud.pcloud()
         datax = PCloud.remoteUpload(url_download, username = username, password = password, folderid = folderid, renameit = name, foldername = foldername)
         if downloadit:
             idx = datax.get('metadata')[0].get('id')
             data, cookies = PCloud.getDownloadLink(idx, download_path = download_path)
             download_path = os.path.abspath(download_path)
             if not os.path.isdir(download_path):
                 os.makedirs(download_path)
             if not os.path.isdir(download_path):
                 download_path = os.path.dirname(__file__)
             fileid = data.get('fileid')
             #if name:
                 #PCloud.printlist('usage', renamefile='')
                 #PCloud.renameFile(name, fileid, None, username, password)
             download_url = 'https://' + data.get('hosts')[0] + data.get('path')
             if name:
                 PCloud.download(download_url, download_path, name, cookies)
             else:
                 PCloud.download(download_url, download_path, cookies=cookies)
     except:
         print traceback.format_exc()
Ejemplo n.º 3
0
 def __init__(self, host=None, port=None):
     super(control, self)
     # self.THIS_PATH = ''
     self.host = host
     self.port = port
     self.conf = configset.get_config_file('pyfoobar.ini')
     cfg = configset.cfg
     cfg.read(self.conf)
     self.type_foobar = cfg.options('TYPE')
     self.error = ''
     self.nircmd = r"c:\EXE\nircmd.exe"
     if not os.path.isfile(self.nircmd):
         self.nircmd = r"nircmd.exe"
     self.ctype = configset.read_config('CONTROL', 'type')
     self.foobar2000 = ''
     # if self.ctype == 'com':
     #     import pyfoobar
     #     self.foobar2000 = pyfoobar.foobar()
     # elif self.ctype == 'http':
     #     import pyfoobar_http
     #     self.foobar2000 = pyfoobar_http.foobar(self.host, self.port)
     if not os.getenv('PROCESSOR_ARCHITECTURE') == 'x86':
         self.prog_path = os.getenv('ProgramFiles(x86)')
     else:
         self.prog_path = os.getenv('ProgramFiles')
Ejemplo n.º 4
0
 def config(self, section, option, value=None, configname=None):
     if configname:
         self.CONFIG_NAME = configname
     conf = configset.configset()
     conf.configname = self.CONFIG_NAME
     if value:
         configset.write_config(section, option, value)
     return configset.read_config(section, option)
Ejemplo n.º 5
0
    def __init__(self, msg, parent=None):
        super(Sender, self).__init__(parent)
        self.msg = str(msg)
        self.dataconf = configset.read_config()

        self.setGeometry(0, 0, 0, 0)
        self.timer = QtCore.QTimer(self)
        self.udpSocket = QtNetwork.QUdpSocket(self)
        self.timer.timeout.connect(self.broadcastDatagramm)

        self.broadcastDatagramm()
Ejemplo n.º 6
0
    def __init__(self, host=None, port=None):
        super(foobar, self)
        self.THIS_PATH = ''
        self.host = host
        self.port = port
        if self.host == None:
            self.host = configset.read_config('HTTP', 'server', CONF_FILE)
        if self.port == None:
            self.port = configset.read_config('HTTP', 'port', CONF_FILE)

        self.data = {
            'url': self.host,
            'port': self.port,
            'cmd': '',
            'param1': '',
            'param2': ''
        }
        self.redata = (self.data.get('url'), self.data.get('port'),
                       self.data.get('cmd'), self.data.get('param1'),
                       self.data.get('param2'))
        self.cdata = configset.read_config('CONTROL', 'type')
        self.url = "http://{0}:{1}/default/?cmd={2}&param1={3}&param2={4}".format(
            *self.redata)
Ejemplo n.º 7
0
    def __init__(self):
        QtGui.QWidget.__init__(self)
        self._parser = parserlog.parser()
        self.dataconf = configset.read_config()
        self.udpSocket = QtNetwork.QUdpSocket(self)
        self.statusText = "Stop"

        self.sqlA = '''CREATE TABLE IF NOT EXISTS [datatemp](
                       [id] BIGINT(100) NOT NULL PRIMARY KEY,
                       [pid] VARCHAR(255) NOT NULL,
                       [name] VARCHAR(255) NOT NULL,
                       [addinfo] VARCHAR(255) NOT NULL)'''

        #self.conn = sqlite.connect(os.environ['TEMP'] + '\\' + 'dtemp.db')
        self.conn = sqlite.connect('dtemp.db')
        self.curs = self.conn.cursor()
        self.process = QtCore.QProcess()

        #self.createIconGroupBox()
        #self.createMessageGroupBox()

        #self.iconLabel.setMinimumWidth(self.durationLabel.sizeHint().width())

        self.createActions()
        self.createTrayIcon()
        self.setIcon()

        #QtCore.QObject.connect(self.showMessageButton,
        #        QtCore.SIGNAL("clicked()"), self.showMessage)
        #QtCore.QObject.connect(self.showIconCheckBox,
        #        QtCore.SIGNAL("toggled(bool)"), self.trayIcon,
        #        QtCore.SLOT("setVisible(bool)"))
        #QtCore.QObject.connect(self.iconComboBox,
        #        QtCore.SIGNAL("currentIndexChanged(int)"), self.setIcon)
        #QtCore.QObject.connect(self.trayIcon,
        #        QtCore.SIGNAL("messageClicked()"), self.messageClicked)
        #QtCore.QObject.connect(self.trayIcon,
        #        QtCore.SIGNAL("activated(QSystemTrayIcon::ActivationReason)"),
        #        self.iconActivated)

        #mainLayout = QtGui.QVBoxLayout()
        #mainLayout.addWidget(self.iconGroupBox)
        #mainLayout.addWidget(self.messageGroupBox)
        #self.setLayout(mainLayout)

        #self.iconComboBox.setCurrentIndex(1)
        self.trayIcon.show()
Ejemplo n.º 8
0
    def __init__(self):
        QtGui.QWidget.__init__(self)
        self._parser = parserlog.parser()
        self.dataconf = configset.read_config()
        self.udpSocket = QtNetwork.QUdpSocket(self)
        self.statusText = "Stop"

        self.sqlA = '''CREATE TABLE IF NOT EXISTS [datatemp](
                       [id] BIGINT(100) NOT NULL PRIMARY KEY,
                       [pid] VARCHAR(255) NOT NULL,
                       [name] VARCHAR(255) NOT NULL,
                       [addinfo] VARCHAR(255) NOT NULL)'''

        self.conn = sqlite.connect('totalcmd_dtemp.db')
        self.curs = self.conn.cursor()
        self.process = QtCore.QProcess()

        self.createActions()
        self.createTrayIcon()
        self.setIcon()
        self.trayIcon.show()
Ejemplo n.º 9
0
#!/usr/bin/python
import configset
import os, sys

MODULE_PATH = configset.read_config('MODULE', 'path')

if sys.platform == 'win32':
    if os.path.isdir(r'c:/pyx'):
        sys.path.insert(0, r'c:\\pyx')
    import module002a
if not os.path.isdir(MODULE_PATH):
    raise SystemError('Please re-Set module ctrlfoobar2000 !')
else:
    sys.path.insert(0, MODULE_PATH)

from ctrfoobar2000 import control

foobar = control.control()


class foobarx(control.control):
    def __init__(self):
        super(foobarx, self)
        self.args = [
            '-h', '-l', '-p', '-s', '-P', '-n', '-r', '-R', '-V', '-M', '-i',
            '-t', '-c', '-k', '-C'
        ]
        self.ctype = foobar.ctype
        self.foobar2000 = foobar.foobar2000
        self.type_foobar = foobar.type_foobar
        self.prog_path = foobar.prog_path
Ejemplo n.º 10
0
from pysqlite2 import dbapi2 as sqlite
from configfile import Config
import warnings

my_name = os.path.splitext(os.path.basename(__file__))[0]
pid = "pid = " + str(os.getpid()) + ", sender = " + my_name
sender.main(pid)

try:
    import MySQLdb
except:
    msg = "You not have module \"MySQLdb\", please download before ! \n"
    sender.main(msg)
    pass

filedata = configset.read_config()
dataconf = configset.read_config()
filenamelog = filedata.setting[0].datalog
ftplog = filedata.setting[0].ftplog
roundtime = filedata.setting[0].roundtime
host = filedata.setting[0].host
port = filedata.setting[0].port
user = filedata.setting[0].username
passwd = filedata.setting[0].password
db = filedata.setting[0].database
table = filedata.setting[0].table
tableftp = filedata.setting[0].tableftp

IP_SYSLOG_SERVER = filedata.setting[0].sysloghost
PORT_SYSLOG_SERVER = int(filedata.setting[0].syslogport)
Ejemplo n.º 11
0
 def getModulePath(self):
     return configset.read_config('MODULE', 'path')