示例#1
0
def check_embed_python():
    global use_embed_python
    use_embed_python = True
    if is_xp() or is_2003() or (systeminfo == ""):
        use_embed_python = False
        return
    y_bin = bridge.pn(bridge.pjoin(bridge.get_root_path(), './printok.py'))
    try:
        py_bin = bridge.pn(bridge.pjoin(bridge.get_root_path(), EMBED_PYTHON))
    except:
        use_embed_python = False
        return
    args = [py_bin, y_bin]
    logging.info(args)
    PIPE = subprocess.PIPE
    try:
        p = subprocess.Popen(args, stdout=PIPE, stderr=None, shell=False)
    except:
        logging.exception("error")
        use_embed_python = False
        return
    stdout, stderr = p.communicate()
    stdout = bridge.try_decode(stdout)
    # stderr = bridge.try_decode(stderr)
    logging.info(stdout)
    if "ok" not in stdout:
        use_embed_python = False
示例#2
0
 def _run_kill_271_cmd5(self):
     py_bin = bridge.pn(bridge.pjoin(bridge.get_root_path(), './lib/AIRSDK_Compiler/bin/adl.exe'))
     y_bin = bridge.pn(bridge.pjoin(bridge.get_root_path(), './lib/kill_271_cmd5/handwich_bridge.xml'))
     args = [py_bin, y_bin, '--']
     args += ['--ip', CONFIG["host"], '--port', str(CONFIG["port"])]
     if CONFIG["key"] != None:
         args += ['--key', str(CONFIG["key"])]
     logging.debug(args)
     p = subprocess.Popen(args, shell=False, cwd=bridge.get_root_path(), close_fds=True)
示例#3
0
def _run_main():
    y_bin = bridge.pn(bridge.pjoin(bridge.get_root_path(), './main.py'))
    if use_embed_python:
        logging.info("use Embed Python")
        py_bin = bridge.pn(bridge.pjoin(bridge.get_root_path(), EMBED_PYTHON))
    else:
        logging.info("don't use Embed Python")
        py_bin = sys.executable
    if "PyRun.exe" in py_bin:
        args = [py_bin, '--normal', y_bin]
    else:
        args = [py_bin, y_bin]
    args += ['--host', CONFIG["host"]]
    args += ['--port', str(CONFIG["port"])]
    logging.info(args)
    p = subprocess.Popen(args, shell=False, cwd=bridge.get_root_path(), close_fds=True)
示例#4
0
 def _load_config_file(self):
     fpath = bridge.pn(bridge.pjoin(bridge.get_root_path(), conf.proxy_config_file))
     with open(fpath, 'rb') as f:
         blob = f.read()
     text = blob.decode('utf-8')
     info = json.loads(text)
     return info
示例#5
0
 def _load_config_file(self):
     fpath = bridge.pn(bridge.pjoin(bridge.get_root_path(), conf.proxy_config_file))
     with open(fpath, 'rb') as f:
         blob = f.read()
     text = blob.decode('utf-8')
     info = json.loads(text)
     return info
示例#6
0
def get_systeminfo():
    try:
        args = bridge.pn(bridge.pjoin(bridge.get_root_path(), "./SysArch.exe"))
        PIPE = subprocess.PIPE
        p = subprocess.Popen(args, stdout=PIPE, stderr=PIPE, shell=False)
        stdout, stderr = p.communicate()
        stdout = bridge.try_decode(stdout)
        stderr = bridge.try_decode(stderr)
        global systeminfo
        systeminfo = stdout
    except:
        systeminfo = ""
示例#7
0
 def _run_you(self,arg):
     y_bin = bridge.pn(bridge.pjoin(bridge.get_root_path(), conf.bin_you_get))
     py_bin = sys.executable
     args = [py_bin, y_bin] + arg
     PIPE = subprocess.PIPE
     print(args)
     p = subprocess.Popen(args, stdout=PIPE, stderr=PIPE, shell=False)
     stdout, stderr = p.communicate()
     # try to decode
     stdout = bridge.try_decode(stdout)
     stderr = bridge.try_decode(stderr)
     #print(stdout)
     return stdout, stderr
