diff --git a/CHANGES.txt b/CHANGES.txt new file mode 100644 index 0000000..35a34f3 --- /dev/null +++ b/CHANGES.txt @@ -0,0 +1,4 @@ +0.0 +--- + +- Initial version diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..aef9e00 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,2 @@ +include *.txt *.ini *.cfg *.rst +recursive-include wscserver *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..0d417c7 --- /dev/null +++ b/README.txt @@ -0,0 +1,14 @@ +WSCServer README +================== + +Getting Started +--------------- + +- cd + +- $venv/bin/python setup.py develop + +- $venv/bin/initialize_WSCServer_db development.ini + +- $venv/bin/pserve development.ini + diff --git a/TODO.txt b/TODO.txt new file mode 100644 index 0000000..95bb6e7 --- /dev/null +++ b/TODO.txt @@ -0,0 +1 @@ +Aumentar as classes que faltarem no json_base conforme as coletas acontecem diff --git a/coleta.txt b/coleta.txt new file mode 100644 index 0000000..5ef06ab --- /dev/null +++ b/coleta.txt @@ -0,0 +1,65 @@ +{ + "System": { + "classeWMI": { + "Win32_BaseBoard": { + "label": "Win32_BaseBoard", + "classeAtributos": { + "Caption": "Placa Base", + "Description": "Placa Base", + "Manufacturer": "asus" + } + } + } + }, + "data_coleta": "14/10/2013" +} + +Geral +Win32_ComputerSystem: principal + Caption; + Domain; + UserName?; +Win32_NetworkAdapterConfiguration + IPAddress; + MACAddress; +Win32_OperatingSystem + Caption; + CSDVersion; + +Hardware + +Win32_Keyboard + Manufacturer; + Name; +Win32_PointingDevice + Manufacturer; + Name; +Win32_PhysicalMedia + Name; + Status; + Manufacturer; + Capacity; +Win32_BaseBoard + Manufacturer; + Model; + Name; +Win32_PhysicalMemory + Capacity; + Manufacturer; +Win32_Processor + Architecture; + Manufacturer; + Name; + NumberOfCores?; +Win32_Printer + Name; + Network; + ServerName?; + Shared; +Win32_DesktopMonitor + DisplayType?; + MonitorManufacturer?; + MonitorType?; + Name; + ScreenHeight?; + ScreenWidth?; \ No newline at end of file diff --git a/development.ini b/development.ini new file mode 100644 index 0000000..598d7fc --- /dev/null +++ b/development.ini @@ -0,0 +1,49 @@ +[app:main] +use = egg:WSCServer + +pyramid.reload_templates = true +pyramid.debug_authorization = false +pyramid.debug_notfound = false +pyramid.debug_routematch = false +pyramid.default_locale_name = en +pyramid.includes = + pyramid_tm + +sqlalchemy.url = postgresql://rest:rest@10.209.8.39/cacic + +[server:main] +use = egg:waitress#main +host = 0.0.0.0 +port = 6543 + +[loggers] +keys = root, wscserver, sqlalchemy + +[handlers] +keys = console + +[formatters] +keys = generic + +[logger_root] +level = INFO +handlers = console + +[logger_wscserver] +level = DEBUG +handlers = +qualname = wscserver + +[logger_sqlalchemy] +level = INFO +handlers = +qualname = sqlalchemy.engine + +[handler_console] +class = StreamHandler +args = (sys.stderr,) +level = NOTSET +formatter = generic + +[formatter_generic] +format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s diff --git a/production.ini b/production.ini new file mode 100644 index 0000000..b4abec5 --- /dev/null +++ b/production.ini @@ -0,0 +1,49 @@ +[app:main] +use = egg:WSCServer + +pyramid.reload_templates = false +pyramid.debug_authorization = false +pyramid.debug_notfound = false +pyramid.debug_routematch = false +pyramid.default_locale_name = en +pyramid.includes = + pyramid_tm + +sqlalchemy.url = postgresql://rest:rest@10.209.8.39/cacic + +[server:main] +use = egg:waitress#main +host = 0.0.0.0 +port = 6543 + +[loggers] +keys = root, wscserver, sqlalchemy + +[handlers] +keys = console + +[formatters] +keys = generic + +[logger_root] +level = WARN +handlers = console + +[logger_wscserver] +level = WARN +handlers = +qualname = wscserver + +[logger_sqlalchemy] +level = WARN +handlers = +qualname = sqlalchemy.engine + +[handler_console] +class = StreamHandler +args = (sys.stderr,) +level = NOTSET +formatter = generic + +[formatter_generic] +format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..baaf63f --- /dev/null +++ b/setup.cfg @@ -0,0 +1,27 @@ +[nosetests] +match=^test +nocapture=1 +cover-package=wscserver +with-coverage=1 +cover-erase=1 + +[compile_catalog] +directory = wscserver/locale +domain = WSCServer +statistics = true + +[extract_messages] +add_comments = TRANSLATORS: +output_file = wscserver/locale/WSCServer.pot +width = 80 + +[init_catalog] +domain = WSCServer +input_file = wscserver/locale/WSCServer.pot +output_dir = wscserver/locale + +[update_catalog] +domain = WSCServer +input_file = wscserver/locale/WSCServer.pot +output_dir = wscserver/locale +previous = true diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..5bebbc9 --- /dev/null +++ b/setup.py @@ -0,0 +1,50 @@ +import os + +from setuptools import setup, find_packages + +here = os.path.abspath(os.path.dirname(__file__)) +README = open(os.path.join(here, 'README.txt')).read() +CHANGES = open(os.path.join(here, 'CHANGES.txt')).read() + +requires = [ + 'pyramid', + 'SQLAlchemy', + 'transaction', + 'pyramid_tm', + 'pyramid_debugtoolbar', + 'zope.sqlalchemy', + 'waitress', + 'psycopg2', + 'pyramid_restler', + 'requests', + 'chameleon' +] + +setup(name='WSCServer', + version='0.1', + description='WSCServer', + long_description=README + '\n\n' + CHANGES, + classifiers=[ + "Development Status :: 2 - Pre-Alpha", + "Programming Language :: Python :: 3.2", + "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", + "Framework :: Pyramid", + "Topic :: Internet :: WWW/HTTP", + "Topic :: Internet :: WWW/HTTP :: WSGI :: Application", + ], + author='Lightbase', + author_email='pedro.ricardo@lighbase.com.br', + url='', + keywords='rest lightbase json cacic pyramid', + packages=find_packages(), + include_package_data=True, + zip_safe=False, + test_suite='wscserver', + install_requires=requires, + entry_points="""\ + [paste.app_factory] + main = wscserver:main + [console_scripts] + initialize_WSCServer_db = wscserver.scripts.initializedb:main + """ + ) \ No newline at end of file diff --git a/wscserver/__init__.py b/wscserver/__init__.py new file mode 100644 index 0000000..d3cb764 --- /dev/null +++ b/wscserver/__init__.py @@ -0,0 +1,23 @@ +from pyramid.config import Configurator +from pyramid_restler import includeme + +from sqlalchemy import engine_from_config, create_engine +from sqlalchemy.orm import sessionmaker + +from wscserver.config.routing import make_routes +from wscserver.model import initialize_sql, sqlalchemy_url + + +def main(global_config, **settings): + """ + This function returns a Pyramid WSGI application. + """ + config = Configurator(settings=settings) + config.scan('wscserver.model') # the "important" line + engine = create_engine(sqlalchemy_url) + initialize_sql(engine) + includeme(config) + + make_routes(config) + config.scan('wscserver') + return config.make_wsgi_app() diff --git a/wscserver/config/__init__.py b/wscserver/config/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/wscserver/config/__init__.py diff --git a/wscserver/config/routing.py b/wscserver/config/routing.py new file mode 100644 index 0000000..d9cf25a --- /dev/null +++ b/wscserver/config/routing.py @@ -0,0 +1,15 @@ +from wscserver.model.Coleta import ColetaContextFactory +from wscserver.view.restfulview import CustomRESTfulView +from wscserver.model.So import SoContextFactory + +def make_routes(config): + """ + Cria rotas + """ + config.add_static_view('static', 'static', cache_max_age=3600) + config.add_restful_routes( + 'rest/coleta', ColetaContextFactory, view=CustomRESTfulView) + config.add_restful_routes('rest/coleta2', ColetaContextFactory) + config.add_route('download','zip/coleta') + config.add_restful_routes('rest/so', SoContextFactory) + config.enable_POST_tunneling() diff --git a/wscserver/model/Acao.py b/wscserver/model/Acao.py new file mode 100644 index 0000000..16bbafe --- /dev/null +++ b/wscserver/model/Acao.py @@ -0,0 +1,66 @@ +from pyramid_restler.model import SQLAlchemyORMContext + +from sqlalchemy import Table +from sqlalchemy.orm import mapper +from sqlalchemy.schema import Column +from sqlalchemy.types import * +from wscserver.model import Base, session + + +class Acao(): + + """ + Classe que define a tabela 'acao' + + """ + + __tablename__ = 'acao' + id_acao = Column(String(30), primary_key=True, nullable=False) + te_descricao_breve = Column(String(100)) + te_descricao = Column(String) + te_nome_curto_modulo = Column(String(20)) + dt_hr_alteracao = Column(DateTime(timezone=False)) + cs_opcional = Column(String(1), nullable=False) + + def __init__(self, id_acao, te_descricao_breve, te_descricao, + te_nome_curto_modulo, dt_hr_alteracao, cs_opcional): + """ + Metodo que chama as colunas + """ + self.id_acao = id_acao + self.te_descricao_breve = te_descricao_breve + self.te_descricao = te_descricao + self.te_nome_curto_modulo = te_nome_curto_modulo + self.dt_hr_alteracao = dt_hr_alteracao + self.cs_opcional = cs_opcional + + def __repr__(self): + """ + Metodo que passa a lista de parametros da classe + """ + return "" % (self.id_acao, + self.te_descricao_breve, + self.te_descricao, + self.te_nome_curto_modulo, + self.dt_hr_alteracao, + self.cs_opcional + ) + + +class AcaoContextFactory(SQLAlchemyORMContext): + entity = Acao + + def session_factory(self): + return session + +acao = Table('acao', Base.metadata, + Column('id_acao', String(30), primary_key=True, nullable=False), + Column('te_descricao_breve', String(100)), + Column('te_descricao', String), + Column('te_nome_curto_modulo', String(20)), + Column('dt_hr_alteracao', DateTime(timezone=False)), + Column('cs_opcional', String(1), nullable=False), + extend_existing=True + ) + +mapper(Acao, acao) diff --git a/wscserver/model/AcaoExcecao.py b/wscserver/model/AcaoExcecao.py new file mode 100644 index 0000000..f29f8b8 --- /dev/null +++ b/wscserver/model/AcaoExcecao.py @@ -0,0 +1,59 @@ +from pyramid_restler.model import SQLAlchemyORMContext + +from sqlalchemy import Table, ForeignKey +from sqlalchemy.orm import mapper +from sqlalchemy.schema import Column +from sqlalchemy.types import * +from wscserver.model import Base, session + + +class AcaoExcecao(): + + """ + Classe que define a tabela 'acao_excecao' + + """ + + __tablename__ = 'acao_excecao' + id_acao_excecao = Column(Integer, primary_key=True, nullable=False) + te_node_address = Column(String(17), nullable=False) + id_acao = Column(String(30), ForeignKey('acao.id_acao')) + id_rede = Column(Integer, ForeignKey('rede.id_rede')) + + def __init__(self, te_node_address, id_acao, id_rede): + """ + Metodo que chama as colunas + + """ + + self.te_node_address = te_node_address + self.id_acao = id_acao + self.id_rede = id_rede + + def __repr__(self): + """ + Metodo que passa a lista de parametros da classe + + """ + return "" % (self.te_node_address, + self.id_acao, + self.id_rede, + ) + + +class AcaoExcecaoContextFactory(SQLAlchemyORMContext): + entity = AcaoExcecao + + def session_factory(self): + return session + +acao_excecao = Table('acaoExcecao', Base.metadata, + Column('id_acao_excecao', Integer, primary_key=True, + nullable=True), + Column('te_node_address', String(17), nullable=False), + Column('id_acao', String(30), ForeignKey('acao.id_acao')), + Column('id_rede', Integer, ForeignKey('rede.id_rede')), + extend_existing=True + ) + +mapper(AcaoExcecao, acao_excecao) diff --git a/wscserver/model/AcaoRede.py b/wscserver/model/AcaoRede.py new file mode 100644 index 0000000..5f5b5f9 --- /dev/null +++ b/wscserver/model/AcaoRede.py @@ -0,0 +1,57 @@ +from pyramid_restler.model import SQLAlchemyORMContext +from sqlalchemy import Table, ForeignKey +from sqlalchemy.orm import mapper, relationship, backref +from sqlalchemy.schema import Column +from sqlalchemy.types import * +from wscserver.model import Base, session +from sqlalchemy.ext.declarative import declarative_base + + +class AcaoRede(): + + """ + Classe que define a tabela 'acao_rede' + """ + + __tablename__ = 'acao_rede' + id_acao_rede = Column(Integer, primary_key=True, nullable=False) + id_acao = Column(String(30), ForeignKey('acao.id_acao')) + id_rede = Column(Integer, ForeignKey('rede.id_rede')) + dt_hr_coleta_forcada = Column(DateTime(timezone=False)) + + def __init__(self, id_acao, id_rede, dt_hr_coleta_forcada): + """ + Metodo que chama as colunas + """ + self.id_acao_rede = id_acao_rede + self.id_acao = id_acao + self.id_rede = id_rede + self.dt_hr_coleta_forcada = dt_hr_coleta_forcada + + def __repr__(self): + """ + Metodo que passa a lista de parametros da classe + """ + return "" % (self.id_acao_rede, + self.id_acao, + self.id_rede, + self.dt_hr_coleta_forcada + ) + + +class AcaoRedeContextFactory(SQLAlchemyORMContext): + entity = AcaoRede + + def session_factory(self): + return session + +acao_rede = Table('acao_rede', Base.metadata, + Column('id_acao_rede', Integer, primary_key=True, + nullable=False), + Column('id_acao', ForeignKey('acao.id_acao')), + Column('id_rede', ForeignKey('rede.id_rede')), + Column('dt_hr_coleta_forcada', DateTime(timezone=False)), + extend_existing=True + ) + +mapper(AcaoRede, acao_rede) diff --git a/wscserver/model/AcaoSo.py b/wscserver/model/AcaoSo.py new file mode 100644 index 0000000..3850924 --- /dev/null +++ b/wscserver/model/AcaoSo.py @@ -0,0 +1,55 @@ +from pyramid_restler.model import SQLAlchemyORMContext +from sqlalchemy import Table, ForeignKey +from sqlalchemy.orm import mapper, relationship, backref +from sqlalchemy.schema import Column +from sqlalchemy.types import * +from sqlalchemy.ext.declarative import declarative_base +from wscserver.model import Base, session + + +class AcaoSo(): + + """ + Classe que define a tabela 'acao_so' + + """ + __tablename__ = 'acao_so' + id_acao_so = Column(Integer, primary_key=True, nullable=False) + id_acao = Column(String(30), ForeignKey('acao.id_acao')) + id_rede = Column(Integer, ForeignKey('rede.id_rede')) + id_so = Column(Integer, ForeignKey('so.id_so')) + + def __init__(self, id_acao_so, id_acao, id_rede, id_so): + """ + Metodo que chama as colunas + """ + self.id_acao_so = id_acao_so + self.id_acao = id_acao + self.id_rede = id_rede + self.id_so = id_so + + def __repr__(self): + """ + Metodo que passa a lista de parametros da classe + """ + return "" % (self.id_acao_so, + self.id_acao, + self.id_rede, + self.id_so + ) + + +class AcaoSoContextFactory(SQLAlchemyORMContext): + entity = AcaoSo + + def session_factory(self): + return session + +acao_so = Table('acao_so', Base.metadata, + Column('id_acao_so', Integer, primary_key=True, + nullable=False), + Column('id_acao', String(30), ForeignKey("acao.id_acao")), + Column('id_rede', Integer, ForeignKey("rede.id_rede")), + Column('id_so', Integer, ForeignKey("so.id_so")), + ) +mapper(AcaoSo, acao_so) diff --git a/wscserver/model/Aplicativo.py b/wscserver/model/Aplicativo.py new file mode 100644 index 0000000..7931bf5 --- /dev/null +++ b/wscserver/model/Aplicativo.py @@ -0,0 +1,141 @@ +from pyramid_restler.model import SQLAlchemyORMContext + +from sqlalchemy import Table, ForeignKey +from sqlalchemy.orm import mapper +from sqlalchemy.schema import Column +from sqlalchemy.types import * +from wscserver.model import Base, session + + +class Aplicativo(): + + """ + Classe que define a tabela 'aplicativo' + + """ + + __tablename__ = 'aplicativo' + id_aplicativo = Column(Integer, primary_key=True, nullable=False) + id_so = Column(Integer, ForeignKey('so.id_so')) + nm_aplicativo = Column(String(100), nullable=False) + cs_car_inst_w9x = Column(String(2)) + te_car_inst_w9x = Column(String(255)) + cs_car_ver_w9x = Column(String(2)) + te_car_ver_w9x = Column(String(255)) + cs_car_inst_wnt = Column(String(2)) + te_car_inst_wnt = Column(String(255)) + cs_car_ver_wnt = Column(String(2)) + te_car_ver_wnt = Column(String(255)) + cs_ide_licenca = Column(String(2)) + te_ide_licenca = Column(String(255)) + dt_atualizacao = Column(DateTime(timezone=False)) + te_arq_ver_eng_w9x = Column(String(100)) + te_arq_ver_pat_w9x = Column(String(100)) + te_arq_ver_eng_wnt = Column(String(100)) + te_arq_ver_pat_wnt = Column(String(100)) + te_dir_padrao_w9x = Column(String(100)) + te_dir_padrao_wnt = Column(String(100)) + te_descritivo = Column(String) + in_disponibiliza_info = Column(String(1), nullable=False) + in_disponibiliza_info_usuario_comum = Column(String(1), nullable=False) + dt_registro = Column(DateTime(timezone=False)) + + def __init__(self,): + """ + Metodo que chama as colunas + """ + self.id_aplicativo = id_aplicativo + self.id_so = id_so + self.nm_aplicativo = nm_aplicativo + self.cs_car_inst_w9x = cs_car_inst_w9x + self.te_car_inst_w9x = te_car_inst_w9x + self.cs_car_ver_w9x = cs_car_ver_w9x + self.te_car_ver_w9x = te_car_ver_w9x + self.cs_car_inst_wnt = cs_car_inst_wnt + self.te_car_inst_wnt = te_car_inst_wnt + self.cs_car_ver_wnt = cs_car_ver_wnt + self.te_car_ver_wnt = te_car_ver_wnt + self.cs_ide_licenca = cs_ide_licenca + self.te_ide_licenca = te_ide_licenca + self.dt_atualizacao = dt_atualizacao + self.te_arq_ver_eng_w9x = te_arq_ver_eng_w9x + self.te_arq_ver_pat_w9x = te_arq_ver_pat_w9x + self.te_arq_ver_eng_wnt = te_arq_ver_eng_wnt + self.te_arq_ver_pat_wnt = te_arq_ver_pat_wnt + self.te_dir_padrao_w9x = te_dir_padrao_w9x + self.te_dir_padrao_wnt = te_dir_padrao_wnt + self.te_descritivo = te_descritivo + self.in_disponibiliza_info = in_disponibiliza_info + self.in_disponibiliza_info_usuario_comum = in_disponibiliza_info_usuario_comum + self.dt_registro = dt_registro + + def __repr__(self): + """ + Metodo que passa a lista de parametros da classe + """ + return ""\ + % (self.id_aplicativo, + self.id_so, + self.nm_aplicativo, + self.cs_car_inst_w9x, + self.te_car_inst_w9x, + self.cs_car_ver_w9x, + self.te_car_ver_w9x, + self.cs_car_inst_wnt, + self.te_car_inst_wnt, + self.cs_car_ver_wnt, + self.te_car_ver_wnt, + self.cs_ide_licenca, + self.te_ide_licenca, + self.dt_atualizacao, + self.te_arq_ver_eng_w9x, + self.te_arq_ver_pat_w9x, + self.te_arq_ver_eng_wnt, + self.te_arq_ver_pat_wnt, + self.te_dir_padrao_w9x, + self.te_dir_padrao_wnt, + self.te_descritivo, + self.in_disponibiliza_info, + self.in_disponibiliza_info_usuario_comum, + self.dt_registro + ) + + +class AplicativoContextFactory(SQLAlchemyORMContext): + entity = Aplicativo + + def session_factory(self): + return session + +aplicativo = Table('aplicativo', Base.metadata, + Column('id_aplicativo', Integer, primary_key=True, + nullable=False), + Column('id_so', Integer, ForeignKey('so.id_so')), + Column('nm_aplicativo', String(100), nullable=False), + Column('cs_car_inst_w9x', String(2)), + Column('te_car_inst_w9x', String(255)), + Column('cs_car_ver_w9x', String(2)), + Column('te_car_ver_w9x', String(255)), + Column('cs_car_inst_wnt', String(2)), + Column('te_car_inst_wnt', String(255)), + Column('cs_car_ver_wnt', String(2)), + Column('te_car_ver_wnt', String(255)), + Column('cs_ide_licenca', String(2)), + Column('te_ide_licenca', String(255)), + Column('dt_atualizacao', DateTime(timezone=False)), + Column('te_arq_ver_eng_w9x', String(100)), + Column('te_arq_ver_pat_w9x', String(100)), + Column('te_arq_ver_eng_wnt', String(100)), + Column('te_arq_ver_pat_wnt', String(100)), + Column('te_dir_padrao_w9x', String(100)), + Column('te_dir_padrao_wnt', String(100)), + Column('te_descritivo', String), + Column('in_disponibiliza_info', String(1), nullable=False), + Column('in_disponibiliza_info_usuario_comum', String(1), + nullable=False), + Column('dt_registro', DateTime(timezone=False)), + extend_existing=True + ) + +mapper(Aplicativo, aplicativo) diff --git a/wscserver/model/AplicativoRede.py b/wscserver/model/AplicativoRede.py new file mode 100644 index 0000000..f5a0188 --- /dev/null +++ b/wscserver/model/AplicativoRede.py @@ -0,0 +1,53 @@ +from pyramid_restler.model import SQLAlchemyORMContext + +from sqlalchemy import Table, ForeignKey +from sqlalchemy.orm import mapper +from sqlalchemy.schema import Column +from sqlalchemy.types import * +from wscserver.model import Base, session + + +class AplicativoRede(): + + """ + Classe que define a tabela 'aplicativo_rede' + + """ + + __tablename__ = 'aplicativo_rede' + id_rede = Column(Integer, ForeignKey('rede.id_rede'), primary_key=True) + id_aplicativo = Column(Integer, ForeignKey('aplicativo.id_aplicativo'), + primary_key=True) + + def __init__(self, id_rede, id_aplicativo): + """ + Metodo que chama as colunas + """ + self.id_rede = id_rede + self.id_aplicativo = id_aplicativo + + def __repr__(self): + """ + Metodo que passa a lista de parametros da classe + """ + return "" % (self.id_rede, + self.id_aplicativo + ) + + +class AplicativoRedeContextFactory(SQLAlchemyORMContext): + entity = AplicativoRede + + def session_factory(self): + return session + +aplicativo_rede = Table('aplicativoRede', Base.metadata, + Column('id_rede', Integer, ForeignKey('rede.id_rede'), + primary_key=True), + Column('id_aplicativo', Integer, + ForeignKey('aplicativo.id_aplicativo'), + primary_key=True), + extend_existing=True + ) + +mapper(AplicativoRede, aplicativo_rede) diff --git a/wscserver/model/Coleta.py b/wscserver/model/Coleta.py new file mode 100644 index 0000000..3e4ea6e --- /dev/null +++ b/wscserver/model/Coleta.py @@ -0,0 +1,91 @@ +from pyramid_restler.model import SQLAlchemyORMContext + +from sqlalchemy.ext.declarative import declarative_base +from sqlalchemy.orm import column_property, mapper, join +from sqlalchemy.schema import ForeignKey, Column, Table +from sqlalchemy.types import * + +from wscserver.model import Base, session + + +computador_coleta_historico = Table( + 'computador_coleta_historico', Base.metadata, + Column('id_computador_coleta_historico', + Integer, primary_key=True, nullable=False), + Column('id_computador_coleta', Integer, + ForeignKey('computador_coleta.id_computador_coleta')), + Column('dt_hr_inclusao', DateTime(timezone=False), nullable=False) +) + +computador_coleta = Table('computador_coleta', Base.metadata, + Column('id_computador_coleta', Integer, + primary_key=True, nullable=False), + Column('id_computador', Integer), + Column('id_class_property', Integer, + ForeignKey( + 'class_property.id_class_property')), + Column('te_class_property_value', + String, nullable=False), + ) + +class_property = Table('class_property', Base.metadata, + Column('id_class_property', Integer, nullable=False), + Column('id_class', Integer, + ForeignKey('classe.id_class')), + Column('nm_property_name', String, nullable=False), + ) + +classe = Table('classe', Base.metadata, + Column('id_class', Integer, primary_key=True, nullable=False), + Column('nm_class_name', String, nullable=False), + ) + + +classe_and_class_property = join(classe, class_property) +pc_coleta_and_classe_and_class_property = join( + computador_coleta, classe_and_class_property) +coleta = join(computador_coleta_historico, + pc_coleta_and_classe_and_class_property) + + +class ClasseAndClassProperty(Base): + + """Classe de join entre 'classe' e 'class_property'""" + __table__ = classe_and_class_property + id_class = column_property(classe.c.id_class, class_property.c.id_class) + + +class PcColetaAndClasseAndClassProperty(Base): + + """ + Classe de join entre 'computador_coleta' e + 'classe_and_class_property' + """ + __table__ = pc_coleta_and_classe_and_class_property + id_class = column_property(classe.c.id_class, class_property.c.id_class) + id_computador_coleta = column_property( + computador_coleta.c.id_computador_coleta, + computador_coleta_historico.c.id_computador_coleta) + id_class_property = column_property(class_property.c.id_class_property, + computador_coleta.c.id_class_property) + + +class Coleta(Base): + + """Classe de join entre as quatro tabelas""" + __table__ = coleta + id_class = column_property(classe.c.id_class, class_property.c.id_class) + id_class_property = column_property(class_property.c.id_class_property, + computador_coleta.c.id_class_property) + id_computador_coleta = column_property( + computador_coleta.c.id_computador_coleta, + computador_coleta_historico.c.id_computador_coleta) + + +class ColetaContextFactory(SQLAlchemyORMContext): + entity = Coleta + + def session_factory(self): + return session + +# mapper(Coleta, coleta) diff --git a/wscserver/model/Computador.py b/wscserver/model/Computador.py new file mode 100644 index 0000000..64530c2 --- /dev/null +++ b/wscserver/model/Computador.py @@ -0,0 +1,129 @@ +from pyramid_restler.model import SQLAlchemyORMContext + +from sqlalchemy import Table, ForeignKey +from sqlalchemy.orm import mapper +from sqlalchemy.schema import Column +from sqlalchemy.types import * +from wscserver.model import Base, session + + +class Computador(): + + """ + Classe que define a tabela 'computador' + + """ + __tablename__ = 'computador' + id_computador = Column(Integer, primary_key=True, nullable=False) + id_usuario_exclusao = Column(Integer) + id_so = Column(Integer, ForeignKey('so.id_so')) + id_rede = Column(Integer, ForeignKey('rede.id_rede')) + nm_computador = Column(String(50)) + te_node_address = Column(String(17), nullable=False) + te_ip_computador = Column(String(15)) + dt_hr_inclusao = Column(DateTime(timezone=False)) + dt_hr_exclusao = Column(DateTime(timezone=False)) + dt_hr_ult_acesso = Column(DateTime(timezone=False)) + te_versao_cacic = Column(String(15)) + te_versao_gercols = Column(String(15)) + te_palavra_chave = Column(String(30), nullable=False) + dt_hr_coleta_forcada_estacao = Column(DateTime(timezone=False)) + te_nomes_curtos_modulos = Column(String(255)) + id_conta = Column(Integer) + te_debugging = Column(String) + te_ultimo_login = Column(String(100)) + dt_debug = Column(String(8)) + + def __init__(self, id_computador, id_usuario_exclusao, id_so, id_rede, + nm_computador, te_node_address, te_ip_computador, + dt_hr_inclusao, dt_hr_exclusao, dt_hr_ultimo_acesso, + te_versao_cacic, te_versao_gercols, te_palavra_chave, + dt_hr_coleta_forcada_estacao, te_nomes_curtos_modulos, + id_conta, te_debugging, te_ultimo_login, dt_debug): + """ + Metodo que chama as colunas + """ + self.id_computador = id_computador + self.id_usuario_exclusao = id_usuario_exclusao + self.id_so = id_so + self.id_rede = id_rede + self.nm_computador = nm_computador + self.te_node_address = te_node_address + self.te_ip_computador = te_ip_computador + self.dt_hr_inclusao = dt_hr_inclusao + self.dt_hr_exclusao = dt_hr_exclusao + self.dt_hr_ult_acesso = dt_hr_ult_acesso + self.te_versao_cacic = te_versao_cacic + self.te_versao_gercols = te_versao_gercols + self.te_palavra_chave = te_palavra_chave + self.dt_hr_coleta_forcada_estacao = dt_hr_coleta_forcada_estacao + self.te_nomes_curtos_modulos = te_nomes_curtos_modulos + self.id_conta = id_conta + self.te_debugging = te_debugging + self.te_ultimo_login = te_ultimo_login + self.dt_debug = dt_debug + + def __repr__(self, id_computador, id_usuario_exclusao, id_so, id_rede, + nm_computador, te_node_address, te_ip_computador, + dt_hr_inclusao, dt_hr_exclusao, dt_hr_ult_acesso, + te_versao_cacic, te_versao_gercols, te_palavra_chave, + dt_hr_coleta_forcada_estacao, te_nomes_curtos_modulos, + id_conta, te_debugging, te_ultimo_login, dt_debug): + """ + Metodo que passa a lista de parametros da classe + """ + return "" %\ + (self.id_computador, + self.id_usuario_exclusao, + self.id_so, + self.id_rede, + self.nm_computador, + self.te_node_address, + self.te_ip_computador, + self.dt_hr_inclusao, + self.dt_hr_exclusao, + self.dt_hr_ult_acesso, + self.te_versao_cacic, + self.te_versao_gercols, + self.te_palavra_chave, + self.dt_hr_coleta_forcada_estacao, + self.te_nomes_curtos_modulos, + self.id_conta, + self.te_debugging, + self.te_ultimo_login, + self.dt_debug + ) + + +class ComputadorContextFactory(SQLAlchemyORMContext): + entity = Computador + + def session_factory(self): + return session + +computador = Table('computador', Base.metadata, + Column('id_computador', Integer, primary_key=True, + nullable=False), + Column('id_usuario_exclusao', Integer), + Column('id_so', Integer, ForeignKey('so.id_so')), + Column('id_rede', Integer, ForeignKey('rede.id_rede')), + Column('nm_computador', String(50)), + Column('te_node_address', String(17), nullable=False), + Column('te_ip_computador', String(15)), + Column('dt_hr_inclusao', DateTime(timezone=False)), + Column('dt_hr_exclusao', DateTime(timezone=False)), + Column('dt_hr_ult_acesso', DateTime(timezone=False)), + Column('te_versao_cacic', String(15)), + Column('te_versao_gercols', String(15)), + Column('te_palavra_chave', String(30), nullable=False), + Column('dt_hr_coleta_forcada_estacao', + DateTime(timezone=False)), + Column('te_nomes_curtos_modulos', String(255)), + Column('id_conta', Integer), + Column('te_debugging', String), + Column('te_ultimo_login', String(100)), + Column('dt_debug', String(8)), + extend_existing=True + ) +mapper(Computador, computador) diff --git a/wscserver/model/ComputadorColeta.py b/wscserver/model/ComputadorColeta.py new file mode 100644 index 0000000..39e4840 --- /dev/null +++ b/wscserver/model/ComputadorColeta.py @@ -0,0 +1,61 @@ +from pyramid_restler.model import SQLAlchemyORMContext + +from sqlalchemy import Table, ForeignKey +from sqlalchemy.orm import mapper +from sqlalchemy.schema import Column +from sqlalchemy.types import * +from wscserver.model import Base, session + + +class ComputadorColeta(): + + """ + Classe que define a tabela 'computador_coleta' + + """ + + __tablename__ = 'computador_coleta' + id_computador_coleta = Column(Integer, primary_key=True, nullable=False) + id_computador = Column(Integer, ForeignKey('computador.id_computador')) + id_class = Column(Integer) + te_class_values = Column(String, nullable=False) + + def __init__(self, id_computador_coleta, id_computador, id_class, + te_class_values, dt_hr_inclusao): + """ + Metodo que chama as colunas + """ + self.id_computador_coleta = id_computador_coleta + self.id_computador = id_computador + self.id_class = id_class + self.te_class_values = te_class_values + + def __repr__(self): + """ + Metodo que passa a lista de parametros da classe + """ + return "" %\ + (self.id_computador_coleta, + self.id_computador, + self.id_class, + self.te_class_values + ) + + +class ComputadorColetaContextFactory(SQLAlchemyORMContext): + entity = ComputadorColeta + + def session_factory(self): + return session + +computador_coleta = Table('computador_coleta', Base.metadata, + Column('id_computador_coleta', Integer, + primary_key=True, nullable=False), + Column('id_computador', Integer, + ForeignKey('computador.id_computador')), + Column('id_class', Integer), + Column('te_class_values', String, nullable=False), + extend_existing=True + ) + +mapper(ComputadorColeta, computador_coleta) diff --git a/wscserver/model/ComputadorColetaHistorico.py b/wscserver/model/ComputadorColetaHistorico.py new file mode 100644 index 0000000..c2a8dcd --- /dev/null +++ b/wscserver/model/ComputadorColetaHistorico.py @@ -0,0 +1,72 @@ +from pyramid_restler.model import SQLAlchemyORMContext + +from sqlalchemy import Table, ForeignKey +from sqlalchemy.orm import mapper +from sqlalchemy.schema import Column +from sqlalchemy.types import * +from wscserver.model import Base, session + + +class ComputadorColetaHistorico(): + + """ + Classe que define a tabela 'computador_coleta_historico' + + """ + __tablename__ = 'computador_coleta_historico' + id_computador_coleta_historico = Column(Integer, primary_key=True, + nullable=False) + id_computador_coleta = Column( + Integer, ForeignKey('computador_coleta.id_computador_coleta')) + id_computador = Column(Integer, ForeignKey('computador.id_computador')) + id_class_property = Column(Integer) + te_class_property_value = Column(String, nullable=False) + dt_hr_inclusao = Column(DateTime(timezone=False)) + + def __init__(self, id_computador_coleta_historico, id_computador_coleta, + id_computador, id_class_property, te_class_property_values, + dt_hr_inclusao): + """ + Metodo que chama as colunas + """ + self.id_computador_coleta_historico = id_computador_coleta_historico + self.id_computador_coleta = id_computador_coleta + self.id_computador = id_computador + self.id_class_property = id_class_property + self.te_class_property_value = te_class_property_value + self.dt_hr_inclusao = dt_hr_inclusao + + def __repr__(self): + """ + Metodo que passa a lista de parametros da classe + """ + return "" %\ + (self.id_computador_coleta_historico, + self.id_computador_coleta, + self.id_computador, + self.id_class_property, + self.te_class_property_value, + self.dt_hr_inclusao + ) + + +class ComputadorColetaHistoricoContextFactory(SQLAlchemyORMContext): + entity = ComputadorColetaHistorico + + def session_factory(self): + return session + +computador_coleta_historico = Table( + 'computador_coleta_historico', Base.metadata, + Column('id_computador_coleta_historico', Integer, primary_key=True, + nullable=False), + Column('id_computador_coleta', Integer, ForeignKey( + 'computador_coleta.id_computador_coleta')), + Column('id_computador', Integer, ForeignKey('computador.id_computador')), + Column('id_class_property', Integer), + Column('te_class_property_value', String, nullable=False), + Column('dt_hr_inclusao', DateTime(timezone=False)), + extend_existing=True +) + +mapper(ComputadorColetaHistorico, computador_coleta_historico) diff --git a/wscserver/model/DescricaoColunaComputador.py b/wscserver/model/DescricaoColunaComputador.py new file mode 100644 index 0000000..8f4179c --- /dev/null +++ b/wscserver/model/DescricaoColunaComputador.py @@ -0,0 +1,63 @@ +from pyramid_restler.model import SQLAlchemyORMContext + +from sqlalchemy import Table +from sqlalchemy.orm import mapper +from sqlalchemy.schema import Column +from sqlalchemy.types import * +from wscserver.model import Base, session + + +class DescricaoColunaComputador(): + + """ + Classe que define a tabela 'descricao_coluna_computador' + + """ + + __tablename__ = 'descricao_coluna_computador' + te_source = Column(String(100), primary_key=True, nullable=False) + te_target = Column(String(100), primary_key=True, nullable=False) + te_description = Column(String(100), nullable=False) + cs_condicao_pesquisa = Column(String(1), nullable=False) + + def __init__(self, te_source, te_target, te_description, + cs_condicao_pesquisa): + """ + Metodo que chama as colunas + """ + self.te_source = te_source + self.te_target = te_target + self.te_description = te_description + self.cs_condicao_pesquisa = cs_condicao_pesquisa + + def __repr__(self): + """ + Metodo que passa a lista de parametros da classe + """ + return "" %\ + (self.te_source, + self.te_target, + self.te_description, + self.cs_condicao_pesquisa + ) + + +class DescricaoColunaComputadorContextFactory(SQLAlchemyORMContext): + entity = DescricaoColunaComputador + + def session_factory(self): + return session + +descricao_coluna_computador = Table( + 'descricao_coluna_computador', Base.metadata, + Column('te_source', String(100), + primary_key=True, nullable=False), + Column('te_target', String(100), + primary_key=True, nullable=False), + Column('te_description', String(100), + nullable=False), + Column('cs_condicao_pesquisa', String(1), + nullable=False), + extend_existing=True +) +mapper(DescricaoColunaComputador, descricao_coluna_computador) diff --git a/wscserver/model/Patrimonio.py b/wscserver/model/Patrimonio.py new file mode 100644 index 0000000..1be331e --- /dev/null +++ b/wscserver/model/Patrimonio.py @@ -0,0 +1,107 @@ +from pyramid_restler.model import SQLAlchemyORMContext + +from sqlalchemy import Table, ForeignKey +from sqlalchemy.orm import mapper +from sqlalchemy.schema import Column +from sqlalchemy.types import * +from wscserver.model import Base, session + + +class Patrimonio(): + + """ + Classe que define a tabela 'patrimonio' + + """ + + __tablename__ = 'patrimonio' + id_patrimonio = Column(Integer, primary_key=True, nullable=False) + id_usuario = Column(Integer) + id_unid_organizacional_nivel1a = Column(Integer) + id_computador = Column(Integer, ForeignKey('computador.id_computador')) + id_unid_organizacional_nivel2 = Column(Integer) + dt_hr_alteracao = Column(DateTime(timezone=False)) + te_localizacao_complementar = Column(String(100)) + te_info_patrimonio1 = Column(String(20)) + te_info_patrimonio2 = Column(String(20)) + te_info_patrimonio3 = Column(String(20)) + te_info_patrimonio4 = Column(String(20)) + te_info_patrimonio5 = Column(String(20)) + te_info_patrimonio6 = Column(String(20)) + id_unid_organizacional_nivel1 = Column(Integer, nullable=False) + + def __init__(self, id_patrimonio, id_usuario, + id_unid_organizacional_nivel1a, id_computador, + id_unid_organizacional_nivel2, dt_hr_alteracao, + te_localizacao_complementar, te_info_patrimonio1, + te_info_patrimonio2, te_info_patrimonio3, + te_info_patrimonio4, te_info_patrimonio5, + te_info_patrimonio6, id_unid_organizacional_nivel1): + """ + Metodo que chama as colunas + """ + self.id_patrimonio = id_patrimonio + self.id_usuario = id_usuario + self.id_unid_organizacional_nivel1a = id_unid_organizacional_nivel1a + self.id_computador = id_computador + self.id_unid_organizacional_nivel2 = id_unid_organizacional_nivel2 + self.dt_hr_alteracao = dt_hr_alteracao + self.te_localizacao_complementar = te_localizacao_complementar + self.te_info_patrimonio1 = te_info_patrimonio1 + self.te_info_patrimonio2 = te_info_patrimonio2 + self.te_info_patrimonio3 = te_info_patrimonio3 + self.te_info_patrimonio4 = te_info_patrimonio4 + self.te_info_patrimonio5 = te_info_patrimonio5 + self.te_info_patrimonio6 = te_info_patrimonio6 + self.id_unid_organizacional_nivel1 = id_unid_organizacional_nivel1 + + def __repr__(self): + """ + Metodo que passa a lista de parametros da classe + """ + return "" % (self.id_patrimonio, + self.id_usuario, + self.id_unid_organizacional_nivel1a, + self.id_computador, + self.id_unid_organizacional_nivel2, + self.dt_hr_alteracao, + self.te_localizacao_complementar, + self.te_info_patrimonio1, + self.te_info_patrimonio2, + self.te_info_patrimonio3, + self.te_info_patrimonio4, + self.te_info_patrimonio5, + self.te_info_patrimonio6, + self.id_unid_organizacional_nivel1 + ) + + +class PatrimonioContextFactory(SQLAlchemyORMContext): + entity = Patrimonio + + def session_factory(self): + return session + +patrimonio = Table('patrimonio', Base.metadata, + Column('id_patrimonio', Integer, primary_key=True, + nullable=False), + Column('id_usuario', Integer), + Column('id_unid_organizacional_nivel1a', Integer), + Column('id_computador', Integer, + ForeignKey('computador.id_computador')), + Column('id_unid_organizacional_nivel2', Integer), + Column('dt_hr_alteracao', DateTime(timezone=False)), + Column('te_localizacao_complementar', String(100)), + Column('te_info_patrimonio1', String(20)), + Column('te_info_patrimonio2', String(20)), + Column('te_info_patrimonio3', String(20)), + Column('te_info_patrimonio4', String(20)), + Column('te_info_patrimonio5', String(20)), + Column('te_info_patrimonio6', String(20)), + Column('id_unid_organizacional_nivel1', + Integer, nullable=False), + extend_existing=True + ) + +mapper(Patrimonio, patrimonio) diff --git a/wscserver/model/Rede.py b/wscserver/model/Rede.py new file mode 100644 index 0000000..2288621 --- /dev/null +++ b/wscserver/model/Rede.py @@ -0,0 +1,159 @@ +from pyramid_restler.model import SQLAlchemyORMContext + +from sqlalchemy import Table +from sqlalchemy.orm import mapper +from sqlalchemy.schema import Column +from sqlalchemy.types import * +from wscserver.model import Base, session +from sqlalchemy.orm import relationship, backref +from sqlalchemy.ext.declarative import declarative_base + + +class Rede(): + + """ + Classe que define a tabela 'rede' + + """ + + __tablename__ = 'rede' + id_rede = Column(Integer, primary_key=True, nullable=False) + id_local = Column(Integer) + id_servidor_autenticacao = Column(Integer) + te_ip_rede = Column(String(15), nullable=False) + nm_rede = Column(String(100)) + te_observacao = Column(String(100)) + nm_pessoa_contato1 = Column(String(50)) + nm_pessoa_contato2 = Column(String(50)) + nu_telefone1 = Column(String(11)) + te_email_contato2 = Column(String(50)) + nu_telefone2 = Column(String(11)) + te_email_contato1 = Column(String(50)) + te_serv_cacic = Column(String(60), nullable=False) + te_serv_updates = Column(String(60), nullable=False) + te_path_serv_updates = Column(String(255)) + nm_usuario_login_serv_updates = Column(String(20)) + te_senha_login_serv_updates = Column(String(20)) + nu_porta_serv_updates = Column(String(4)) + te_mascara_rede = Column(String(15)) + dt_verifica_updates = Column(DateTime) + nm_usuario_login_serv_updates_gerente = Column(String(20)) + te_senha_login_serv_updates_gerente = Column(String(20)) + nu_limite_ftp = Column(Integer, nullable=False) + cs_permitir_desativar_srcacic = Column(String(1), nullable=False) + te_debugging = Column(String) + dt_debug = Column(String(8)) + + def __init__(self, id_rede, id_local, id_servidor_autenticacao, + te_ip_rede, nm_rede, te_observacao, nm_pessoa_contato1, + nm_pessoa_contato2, nu_telefone1, te_email_contato2, + nu_telefone2, te_email_contato1, te_serv_cacic, + te_serv_updates, te_path_serv_updates, + nm_usuario_login_serv_updates, te_senha_login_serv_updates, + nu_porta_serv_updates, te_mascara_rede, dt_verifica_updates, + nm_usuario_login_serv_updates_gerente, + te_senha_login_serv_updates_gerente, + nu_limite_ftp, cs_permitir_desativar_srcacic, te_debugging, + dt_debug): + """ + Metodo que chama as colunas + """ + self.id_rede = id_rede + self.id_local = id_local + self.id_servidor_autenticacao = id_servidor_autenticacao + self.te_ip_rede = te_ip_rede + self.nm_rede = nm_rede + self.te_observacao = te_observacao + self.nm_pessoa_contato1 = nm_pessoa_contato1 + self.nm_pessoa_contato2 = nm_pessoa_contato2 + self.nu_telefone1 = nu_telefone1 + self.te_email_contato2 = te_email_contato2 + self.nu_telefone2 = nu_telefone2 + self.te_email_contato1 = te_email_contato1 + self.te_serv_cacic = te_serv_cacic + self.te_serv_updates = te_serv_updates + self.te_path_serv_updates = te_path_serv_updates + self.nm_usuario_login_serv_updates = nm_usuario_login_serv_updates + self.te_senha_login_serv_updates = te_senha_login_serv_updates + self.nu_porta_serv_updates = nu_porta_serv_updates + self.te_mascara_rede = te_mascara_rede + self.dt_verifica_updates = dt_verifica_updates + self.nm_usuario_login_serv_updates_gerente = nm_usuario_login_serv_updates_gerente + self.te_senha_login_serv_updates_gerente = te_senha_login_serv_updates_gerente + self.nu_limite_ftp = nu_limite_ftp + self.cs_permitir_desativar_srcacic = cs_permitir_desativar_srcacic + self.te_debugging = te_debugging + self.dt_debug = dt_debug + + def __repr__(self): + """ + Metodo que passa a lista de parametros da classe + """ + return "" %\ + (self.id_rede, + self.id_local, + self.id_servidor_autenticacao, + self.te_ip_rede, + self.nm_rede, + self.te_observacao, + self.nm_pessoa_contato1, + self.nm_pessoa_contato2, + self.nu_telefone1, + self.te_email_contato2, + self.nu_telefone2, + self.te_email_contato1, + self.te_serv_cacic, + self.te_serv_updates, + self.te_path_serv_updates, + self.nm_usuario_login_serv_updates, + self.te_senha_login_serv_updates, + self.nu_porta_serv_updates, + self.te_mascara_rede, + self.dt_verifica_updates, + self.nm_usuario_login_serv_updates_gerente, + self.te_senha_login_serv_updates_gerente, + self.nu_limite_ftp, + self.cs_permitir_desativar_srcacic, + self.te_debugging, + self.dt_debug + ) + + +class RedeContextFactory(SQLAlchemyORMContext): + entity = Rede + + def session_factory(self): + return session + +rede = Table('rede', Base.metadata, + Column('id_rede', Integer, primary_key=True, nullable=False), + Column('id_local', Integer), + Column('id_servidor_autenticacao', Integer), + Column('te_ip_rede', String(15), nullable=False), + Column('nm_rede', String(100)), + Column('te_observacao', String(100)), + Column('nm_pessoa_contato1', String(50)), + Column('nm_pessoa_contato2', String(50)), + Column('te_email_contato2', String(50)), + Column('nu_telefone2', String(11)), + Column('te_email_contato1', String(50)), + Column('te_serv_cacic', String(60), nullable=False), + Column('te_serv_updates', String(60), nullable=False), + Column('te_path_serv_updates', String(255)), + Column('nm_usuario_login_serv_updates', String(20)), + Column('te_senha_login_serv_updates', String(20)), + Column('nu_porta_serv_updates', String(4)), + Column('te_mascara_rede', String(15)), + Column('dt_verifica_updates', DateTime), + Column('nm_usuario_login_serv_updates_gerente', String(20)), + Column('te_senha_login_serv_updates_gerente', String(20)), + Column('nu_limite_ftp', Integer, nullable=False), + Column('cs_permitir_desativar_srcacic', String(1), + nullable=False), + Column('te_debugging', String), + Column('dt_debug', String(8)), + extend_existing=True + ) + +mapper(Rede, rede) diff --git a/wscserver/model/So.py b/wscserver/model/So.py new file mode 100644 index 0000000..cc8ec55 --- /dev/null +++ b/wscserver/model/So.py @@ -0,0 +1,58 @@ +from pyramid_restler.model import SQLAlchemyORMContext + +from sqlalchemy import Table +from sqlalchemy.orm import mapper +from sqlalchemy.schema import Column +from sqlalchemy.types import * +from wscserver.model import Base, session + + +class So(): + + """ + Classe que define a tabela 'so' + + """ + __tablename__ = 'so' + id_so = Column(Integer, primary_key=True, nullable=False) + te_desc_so = Column(String(255)) + sg_so = Column(String(20)) + te_so = Column(String(50), nullable=False) + in_mswindows = Column(String(1), nullable=False) + + def __init__(self, id_so, te_desc_so, sg_so, te_so, in_mswindows): + """ + Metodo que chama as colunas + """ + self.id_so = id_so + self.te_desc_so = te_desc_so + self.sg_so = sg_so + self.te_so = te_so + self.in_mswindows = in_mswindows + + def __repr__(self): + """ + Metodo que passa a lista de parametros da classe + """ + return "" % (self.id_so, self.te_desc_so, + self.sg_so, self.te_so, + self.in_mswindows + ) + + +class SoContextFactory(SQLAlchemyORMContext): + entity = So + + def session_factory(self): + return session + +so = Table('so', Base.metadata, + Column('id_so', Integer, primary_key=True, nullable=False), + Column('te_desc_so', String(255)), + Column('sg_so', String(20)), + Column('te_so', String(50), nullable=False), + Column('in_mswindows', String(1), nullable=False), + extend_existing=True + ) + +mapper(So, so) diff --git a/wscserver/model/Software.py b/wscserver/model/Software.py new file mode 100644 index 0000000..112aea6 --- /dev/null +++ b/wscserver/model/Software.py @@ -0,0 +1,77 @@ +from pyramid_restler.model import SQLAlchemyORMContext + +from sqlalchemy import Table +from sqlalchemy.orm import mapper +from sqlalchemy.schema import Column +from sqlalchemy.types import * +from wscserver.model import Base, session + + +class Software(): + + """ + Classe que define a tabela 'software' + + """ + + __tablename__ = 'software' + id_software = Column(Integer, primary_key=True, nullable=False) + id_tipo_software = Column(Integer) + nm_software = Column(String(150), nullable=False) + te_descricao_software = Column(String(255)) + qt_licenca = Column(Integer) + nr_midia = Column(String(10)) + te_local_midia = Column(String(30)) + te_obs = Column(String(200)) + + def __init__(self, id_software, id_tipo_software, nm_software, + te_descricao_software, qt_licenca, nr_midia, te_local_midia, + te_obs): + """ + Metodo que chama as colunas + """ + self.id_software = id_software + self.id_tipo_software = id_tipo_software + self.nm_software = nm_software + self.te_descricao_software = te_descricao_software + self.qt_licenca = qt_licenca + self.nr_midia = nr_midia + self.te_local_midia = te_local_midia + self.te_obs = te_obs + + def __repr__(self): + """ + Metodo que passa a lista de parametros da classe + """ + return "" % (self.id_software, + self.id_tipo_software, + self.nm_software, + self.te_descricao_software, + self.qt_licenca, + self.nr_midia, + self.te_local_midia, + self.te_obs + ) + + +class SoftwareContextFactory(SQLAlchemyORMContext): + entity = Software + + def session_factory(self): + return session + +software = Table('software', Base.metadata, + Column('id_software', Integer, primary_key=True, + nullable=False), + Column('id_tipo_software', Integer), + Column('nm_software', String(150), nullable=False), + Column('te_descricao_software', String(255)), + Column('qt_licenca', Integer), + Column('nr_midia', String(10)), + Column('te_local_midia', String(30)), + Column('te_obs', String(200)), + extend_existing=True + ) + +mapper(Software, software) diff --git a/wscserver/model/SoftwareEstacao.py b/wscserver/model/SoftwareEstacao.py new file mode 100644 index 0000000..cbd5863 --- /dev/null +++ b/wscserver/model/SoftwareEstacao.py @@ -0,0 +1,88 @@ +from pyramid_restler.model import SQLAlchemyORMContext + +from sqlalchemy import Table, ForeignKey +from sqlalchemy.orm import mapper +from sqlalchemy.schema import Column +from sqlalchemy.types import * +from wscserver.model import Base, session + + +class SoftwareEstacao(): + + """ + Classe que define a tabela 'software_estacao' + + """ + + __tablename__ = 'software_estacao' + id_computador = Column(Integer, ForeignKey('computador.id_computador')) + id_software = Column(Integer, ForeignKey('software.id_software')) + id_aquisicao = Column(Integer) + nr_patrimonio = Column(String(20), primary_key=True, nullable=False) + dt_autorizacao = Column(DateTime) + dt_expiracao_instalacao = Column(DateTime) + id_aquisicao_particular = Column(Integer) + dt_desinstalacao = Column(DateTime) + te_observacao = Column(String(90)) + nr_patr_destino = Column(String(20)) + + def __init__(self, id_computador, id_software, id_aquisicao, + nr_patrimonio, dt_autorizacao, dt_expiracao_instalacao, + id_aquisicao_particular, dt_desinstalacao, te_observacao, + nr_patr_destino): + """ + Metodo que chama as colunas + """ + self.id_computador = id_computador + self.id_software = id_software + self.id_aquisicao = id_aquisicao + self.nr_patrimonio = nr_patrimonio + self.dt_autorizacao = dt_autorizacao + self.dt_expiracao_instalacao = dt_expiracao_instalacao + self.id_aquisicao_particular = id_aquisicao_particular + self.dt_desinstalacao = dt_desinstalacao + self.te_observacao = te_observacao + self.nr_patr_destino = nr_patr_destino + + def __repr__(self): + """ + Metodo que passa a lista de parametros da classe + """ + return "" % (self.id_computador, + self.id_software, + self.id_aquisicao, + self.nr_patrimonio, + self.dt_autorizacao, + self.dt_expiracao_instalacao, + self.id_aquisicao_particular, + self.dt_desinstalacao, + self.te_observacao, + self.nr_patr_destino + ) + + +class SoftwareEstacaoContextFactory(SQLAlchemyORMContext): + entity = SoftwareEstacao + + def session_factory(self): + return session + +software_estacao = Table('software_estacao', Base.metadata, + Column('id_computador', Integer, + ForeignKey('computador.id_computador')), + Column('id_software', Integer, + ForeignKey('software.id_software')), + Column('id_aquisicao', Integer), + Column('nr_patrimonio', String(20), + primary_key=True, nullable=False), + Column('dt_autorizacao', Date), + Column('dt_expiracao_instalacao', Date), + Column('id_aquisicao_particular', Integer), + Column('dt_desinstalacao', Date), + Column('te_observacao', String(90)), + Column('nr_patr_destino', String(20)), + extend_existing=True + ) + +mapper(SoftwareEstacao, software_estacao) diff --git a/wscserver/model/TipoSoftware.py b/wscserver/model/TipoSoftware.py new file mode 100644 index 0000000..3d3818d --- /dev/null +++ b/wscserver/model/TipoSoftware.py @@ -0,0 +1,50 @@ +from pyramid_restler.model import SQLAlchemyORMContext + +from sqlalchemy import Table +from sqlalchemy.orm import mapper +from sqlalchemy.schema import Column +from sqlalchemy.types import * +from wscserver.model import Base, session + + +class TipoSoftware(): + + """ + Classe que define a tabela 'tipo_software' + + """ + __tablename__ = 'tipo_software' + id_tipo_software = Column(Integer, primary_key=True, nullable=False) + te_descricao_tipo_software = Column(String(30), nullable=False) + + def __init__(self, id_tipo_software, te_descricao_tipo_software): + """ + Metodo que chama as colunas + """ + self.id_tipo_software = id_tipo_software + self.te_descricao_tipo_software = te_descricao_tipo_software + + def __repr__(self): + """ + Metodo que passa a lista de parametros da classe + """ + return "" % (self.id_tipo_software, + self.te_descricao_tipo_software + ) + + +class TipoSoftwareContextFactory(SQLAlchemyORMContext): + entity = TipoSoftware + + def session_factory(self): + return session + +tipo_software = Table('tipo_software', Base.metadata, + Column('id_tipo_software', Integer, primary_key=True, + nullable=False), + Column('te_descricao_tipo_software', String(30), + nullable=False), + extend_existing=True + ) + +mapper(TipoSoftware, tipo_software) diff --git a/wscserver/model/__init__.py b/wscserver/model/__init__.py new file mode 100644 index 0000000..b112970 --- /dev/null +++ b/wscserver/model/__init__.py @@ -0,0 +1,19 @@ +# from sqlalchemy import engine_from_config +from sqlalchemy.ext.declarative import declarative_base +from sqlalchemy.orm import scoped_session, sessionmaker +from sqlalchemy.engine import create_engine +from pyramid import config +from paste.deploy.loadwsgi import appconfig + +sqlalchemy_url = 'postgresql://rest:rest@localhost/cacic' +DBSession = scoped_session(sessionmaker()) +Base = declarative_base() +engine = create_engine(sqlalchemy_url) +Session = sessionmaker(bind=engine) +session = Session() + + +def initialize_sql(engine): + DBSession.configure(bind=engine) + Base.metadata.bind = engine + # Base.metadata.create_all(engine) diff --git a/wscserver/scripts/__init__.py b/wscserver/scripts/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/wscserver/scripts/__init__.py diff --git a/wscserver/scripts/createzip.py b/wscserver/scripts/createzip.py new file mode 100644 index 0000000..f5bb615 --- /dev/null +++ b/wscserver/scripts/createzip.py @@ -0,0 +1,20 @@ +import zipfile +import tempfile +import requests +import os + +def zipcoleta(): + """Recebe o json da coleta em um arquivo e zipa""" + coleta = requests.get('http://localhost/wscserver/rest/coleta') + + path = tempfile.gettempdir() + os.chdir(path) + f = open('coleta.json','w') + f.write(coleta.text) + arquivozip = 'coleta.zip' + with zipfile.ZipFile(arquivozip, 'w') as myzip: + myzip.write(f.name) + f.close() + os.remove('coleta.json') + filepath = os.path.abspath(arquivozip) + return filepath diff --git a/wscserver/static/favicon.ico b/wscserver/static/favicon.ico new file mode 100644 index 0000000..71f837c Binary files /dev/null and b/wscserver/static/favicon.ico differ diff --git a/wscserver/static/footerbg.png b/wscserver/static/footerbg.png new file mode 100644 index 0000000..1fbc873 Binary files /dev/null and b/wscserver/static/footerbg.png differ diff --git a/wscserver/static/headerbg.png b/wscserver/static/headerbg.png new file mode 100644 index 0000000..0596f20 Binary files /dev/null and b/wscserver/static/headerbg.png differ diff --git a/wscserver/static/ie6.css b/wscserver/static/ie6.css new file mode 100644 index 0000000..b7c8493 --- /dev/null +++ b/wscserver/static/ie6.css @@ -0,0 +1,8 @@ +* html img, +* html .png{position:relative;behavior:expression((this.runtimeStyle.behavior="none")&&(this.pngSet?this.pngSet=true:(this.nodeName == "IMG" && this.src.toLowerCase().indexOf('.png')>-1?(this.runtimeStyle.backgroundImage = "none", +this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "',sizingMethod='image')", +this.src = "static/transparent.gif"):(this.origBg = this.origBg? this.origBg :this.currentStyle.backgroundImage.toString().replace('url("','').replace('")',''), +this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.origBg + "',sizingMethod='crop')", +this.runtimeStyle.backgroundImage = "none")),this.pngSet=true) +);} +#wrap{display:table;height:100%} diff --git a/wscserver/static/json_base.json b/wscserver/static/json_base.json new file mode 100644 index 0000000..34433e9 --- /dev/null +++ b/wscserver/static/json_base.json @@ -0,0 +1,2047 @@ +{ + "metadata":{ + "doc_extract":false, + "index_export":false, + "index_url":"", + "index_time":"0", + "extract_time":"0", + "name":"wmi", + "description":"Classes de coleta WMI do cacic", + "password":"w1f1t1d1", + "color":"#2d2d2d" + }, + "content":[ + { + "group":{ + "metadata":{ + "name":"Win32_BaseBoard", + "alias":"Win32_BaseBoard", + "description":"Win32_BaseBoard", + "multivalued":false + }, + "content":[ + { + "field":{ + "name":"ConfigOptions", + "alias":"ConfigOptions", + "description":"ConfigOptions", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Description", + "alias":"Description", + "description":"Description", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"HostingBoard", + "alias":"HostingBoard", + "description":"HostingBoard", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Manufacturer", + "alias":"Manufacturer", + "description":"Manufacturer", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Name", + "alias":"Name", + "description":"Name", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Product", + "alias":"Product", + "description":"Product", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"SerialNumber", + "alias":"SerialNumber", + "description":"SerialNumber", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Tag", + "alias":"Tag", + "description":"Tag", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Version", + "alias":"Version", + "description":"Version", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + } + ] + } + }, + { + "group":{ + "metadata":{ + "name":"Win32_BIOS", + "alias":"Win32_BIOS", + "description":"Win32_BIOS", + "multivalued":false + }, + "content":[ + { + "field":{ + "name":"BiosCharacteristics", + "alias":"BiosCharacteristics", + "description":"BiosCharacteristics", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"BIOSVersion", + "alias":"BIOSVersion", + "description":"BIOSVersion", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Caption", + "alias":"Caption", + "description":"Caption", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Description", + "alias":"Description", + "description":"Description", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Manufacturer", + "alias":"Manufacturer", + "description":"Manufacturer", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Name", + "alias":"Name", + "description":"Name", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"PrimaryBIOS", + "alias":"PrimaryBIOS", + "description":"PrimaryBIOS", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"ReleaseDate", + "alias":"ReleaseDate", + "description":"ReleaseDate", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"SerialNumber", + "alias":"SerialNumber", + "description":"SerialNumber", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"SMBIOSBIOSVersion", + "alias":"SMBIOSBIOSVersion", + "description":"SMBIOSBIOSVersion", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"SMBIOSMajorVersion", + "alias":"SMBIOSMajorVersion", + "description":"SMBIOSMajorVersion", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"SMBIOSMinorVersion", + "alias":"SMBIOSMinorVersion", + "description":"SMBIOSMinorVersion", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"SoftwareElementID", + "alias":"SoftwareElementID", + "description":"SoftwareElementID", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Version", + "alias":"Version", + "description":"Version", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + } + ] + } + }, + { + "group":{ + "metadata":{ + "name":"Win32_KeyBoard", + "alias":"Win32_KeyBoard", + "description":"Win32_KeyBoard", + "multivalued":false + }, + "content":[ + { + "field":{ + "name":"Caption", + "alias":"Caption", + "description":"Caption", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Description", + "alias":"Description", + "description":"Description", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Name", + "alias":"Name", + "description":"Name", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + } + ] + } + }, + { + "group":{ + "metadata":{ + "name":"Win32_MemoryDevice", + "alias":"Win32_MemoryDevice", + "description":"Win32_MemoryDevice", + "multivalued":false + }, + "content":[ + { + "field":{ + "name":"Access", + "alias":"Access", + "description":"Access", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Availability", + "alias":"Availability", + "description":"Availability", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"BlockSize", + "alias":"BlockSize", + "description":"BlockSize", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Caption", + "alias":"Caption", + "description":"Caption", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Description", + "alias":"Description", + "description":"Description", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"DeviceID", + "alias":"DeviceID", + "description":"DeviceID", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"EndingAddress", + "alias":"EndingAddress", + "description":"EndingAddress", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"InstallDate", + "alias":"InstallDate", + "description":"InstallDate", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Name", + "alias":"Name", + "description":"Name", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"NumberOfBlocks", + "alias":"NumberOfBlocks", + "description":"NumberOfBlocks", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"PNPDeviceID", + "alias":"PNPDeviceID", + "description":"PNPDeviceID", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Purpose", + "alias":"Purpose", + "description":"Purpose", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"SystemLevelAddress", + "alias":"SystemLevelAddress", + "description":"SystemLevelAddress", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"SystemName", + "alias":"SystemName", + "description":"SystemName", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + } + ] + } + }, + { + "group":{ + "metadata":{ + "name":"Win32_PhysicalMedia", + "alias":"Win32_PhysicalMedia", + "description":"Win32_PhysicalMedia", + "multivalued":false + }, + "content":[ + { + "field":{ + "name":"Capacity", + "alias":"Capacity", + "description":"Capacity", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Caption", + "alias":"Caption", + "description":"Caption", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Description", + "alias":"Description", + "description":"Description", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"InstallDate", + "alias":"InstallDate", + "description":"InstallDate", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Manufacturer", + "alias":"Manufacturer", + "description":"Manufacturer", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"MediaDescription", + "alias":"MediaDescription", + "description":"MediaDescription", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"MediaType", + "alias":"MediaType", + "description":"MediaType", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Model", + "alias":"Model", + "description":"Model", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Name", + "alias":"Name", + "description":"Name", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"OtherIdentifyingInfo", + "alias":"OtherIdentifyingInfo", + "description":"OtherIdentifyingInfo", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"PartNumber", + "alias":"PartNumber", + "description":"PartNumber", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"SerialNumber", + "alias":"SerialNumber", + "description":"SerialNumber", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"SKU", + "alias":"SKU", + "description":"SKU", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Tag", + "alias":"Tag", + "description":"Tag", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Version", + "alias":"Version", + "description":"Version", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + } + ] + } + }, + { + "group":{ + "metadata":{ + "name":"Win32_PhysicalMemory", + "alias":"Win32_PhysicalMemory", + "description":"Win32_PhysicalMemory", + "multivalued":false + }, + "content":[ + { + "field":{ + "name":"BankLabel", + "alias":"BankLabel", + "description":"BankLabel", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Capacity", + "alias":"Capacity", + "description":"Capacity", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Caption", + "alias":"Caption", + "description":"Caption", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"DataWidth", + "alias":"DataWidth", + "description":"DataWidth", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Description", + "alias":"Description", + "description":"Description", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"DeviceLocator", + "alias":"DeviceLocator", + "description":"DeviceLocator", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"FormFactor", + "alias":"FormFactor", + "description":"FormFactor", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"InstallDate", + "alias":"InstallDate", + "description":"InstallDate", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"InterleaveDataDepth", + "alias":"InterleaveDataDepth", + "description":"InterleaveDataDepth", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"InterleavePosition", + "alias":"InterleavePosition", + "description":"InterleavePosition", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Manufacturer", + "alias":"Manufacturer", + "description":"Manufacturer", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"MemoryType", + "alias":"MemoryType", + "description":"MemoryType", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Model", + "alias":"Model", + "description":"Model", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Name", + "alias":"Name", + "description":"Name", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"OtherIdentifyingInfo", + "alias":"OtherIdentifyingInfo", + "description":"OtherIdentifyingInfo", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"PartNumber", + "alias":"PartNumber", + "description":"PartNumber", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"PositionInRow", + "alias":"PositionInRow", + "description":"PositionInRow", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"SerialNumber", + "alias":"SerialNumber", + "description":"SerialNumber", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"SKU", + "alias":"SKU", + "description":"SKU", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Speed", + "alias":"Speed", + "description":"Speed", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Tag", + "alias":"Tag", + "description":"Tag", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"TotalWidth", + "alias":"TotalWidth", + "description":"TotalWidth", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"TypeDetail", + "alias":"TypeDetail", + "description":"TypeDetail", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Version", + "alias":"Version", + "description":"Version", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + } + ] + } + }, + { + "group":{ + "metadata":{ + "name":"Win32_PointingDevice", + "alias":"Win32_PointingDevice", + "description":"Win32_PointingDevice", + "multivalued":false + }, + "content":[ + { + "field":{ + "name":"Availability", + "alias":"Availability", + "description":"Availability", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Caption", + "alias":"Caption", + "description":"Caption", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Description", + "alias":"Description", + "description":"Description", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"InstallDate", + "alias":"InstallDate", + "description":"InstallDate", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Manufacturer", + "alias":"Manufacturer", + "description":"Manufacturer", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Name", + "alias":"Name", + "description":"Name", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + } + ] + } + }, + { + "group":{ + "metadata":{ + "name":"Win32_Printer", + "alias":"Win32_Printer", + "description":"Win32_Printer", + "multivalued":false + }, + "content":[ + { + "field":{ + "name":"Attributes", + "alias":"Attributes", + "description":"Attributes", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Availability", + "alias":"Availability", + "description":"Availability", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Caption", + "alias":"Caption", + "description":"Caption", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"CharSetsSupported", + "alias":"CharSetsSupported", + "description":"CharSetsSupported", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Comment", + "alias":"Comment", + "description":"Comment", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"CurrentCharSet", + "alias":"CurrentCharSet", + "description":"CurrentCharSet", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Default", + "alias":"Default", + "description":"Default", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Description", + "alias":"Description", + "description":"Description", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"DeviceID", + "alias":"DeviceID", + "description":"DeviceID", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Direct", + "alias":"Direct", + "description":"Direct", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"DriverName", + "alias":"DriverName", + "description":"DriverName", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"HorizontalResolution", + "alias":"HorizontalResolution", + "description":"HorizontalResolution", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"InstallDate", + "alias":"InstallDate", + "description":"InstallDate", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"JobCountSinceLastReset", + "alias":"JobCountSinceLastReset", + "description":"JobCountSinceLastReset", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"KeepPrintedJobs", + "alias":"KeepPrintedJobs", + "description":"KeepPrintedJobs", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"LanguagesSupported", + "alias":"LanguagesSupported", + "description":"LanguagesSupported", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Local", + "alias":"Local", + "description":"Local", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Location", + "alias":"Location", + "description":"Location", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"MarkingTechnology", + "alias":"MarkingTechnology", + "description":"MarkingTechnology", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"MaxCopies", + "alias":"MaxCopies", + "description":"MaxCopies", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"MaxNumberUp", + "alias":"MaxNumberUp", + "description":"MaxNumberUp", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"MaxSizeSupported", + "alias":"MaxSizeSupported", + "description":"MaxSizeSupported", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"MimeTypesSupported", + "alias":"MimeTypesSupported", + "description":"MimeTypesSupported", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Name", + "alias":"Name", + "description":"Name", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Network", + "alias":"Network", + "description":"Network", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"PaperSizesSupported", + "alias":"PaperSizesSupported", + "description":"PaperSizesSupported", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"PaperTypesAvailable", + "alias":"PaperTypesAvailable", + "description":"PaperTypesAvailable", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Parameters", + "alias":"Parameters", + "description":"Parameters", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"PNPDeviceID", + "alias":"PNPDeviceID", + "description":"PNPDeviceID", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"PortName", + "alias":"PortName", + "description":"PortName", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"PrintProcessor", + "alias":"PrintProcessor", + "description":"PrintProcessor", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"ServerName", + "alias":"ServerName", + "description":"ServerName", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Shared", + "alias":"Shared", + "description":"Shared", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"ShareName", + "alias":"ShareName", + "description":"ShareName", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"SpoolEnabled", + "alias":"SpoolEnabled", + "description":"SpoolEnabled", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"SystemName", + "alias":"SystemName", + "description":"SystemName", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"VerticalResolution", + "alias":"VerticalResolution", + "description":"VerticalResolution", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"WorkOffline", + "alias":"WorkOffline", + "description":"WorkOffline", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + } + ] + } + }, + { + "group":{ + "metadata":{ + "name":"Win32_Processor", + "alias":"Win32_Processor", + "description":"Win32_Processorr", + "multivalued":false + }, + "content":[ + { + "field":{ + "name":"AddressWidth", + "alias":"AddressWidth", + "description":"AddressWidth", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Availability", + "alias":"Availability", + "description":"Availability", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Architecture", + "alias":"Architecture", + "description":"Architecture", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Caption", + "alias":"Caption", + "description":"Caption", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"DataWidth", + "alias":"DataWidth", + "description":"DataWidth", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Description", + "alias":"Description", + "description":"Description", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"DeviceID", + "alias":"DeviceID", + "description":"DeviceID", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"ExtClock", + "alias":"ExtClock", + "description":"ExtClock", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Family", + "alias":"Family", + "description":"Family", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"L2CacheSize", + "alias":"L2CacheSize", + "description":"L2CacheSize", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"L2CacheSpeed", + "alias":"L2CacheSpeed", + "description":"L2CacheSpeed", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Level", + "alias":"Level", + "description":"Level", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Manufacturer", + "alias":"Manufacturer", + "description":"Manufacturer", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"MaxClockSpeed", + "alias":"MaxClockSpeed", + "description":"MaxClockSpeed", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Name", + "alias":"Name", + "description":"Name", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"NumberOfCores", + "alias":"NumberOfCores", + "description":"NumberOfCores", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"NumberOfLogicalProcessors", + "alias":"NumberOfLogicalProcessors", + "description":"NumberOfLogicalProcessors", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"ProcessorId", + "alias":"ProcessorId", + "description":"ProcessorId", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"ProcessorType", + "alias":"ProcessorType", + "description":"ProcessorType", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Revision", + "alias":"Revision", + "description":"Revision", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Role", + "alias":"Role", + "description":"Role", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"SocketDesignation", + "alias":"SocketDesignation", + "description":"SocketDesignation", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"SystemName", + "alias":"SystemName", + "description":"SystemName", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"UpgradeMethod", + "alias":"UpgradeMethod", + "description":"UpgradeMethod", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + }, + { + "field":{ + "name":"Version", + "alias":"Version", + "description":"Version", + "datatype":"Text", + "required":false, + "multivalued":false, + "indices":[ + "Textual" + ] + } + } + ] + } + } + ] +} \ No newline at end of file diff --git a/wscserver/static/middlebg.png b/wscserver/static/middlebg.png new file mode 100644 index 0000000..2369cfb Binary files /dev/null and b/wscserver/static/middlebg.png differ diff --git a/wscserver/static/pylons.css b/wscserver/static/pylons.css new file mode 100644 index 0000000..4b1c017 --- /dev/null +++ b/wscserver/static/pylons.css @@ -0,0 +1,372 @@ +html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td +{ + margin: 0; + padding: 0; + border: 0; + outline: 0; + font-size: 100%; /* 16px */ + vertical-align: baseline; + background: transparent; +} + +body +{ + line-height: 1; +} + +ol, ul +{ + list-style: none; +} + +blockquote, q +{ + quotes: none; +} + +blockquote:before, blockquote:after, q:before, q:after +{ + content: ''; + content: none; +} + +:focus +{ + outline: 0; +} + +ins +{ + text-decoration: none; +} + +del +{ + text-decoration: line-through; +} + +table +{ + border-collapse: collapse; + border-spacing: 0; +} + +sub +{ + vertical-align: sub; + font-size: smaller; + line-height: normal; +} + +sup +{ + vertical-align: super; + font-size: smaller; + line-height: normal; +} + +ul, menu, dir +{ + display: block; + list-style-type: disc; + margin: 1em 0; + padding-left: 40px; +} + +ol +{ + display: block; + list-style-type: decimal-leading-zero; + margin: 1em 0; + padding-left: 40px; +} + +li +{ + display: list-item; +} + +ul ul, ul ol, ul dir, ul menu, ul dl, ol ul, ol ol, ol dir, ol menu, ol dl, dir ul, dir ol, dir dir, dir menu, dir dl, menu ul, menu ol, menu dir, menu menu, menu dl, dl ul, dl ol, dl dir, dl menu, dl dl +{ + margin-top: 0; + margin-bottom: 0; +} + +ol ul, ul ul, menu ul, dir ul, ol menu, ul menu, menu menu, dir menu, ol dir, ul dir, menu dir, dir dir +{ + list-style-type: circle; +} + +ol ol ul, ol ul ul, ol menu ul, ol dir ul, ol ol menu, ol ul menu, ol menu menu, ol dir menu, ol ol dir, ol ul dir, ol menu dir, ol dir dir, ul ol ul, ul ul ul, ul menu ul, ul dir ul, ul ol menu, ul ul menu, ul menu menu, ul dir menu, ul ol dir, ul ul dir, ul menu dir, ul dir dir, menu ol ul, menu ul ul, menu menu ul, menu dir ul, menu ol menu, menu ul menu, menu menu menu, menu dir menu, menu ol dir, menu ul dir, menu menu dir, menu dir dir, dir ol ul, dir ul ul, dir menu ul, dir dir ul, dir ol menu, dir ul menu, dir menu menu, dir dir menu, dir ol dir, dir ul dir, dir menu dir, dir dir dir +{ + list-style-type: square; +} + +.hidden +{ + display: none; +} + +p +{ + line-height: 1.5em; +} + +h1 +{ + font-size: 1.75em; + line-height: 1.7em; + font-family: helvetica, verdana; +} + +h2 +{ + font-size: 1.5em; + line-height: 1.7em; + font-family: helvetica, verdana; +} + +h3 +{ + font-size: 1.25em; + line-height: 1.7em; + font-family: helvetica, verdana; +} + +h4 +{ + font-size: 1em; + line-height: 1.7em; + font-family: helvetica, verdana; +} + +html, body +{ + width: 100%; + height: 100%; +} + +body +{ + margin: 0; + padding: 0; + background-color: #fff; + position: relative; + font: 16px/24px NobileRegular, "Lucida Grande", Lucida, Verdana, sans-serif; +} + +a +{ + color: #1b61d6; + text-decoration: none; +} + +a:hover +{ + color: #e88f00; + text-decoration: underline; +} + +body h1, body h2, body h3, body h4, body h5, body h6 +{ + font-family: NeutonRegular, "Lucida Grande", Lucida, Verdana, sans-serif; + font-weight: 400; + color: #373839; + font-style: normal; +} + +#wrap +{ + min-height: 100%; +} + +#header, #footer +{ + width: 100%; + color: #fff; + height: 40px; + position: absolute; + text-align: center; + line-height: 40px; + overflow: hidden; + font-size: 12px; + vertical-align: middle; +} + +#header +{ + background: #000; + top: 0; + font-size: 14px; +} + +#footer +{ + bottom: 0; + background: #000 url(footerbg.png) repeat-x 0 top; + position: relative; + margin-top: -40px; + clear: both; +} + +.header, .footer +{ + width: 750px; + margin-right: auto; + margin-left: auto; +} + +.wrapper +{ + width: 100%; +} + +#top, #top-small, #bottom +{ + width: 100%; +} + +#top +{ + color: #000; + height: 230px; + background: #fff url(headerbg.png) repeat-x 0 top; + position: relative; +} + +#top-small +{ + color: #000; + height: 60px; + background: #fff url(headerbg.png) repeat-x 0 top; + position: relative; +} + +#bottom +{ + color: #222; + background-color: #fff; +} + +.top, .top-small, .middle, .bottom +{ + width: 750px; + margin-right: auto; + margin-left: auto; +} + +.top +{ + padding-top: 40px; +} + +.top-small +{ + padding-top: 10px; +} + +#middle +{ + width: 100%; + height: 100px; + background: url(middlebg.png) repeat-x; + border-top: 2px solid #fff; + border-bottom: 2px solid #b2b2b2; +} + +.app-welcome +{ + margin-top: 25px; +} + +.app-name +{ + color: #000; + font-weight: 700; +} + +.bottom +{ + padding-top: 50px; +} + +#left +{ + width: 350px; + float: left; + padding-right: 25px; +} + +#right +{ + width: 350px; + float: right; + padding-left: 25px; +} + +.align-left +{ + text-align: left; +} + +.align-right +{ + text-align: right; +} + +.align-center +{ + text-align: center; +} + +ul.links +{ + margin: 0; + padding: 0; +} + +ul.links li +{ + list-style-type: none; + font-size: 14px; +} + +form +{ + border-style: none; +} + +fieldset +{ + border-style: none; +} + +input +{ + color: #222; + border: 1px solid #ccc; + font-family: sans-serif; + font-size: 12px; + line-height: 16px; +} + +input[type=text], input[type=password] +{ + width: 205px; +} + +input[type=submit] +{ + background-color: #ddd; + font-weight: 700; +} + +/*Opera Fix*/ +body:before +{ + content: ""; + height: 100%; + float: left; + width: 0; + margin-top: -32767px; +} diff --git a/wscserver/static/pyramid-small.png b/wscserver/static/pyramid-small.png new file mode 100644 index 0000000..a5bc0ad Binary files /dev/null and b/wscserver/static/pyramid-small.png differ diff --git a/wscserver/static/pyramid.png b/wscserver/static/pyramid.png new file mode 100644 index 0000000..347e055 Binary files /dev/null and b/wscserver/static/pyramid.png differ diff --git a/wscserver/static/transparent.gif b/wscserver/static/transparent.gif new file mode 100644 index 0000000..0341802 Binary files /dev/null and b/wscserver/static/transparent.gif differ diff --git a/wscserver/view/__init__.py b/wscserver/view/__init__.py new file mode 100644 index 0000000..d310fdd --- /dev/null +++ b/wscserver/view/__init__.py @@ -0,0 +1 @@ +# package \ No newline at end of file diff --git a/wscserver/view/restfulview.py b/wscserver/view/restfulview.py new file mode 100755 index 0000000..c582199 --- /dev/null +++ b/wscserver/view/restfulview.py @@ -0,0 +1,82 @@ +from pyramid_restler.view import RESTfulView +from collections import defaultdict +import json +import hashlib + +class CustomRESTfulView(RESTfulView): + + """ + Classe com parametros personalizados de view dos registros + para as classes WMI + """ + + def check_empty(self, classes, nome_classe): + # Ensure variable is defined + try: + classe = classes[nome_classe] + except KeyError: + classe = {} + return classe + + def render_json(self, value): + + dados_banco = json.loads(self.context.to_json(value, self.fields, + wrap=False)) + + saida = {} + for computador in dados_banco: + # Cria as chaves dos computadores + saida[computador['id_computador']] = {} + + for x in dados_banco: + # Cria as chaves de classes nos computadores + saida[x['id_computador']][x['nm_class_name']] = {} + + for x in dados_banco: + # cria as chaves de propriedades nas classes + saida[x['id_computador']]['data_coleta'] = x['dt_hr_inclusao'] + saida[x['id_computador']][x['nm_class_name']][ + x['nm_property_name']] = x['te_class_property_value'] + + results = [] + # Ordena os objetos json + for computador in saida: + # data_coleta = computador['dt_hr_inclusao'] + classes = {} + for classe in saida[computador]: + if classe != 'data_coleta': + # Aqui estou nas classes + classes[classe] = saida[computador][classe] + + # Gera um hash para o id_computador + h = hashlib.sha256() + h.update(str(computador).encode('utf-8')) + computador = h.hexdigest() + + + results.append({ + 'id_reg': computador, + 'Win32_PhysicalMedia': [self.check_empty(classes, 'Win32_PhysicalMedia')], + 'Win32_ComputerSystem': [self.check_empty(classes, 'Win32_ComputerSystem')], + 'Win32_Keyboard': [self.check_empty(classes, 'Win32_Keyboard')], + 'Win32_NetworkAdapter': [self.check_empty(classes, 'Win32_NetworkAdapter')], + 'Win32_PointingDevice': [self.check_empty(classes, 'Win32_PointingDevice')], + 'Win32_MemoryDevice': [self.check_empty(classes, 'Win32_MemoryDevice')], + 'Win32_PhysicalMemory': [self.check_empty(classes, 'Win32_PhysicalMemory')], + 'Win32_BaseBoard': [self.check_empty(classes, 'Win32_BaseBoard')], + 'Win32_Printer': [self.check_empty(classes, 'Win32_Printer')], + 'Win32_Processor': [self.check_empty(classes, 'Win32_Processor')], + 'Win32_DesktopMonitor': [self.check_empty(classes, 'Win32_DesktopMonitor')], + 'Win32_BIOS': [self.check_empty(classes, 'Win32_BIOS')], + }) + + valores = { + 'results': results, + 'result_count': len(results) + } + + response_data = dict( + body=json.dumps(valores), + content_type='application/json' + ) + return response_data diff --git a/wscserver/views.py b/wscserver/views.py new file mode 100644 index 0000000..393c9a1 --- /dev/null +++ b/wscserver/views.py @@ -0,0 +1,12 @@ +from pyramid.view import view_config +from pyramid.response import FileResponse +from wscserver.scripts.createzip import zipcoleta +import os + +@view_config(route_name='download') +def download(request): + filepath = zipcoleta() + # filesize = str(os.path.getsize(filepath)) + response = FileResponse(filepath,request=request, + content_type='application/zip') + return response \ No newline at end of file -- libgit2 0.21.2