From 9af4280a687b8552a9781290aedc533f0f866f99 Mon Sep 17 00:00:00 2001 From: citronneur Date: Sun, 29 Jun 2014 18:57:40 +0200 Subject: [PATCH] finish rle module build --- .gitignore | 2 +- README.md | 27 ++++++++++++++++-- .../rdpclient.py => bin/rdpy-rdpclient | 5 ++-- .../rdpserver.py => bin/rdpy-rdpproxy | 3 +- rdpy/tests/dotest.py => bin/rdpy-test | 25 ++++++++++++++--- .../vncclient.py => bin/rdpy-vncclient | 5 ++-- lib/sconstruct | 28 +++++++++++-------- lib/sip/rle.sip | 2 +- lib/src/{ => rle}/rle.c | 0 lib/src/{ => rle}/rle.h | 0 lib/src/{ => rle}/rle_m.h | 0 rdpy/examples/__init__.py | 0 rdpy/fast/__init__.py | 0 rdpy/protocol/rdp/rdp.py | 1 - rdpy/{display => ui}/__init__.py | 0 rdpy/{display => ui}/qt4.py | 2 +- 16 files changed, 73 insertions(+), 27 deletions(-) rename rdpy/examples/rdpclient.py => bin/rdpy-rdpclient (96%) mode change 100644 => 100755 rename rdpy/examples/rdpserver.py => bin/rdpy-rdpproxy (89%) mode change 100644 => 100755 rename rdpy/tests/dotest.py => bin/rdpy-test (53%) mode change 100644 => 100755 rename rdpy/examples/vncclient.py => bin/rdpy-vncclient (96%) mode change 100644 => 100755 rename lib/src/{ => rle}/rle.c (100%) rename lib/src/{ => rle}/rle.h (100%) rename lib/src/{ => rle}/rle_m.h (100%) delete mode 100644 rdpy/examples/__init__.py delete mode 100644 rdpy/fast/__init__.py rename rdpy/{display => ui}/__init__.py (100%) rename rdpy/{display => ui}/qt4.py (99%) diff --git a/.gitignore b/.gitignore index 9268917..0964ec0 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ .project .pydevproject README.md~ -lib/obj/* +lib/build/* *.so *.os .sconsign.dblite diff --git a/README.md b/README.md index 962f9ac..c230486 100644 --- a/README.md +++ b/README.md @@ -6,16 +6,39 @@ Remote Desktop Protocol in Twisted Python * python2.7 * python-twisted * python-openssl - -## Requirements for examples * python-qt4 * python-qt4reactor +## Requirements libs +* python-sip-dev +* scons +``` +$ git clone https://github.com/citronneur/rdpy.git rdpy +$ scons -C rdpy/lib install +``` + +## Binaries +RDP Client +``` +$ rdpy/bin/rdpy-rdpclient XXX.XXX.XXX.XXX 3389 +``` + +VNC Client +``` +$ rdpy/bin/rdpy-vncclient XXX.XXX.XXX.XXX 5901 +``` + +RDP Proxy +``` +$ rdpy/bin/rdpy-vncclient XXX.XXX.XXX.XXX 5901 +``` + ##Must be implemented before first release * CreedSSP * Packet redirection * License * Most common orders * FastPath messages +* Des VNC (using pyDes) this project is still in progress. diff --git a/rdpy/examples/rdpclient.py b/bin/rdpy-rdpclient old mode 100644 new mode 100755 similarity index 96% rename from rdpy/examples/rdpclient.py rename to bin/rdpy-rdpclient index 7ae897a..cba4142 --- a/rdpy/examples/rdpclient.py +++ b/bin/rdpy-rdpclient @@ -1,3 +1,4 @@ +#!/usr/bin/python # # Copyright (c) 2014 Sylvain Peyrefitte # @@ -25,10 +26,10 @@ import sys import os # Change path so we find rdpy -sys.path.insert(1, os.path.join(sys.path[0], '../..')) +sys.path.insert(1, os.path.join(sys.path[0], '..')) from PyQt4 import QtGui -from rdpy.display.qt4 import RDPClientQt +from rdpy.ui.qt4 import RDPClientQt from rdpy.protocol.rdp import rdp class RDPClientQtFactory(rdp.ClientFactory): diff --git a/rdpy/examples/rdpserver.py b/bin/rdpy-rdpproxy old mode 100644 new mode 100755 similarity index 89% rename from rdpy/examples/rdpserver.py rename to bin/rdpy-rdpproxy index b34435b..637f113 --- a/rdpy/examples/rdpserver.py +++ b/bin/rdpy-rdpproxy @@ -1,10 +1,11 @@ +#!/usr/bin/python ''' @author: sylvain ''' import sys, os # Change path so we find rdpy -sys.path.insert(1, os.path.join(sys.path[0], '../..')) +sys.path.insert(1, os.path.join(sys.path[0], '..')) from rdpy.protocol.rdp import rdp diff --git a/rdpy/tests/dotest.py b/bin/rdpy-test old mode 100644 new mode 100755 similarity index 53% rename from rdpy/tests/dotest.py rename to bin/rdpy-test index 12ea828..bd3e233 --- a/rdpy/tests/dotest.py +++ b/bin/rdpy-test @@ -1,9 +1,26 @@ -''' -@author: sylvain -''' +#!/usr/bin/python +# +# Copyright (c) 2014 Sylvain Peyrefitte +# +# This file is part of rdpy. +# +# rdpy is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + import sys, os # Change path so we find rdpy -sys.path.insert(1, os.path.join(sys.path[0], '../..')) +sys.path.insert(1, os.path.join(sys.path[0], '..')) import unittest, rdpy.tests.network.type, rdpy.tests.network.const, rdpy.tests.network.layer def headerTest(name): diff --git a/rdpy/examples/vncclient.py b/bin/rdpy-vncclient old mode 100644 new mode 100755 similarity index 96% rename from rdpy/examples/vncclient.py rename to bin/rdpy-vncclient index e3eedd1..bffd917 --- a/rdpy/examples/vncclient.py +++ b/bin/rdpy-vncclient @@ -1,3 +1,4 @@ +#!/usr/bin/python # # Copyright (c) 2014 Sylvain Peyrefitte # @@ -25,10 +26,10 @@ import sys import os # Change path so we find rdpy -sys.path.insert(1, os.path.join(sys.path[0], '../..')) +sys.path.insert(1, os.path.join(sys.path[0], '..')) from PyQt4 import QtGui -from rdpy.display.qt4 import RFBClientQt +from rdpy.ui.qt4 import RFBClientQt from rdpy.protocol.rfb import rfb class RFBClientQtFactory(rfb.ClientFactory): diff --git a/lib/sconstruct b/lib/sconstruct index bf1e251..c76e8de 100644 --- a/lib/sconstruct +++ b/lib/sconstruct @@ -5,28 +5,32 @@ script_dir = os.path.dirname(os.path.realpath(Dir("#/Sconstruct").abspath)) build_dir = os.path.join(script_dir, "build") src_dir = os.path.join(script_dir, "src") sip_dir = os.path.join(script_dir, "sip") -#generate install dir -install_dir = os.path.join(script_dir, "..", "rdpy", "fast") def build_sip(target, source, env): # Get the SIP configuration information. config = sipconfig.Configuration() # Run SIP to generate the code. - os.system(" ".join([config.sip_bin, "-c", "src", str(source[0])])) + os.system(" ".join([config.sip_bin, "-c", os.path.dirname(str(target[0])), str(source[0])])) + +def build_module(name, install_dir, env): + targetName = os.path.join(build_dir, name, "%s.so"%name) + + sources = [Glob(os.path.join(src_dir, name,'*.c')), os.path.join(build_dir, name, "sip%scmodule.c"%name)] + + env.Sip(os.path.join(build_dir, name, "sip%scmodule.c"%name), os.path.join(sip_dir, "%s.sip"%name)) + + #sources.append(sip) + lib = env.SharedLibrary(target = targetName, source = sources, SHLIBPREFIX='') + + env.Install(install_dir, lib) + env.Alias("install", install_dir) + #building library env = Environment() env.Append(BUILDERS = {'Sip' : Builder(action = build_sip)}) env.Append(CPPPATH = ["/usr/include/python2.7"]); env.VariantDir('build', 'src', duplicate=0) +build_module("rle", os.path.join(script_dir, "..", "rdpy", "ui"), env) -targetName = os.path.join(build_dir, "rle.so") - -sources = [Glob(os.path.join(build_dir, '*.c')), os.path.join(build_dir, "siprlecmodule.c")] - -sip = env.Sip([os.path.join(src_dir, "sipAPIrle.h"), os.path.join(src_dir, "siprlecmodule.c")], [os.path.join(sip_dir, "rle.sip")]) - -lib = env.SharedLibrary(target = targetName, source = sources, SHLIBPREFIX='') - -env.Requires(lib, sip) diff --git a/lib/sip/rle.sip b/lib/sip/rle.sip index 658f6d5..76a1398 100644 --- a/lib/sip/rle.sip +++ b/lib/sip/rle.sip @@ -1,7 +1,7 @@ %Module(name=rle, language="C") %UnitCode -#include "rle.h" +#include "../../src/rle/rle.h" %End int rle_decode_uint8(void* output, int width, int height, char* input, int size); diff --git a/lib/src/rle.c b/lib/src/rle/rle.c similarity index 100% rename from lib/src/rle.c rename to lib/src/rle/rle.c diff --git a/lib/src/rle.h b/lib/src/rle/rle.h similarity index 100% rename from lib/src/rle.h rename to lib/src/rle/rle.h diff --git a/lib/src/rle_m.h b/lib/src/rle/rle_m.h similarity index 100% rename from lib/src/rle_m.h rename to lib/src/rle/rle_m.h diff --git a/rdpy/examples/__init__.py b/rdpy/examples/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/rdpy/fast/__init__.py b/rdpy/fast/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/rdpy/protocol/rdp/rdp.py b/rdpy/protocol/rdp/rdp.py index 5331717..350ed52 100644 --- a/rdpy/protocol/rdp/rdp.py +++ b/rdpy/protocol/rdp/rdp.py @@ -69,7 +69,6 @@ class ServerFactory(protocol.Factory): ''' def __init__(self, privateKeyFileName, certificateFileName): ''' - ctor @param privateKeyFileName: file contain server private key @param certficiateFileName: file that contain publi key ''' diff --git a/rdpy/display/__init__.py b/rdpy/ui/__init__.py similarity index 100% rename from rdpy/display/__init__.py rename to rdpy/ui/__init__.py diff --git a/rdpy/display/qt4.py b/rdpy/ui/qt4.py similarity index 99% rename from rdpy/display/qt4.py rename to rdpy/ui/qt4.py index b5b29f9..2f38374 100644 --- a/rdpy/display/qt4.py +++ b/rdpy/ui/qt4.py @@ -26,7 +26,7 @@ QRemoteDesktop is a widget use for render in rdpy from PyQt4 import QtGui, QtCore from rdpy.protocol.rfb.rfb import RFBClientObserver from rdpy.protocol.rdp.rdp import RDPClientObserver -import rdpy.fast.rle as rle +import rle class QAdaptor(object):