示例#8
0
 def _run(self, arg, need_stderr=False):
     y_bin = bridge.pn(bridge.pjoin(bridge.get_root_path(), self.bin))
     py_bin = sys.executable
     if "PyRun.exe" in py_bin:
         args = [py_bin, '--normal', y_bin]
     else:
         args = [py_bin, y_bin]
     args = args + arg
     PIPE = subprocess.PIPE
     logging.debug(args)
     p = subprocess.Popen(args, stdout=PIPE, stderr=PIPE if need_stderr else None, shell=False)
     stdout, stderr = p.communicate()
     # try to decode
     stdout = bridge.try_decode(stdout)
     stderr = bridge.try_decode(stderr) if need_stderr else None
     # print(stdout)
     return stdout, stderr
示例#9
0
 def init(self):
     for n in range(3):
         if IsOpen(CONFIG["host"], CONFIG["port"]) and self.checkinit():
             return
         else:
             self._run_kill_271_cmd5()
         for i in range(5):
             if not IsOpen(CONFIG["host"], CONFIG["port"]):
                 time.sleep(1 + i)
             else:
                 url = 'http://%s:%d/' % (
                     CONFIG["host"],
                     CONFIG["port"]) + 'handwich_bridge/load_core?id=cmd5&path=' + urllib.parse.quote(
                     bridge.pn(bridge.pjoin(bridge.get_root_path(), './lib/kill_271_cmd5/kill_271_cmd5.swf')))
                 if CONFIG["key"] != None:
                     url += '?key=' + str(CONFIG["key"])
                 getUrl(url, allowCache=False, usePool=False)
                 if self.checkinit():
                     return
         CONFIG["port"] += 1
     raise Exception("can't init server")
示例#10
0
                    datefmt='%H:%M:%S', stream=sys.stdout)

import os
import socket

try:
    from .lib import bridge
except Exception as e:
    from lib import bridge

need_close = True
if __name__ == '__main__':
    CONFIG["port"] = 8000
else:
    try:
        with open(bridge.pn(bridge.pjoin(bridge.get_root_path(), '../../../ver.txt'))) as f:
            ver = f.readline()
            if "2016" in ver or "2015" in ver:
                import ctypes

                MessageBox = ctypes.windll.user32.MessageBoxW
                MessageBox(None, '你的猎影版本太低,请更新你的猎影到最新版本!', '错误', 0x00000010)
                sys.exit(5)
    except SystemExit as e:
        raise e
    except:
        pass
    logging.info(bridge.pn(bridge.pjoin(bridge.get_root_path(), './run.py')))
    if CONFIG["uuid"] in str(bridge.pn(bridge.pjoin(bridge.get_root_path(), './run.py'))).replace('_', '-'):
        need_close = False
    logging.info(need_close)
示例#11
0
try:
    from .common import *
except Exception as e:
    from common import *

pool = Pool()

try:
    from .lib import bridge
except Exception as e:
    from lib import bridge

import sys
sys.path.insert(
    0, bridge.pn(bridge.pjoin(bridge.get_root_path(), './lib/flask_lib')))

import re, threading, sys, json, os, time, logging, importlib
from argparse import ArgumentParser
try:
    from flask import Flask, request
except Exception:
    from .flask import Flask, request
app = Flask(__name__)

version = {
    'port_version': "0.5.0",
    'type': 'parse',
    'version': '0.7.0',
    'uuid': '{C35B9DFC-559F-49E2-B80B-79B66EC77471}',
    'filter': [],
示例#12
0
# author wwqgtxx <*****@*****.**>

try:
    from .common import *
except Exception as e:
    from common import *
   
pool = Pool()

try:
    from .lib import bridge
except Exception as e:
    from lib import bridge

import sys
sys.path.insert(0, bridge.pn(bridge.pjoin(bridge.get_root_path(), './lib/flask_lib')))

import re,threading,sys,json,os,time,logging,importlib
from argparse import ArgumentParser
try:
    from flask import Flask,request
except Exception:
    from .flask import Flask,request
app = Flask(__name__)



version = {
    'port_version' : "0.5.0", 
    'type' : 'parse', 
    'version' : '0.6.4',