コード例 #1
0
ファイル: proxy.icmp.py プロジェクト: ohyeah521/fyuneru-1
parser.add_argument("--client-send-to", type=str, required=False)

args = parser.parse_args()

##############################################################################

if None == args.client_send_to:
    # run as server mode
    sck = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_ICMP)
    sck.setsockopt(socket.SOL_IP, socket.IP_HDRINCL, 1)
    dropRoot(args.uidname, args.gidname)
else:
    # run as client mode
    pass

local = InternalSocketClient(args.socket)

##############################################################################


def doExit(signum, frame):
    global local, proxy
    try:
        local.close()
    except:
        pass
    try:
        proxy.xmpp.disconnect()
    except:
        pass
    print "exit now."
コード例 #2
0
ファイル: proxy.xmpp.py プロジェクト: ohyeah521/fyuneru-1
# ----------- parse arguments

parser = argparse.ArgumentParser()

parser.add_argument("--debug", action="store_true", default=False)
parser.add_argument("IPC_SERVER_URL", type=str)

args = parser.parse_args()

##############################################################################

configLoggingModule(args.debug)

# use command line to initialize IPC client

ipc = InternalSocketClient(args.IPC_SERVER_URL)

queried = InitConfigWaiter(ipc).wait()
if not queried:
    error("Configuration timed out. Exit.")
    ipc.close()
    sys.exit(1)

##############################################################################

debug("Drop privilege to %s:%s" % queried["user"])
dropRoot(*queried["user"])

##############################################################################

class SocketXMPPProxyException(Exception): pass
コード例 #3
0
ファイル: proxy.icmp.py プロジェクト: cloudseo/fyuneru
args = parser.parse_args()


##############################################################################

if None == args.client_send_to:
    # run as server mode
    sck = socket.socket(socket.AF_INET,socket.SOCK_RAW,socket.IPPROTO_ICMP)
    sck.setsockopt(socket.SOL_IP, socket.IP_HDRINCL, 1)
    dropRoot(args.uidname, args.gidname)
else:
    # run as client mode
    pass

local = InternalSocketClient(args.socket)

##############################################################################

def doExit(signum, frame):
    global local, proxy
    try:
        local.close()
    except:
        pass
    try:
        proxy.xmpp.disconnect()
    except:
        pass
    print "exit now."
    exit()
コード例 #4
0
ファイル: proxy.tcp.py プロジェクト: cloudseo/fyuneru
    def get(self):
        n = self.__buffer.find("\n")
        if n < 0:
            return None
        self.__buffer = self.__buffer[n:].strip()
        try:
            ret = self.__buffer[:n].strip().decode("base64")
            return ret
        except:
            return None


##############################################################################

localSocket = InternalSocketClient()

proxySocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

if "server" == args.mode:
    proxySocket.bind(("127.0.0.1", args.FORWARD_TO))
    proxyPeer = None  # not knowing where to send data back
else:
    proxyPeer = ("127.0.0.1", args.l)  # send to local tunnel entrance

##############################################################################


def doExit(signum, frame):
    global localSocket, proxySocket, procmgr
    try:
コード例 #5
0
ファイル: proxy.tcp.py プロジェクト: ohyeah521/fyuneru-1
        self.__buffer += buf

    def get(self):
        n = self.__buffer.find('\n')
        if n < 0: return None
        self.__buffer = self.__buffer[n:].strip()
        try:
            ret = self.__buffer[:n].strip().decode('base64')
            return ret
        except:
            return None


##############################################################################

localSocket = InternalSocketClient()

proxySocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

if 'server' == args.mode:
    proxySocket.bind(('127.0.0.1', args.FORWARD_TO))
    proxyPeer = None  # not knowing where to send data back
else:
    proxyPeer = ('127.0.0.1', args.l)  # send to local tunnel entrance

##############################################################################


def doExit(signum, frame):
    global localSocket, proxySocket, procmgr
    try: