Exemplo n.º 1
0
def getInfo(processname):             #通过tasklist命令,找到processname的pid
	word1=""
	word2=""
	task = os.popen('tasklist')
	if processname in task.read():
		#print(1)
		num = os.popen('wmic process where name="'+processname+'" get CommandLine')
		#print( num.read().split("\n"))
		#print(num.read().split("\n")[2].index("E:\BaiduYunDownload\phpStudy\WWW\\forlining\\task.py"))
		for r in num.read().split("\n"):
			if r.strip()!='':

				word="E:\BaiduYunDownload\phpStudy\WWW\\forlining\\task.py"
				if r.find("C:\github\stock2015\process_1.2.py")!=-1:
					word1=',"jiasheng_status":1'
				if r.find("C:\github\stock2016forlmx\process_1.2_forlmx.py")!=-1:
					word2=',"lmx_status":1'
	if word1=="":
		word1=',"jiasheng_status":0'
		writelog("停止了")
		mail.run("mail.ini","警报!!!,嘉盛程序断掉了"+str(time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))))

	if word2=="":
		word2=',"lmx_status":0'		
		writelog("停止了")
		mail.run("mail.ini","警报!!!,lmx程序断掉了"+str(time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))))

	write_json(word1+word2)
Exemplo n.º 2
0
def init():

    UUDLL = os.path.join(os.path.dirname(__file__),
                         'UUWiseHelper.dll')  #当前目录下的优优API接口文件
    # 加载动态链接库, 需要放在System 的path里,或者当前目录下
    UU = windll.LoadLibrary(UUDLL)
    # 初始化函数调用
    setSoftInfo = UU.uu_setSoftInfoW
    login = UU.uu_loginW
    recognizeByCodeTypeAndPath = UU.uu_recognizeByCodeTypeAndPathW
    getResult = UU.uu_getResultW
    uploadFile = UU.uu_UploadFileW
    getScore = UU.uu_getScoreW
    checkAPi = UU.uu_CheckApiSignW  #api文件校验函数,调用后返回:MD5(软件ID+大写DLL校验KEY+大写随机值参数+优优API文件的MD5值+大写的优优API文件的CRC32值)
    # 初始化函数调用

    dllMd5 = getFileMd5(UUDLL)  #api文件的MD5值
    dllCRC32 = getFileCRC(UUDLL)  #API文件的CRC32值
    randChar = hashlib.md5(
        random.choice('abcdefghijklmnopqrstuvwxyz!@#$%^&*()').encode(
            "utf8")).hexdigest()
    checkStatus = hashlib.md5(
        ('%d%s%s%s%s' % (s_id, (softVerifyKey.upper()), (randChar.upper()),
                         (dllMd5[1].upper()), (dllCRC32[1].upper()))
         ).encode("utf8")).hexdigest()  #服务器返回来的值与此值对应一至则表示成功
    serverStatus = c_wchar_p("")  #服务器返回来的结果,serverStatus和checkStatus值一样的话,就OK
    #return 3
    #checkAPi(c_int(s_id), c_wchar_p(s_key.upper()),c_wchar_p(randChar.upper()),c_wchar_p(dllMd5[1].upper()),c_wchar_p(dllCRC32[1].upper()),serverStatus)  #调用检查函数,仅需要调用一次即可,不需要每次上传图片都调用一次    pic_file_path = os.path.join(os.path.dirname(__file__), 'test_pics', 'test1.jpg')
    setSoftInfo(s_id, s_key)
    #checkAPi(s_id,s_key,randChar,dllMd5[1],dllCRC32[1],serverStatus)
    #print( "login start "+str(time.strftime("%Y-%m-%d %H:%M:%S")))
    user_i = "ting8882com"
    passwd_i = "tt*963.-+"
    user = c_wchar_p(user_i)  # 授权用户名
    passwd = c_wchar_p(passwd_i)  # 授权密码
    ret = login(user, passwd)
    # print( "login over "+str(time.strftime("%Y-%m-%d %H:%M:%S")))
    if ret < 0:

        print('login error,errorCode:%d' % ret)

    result = c_wchar_p(
        "                                              ")  #//分配内存空间,避免内存泄露
    code_id = recognizeByCodeTypeAndPath(c_wchar_p(pic_file_path), c_int(1004),
                                         result)

    if code_id <= 0:
        save_log("IP被封掉无法访问" + "_" + str(time.strftime("%Y-%m-%d %H:%M:%S")))
        mail.run()
        print('get result error ,ErrorCode: %d' % code_id)
        print('无法获取到验证码图片,请检查是否IP被封掉')
        sys.exit(0)
    else:
        checkedRes = checkResult(result.value, s_id, softVerifyKey, code_id)
    print(str(time.strftime("%Y-%m-%d %H:%M:%S")))
    return checkedRes
Exemplo n.º 3
0
def init():
    
    UUDLL=os.path.join(os.path.dirname(__file__), 'UUWiseHelper.dll')                   #当前目录下的优优API接口文件
    # 加载动态链接库, 需要放在System 的path里,或者当前目录下
    UU = windll.LoadLibrary(UUDLL)
    # 初始化函数调用
    setSoftInfo = UU.uu_setSoftInfoW
    login = UU.uu_loginW
    recognizeByCodeTypeAndPath = UU.uu_recognizeByCodeTypeAndPathW
    getResult = UU.uu_getResultW
    uploadFile = UU.uu_UploadFileW
    getScore = UU.uu_getScoreW
    checkAPi=UU.uu_CheckApiSignW    #api文件校验函数,调用后返回:MD5(软件ID+大写DLL校验KEY+大写随机值参数+优优API文件的MD5值+大写的优优API文件的CRC32值)
    # 初始化函数调用
    
    dllMd5=getFileMd5(UUDLL)   #api文件的MD5值
    dllCRC32=getFileCRC(UUDLL) #API文件的CRC32值
    randChar=hashlib.md5(random.choice('abcdefghijklmnopqrstuvwxyz!@#$%^&*()').encode("utf8")).hexdigest()
    checkStatus=hashlib.md5(('%d%s%s%s%s'%(s_id,(softVerifyKey.upper()),(randChar.upper()),(dllMd5[1].upper()),(dllCRC32[1].upper()))).encode("utf8")).hexdigest()     #服务器返回来的值与此值对应一至则表示成功
    serverStatus=c_wchar_p("") #服务器返回来的结果,serverStatus和checkStatus值一样的话,就OK
    #return 3
    #checkAPi(c_int(s_id), c_wchar_p(s_key.upper()),c_wchar_p(randChar.upper()),c_wchar_p(dllMd5[1].upper()),c_wchar_p(dllCRC32[1].upper()),serverStatus)  #调用检查函数,仅需要调用一次即可,不需要每次上传图片都调用一次    pic_file_path = os.path.join(os.path.dirname(__file__), 'test_pics', 'test1.jpg')
    setSoftInfo(s_id,s_key)
    #checkAPi(s_id,s_key,randChar,dllMd5[1],dllCRC32[1],serverStatus)
    #print( "login start "+str(time.strftime("%Y-%m-%d %H:%M:%S")))
    user_i = "ting8882com"
    passwd_i = "tt*963.-+"
    user = c_wchar_p(user_i)  # 授权用户名
    passwd = c_wchar_p(passwd_i)  # 授权密码
    ret = login(user, passwd)
   # print( "login over "+str(time.strftime("%Y-%m-%d %H:%M:%S")))
    if ret < 0:

        print('login error,errorCode:%d' %ret )
    
    result=c_wchar_p("                                              ")  #//分配内存空间,避免内存泄露
    code_id = recognizeByCodeTypeAndPath(c_wchar_p(pic_file_path),c_int(1004),result)
    
    if code_id <= 0:
        save_log("IP被封掉无法访问"+"_"+str(time.strftime("%Y-%m-%d %H:%M:%S")))
        mail.run()
        print('get result error ,ErrorCode: %d' % code_id)
        print('无法获取到验证码图片,请检查是否IP被封掉')
        sys.exit(0)
    else:
        checkedRes=checkResult(result.value, s_id, softVerifyKey, code_id)
    print(str(time.strftime("%Y-%m-%d %H:%M:%S")))
    return checkedRes
Exemplo n.º 4
0
def getInfo(processname):  #通过tasklist命令,找到processname的pid
    word1 = ""
    word2 = ""
    task = os.popen('tasklist')
    if processname in task.read():
        #print(1)
        num = os.popen('wmic process where name="' + processname +
                       '" get CommandLine')
        #print( num.read().split("\n"))
        #print(num.read().split("\n")[2].index("E:\BaiduYunDownload\phpStudy\WWW\\forlining\\task.py"))
        for r in num.read().split("\n"):
            if r.strip() != '':

                word = "E:\BaiduYunDownload\phpStudy\WWW\\forlining\\task.py"
                if r.find("C:\github\stock2015\process_1.2.py") != -1:
                    word1 = ',"jiasheng_status":1'
                if r.find("C:\github\stock2016forlmx\process_1.2_forlmx.py"
                          ) != -1:
                    word2 = ',"lmx_status":1'
    if word1 == "":
        word1 = ',"jiasheng_status":0'
        writelog("停止了")
        mail.run(
            "mail.ini", "警报!!!,嘉盛程序断掉了" +
            str(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(
                time.time()))))

    if word2 == "":
        word2 = ',"lmx_status":0'
        writelog("停止了")
        mail.run(
            "mail.ini", "警报!!!,lmx程序断掉了" +
            str(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(
                time.time()))))

    write_json(word1 + word2)
Exemplo n.º 5
0
def config(q):					#q is the Query that comes from Twitter
	lines = configuration_array()		#returns an array with the configuration
	config = split_obj_on_equal(lines)	#create result map with key and val
	url = package(config,q)			#package & build the url for the GET request
	url_search = get_json(url)		#returns JSON from the GET request
	pack = package_text_file(url_search,q)	#creates a Text file the content to email
	if pack!="":				#if the GET request doesn't include valid JSON, we neglect it 
		pack = pack.encode('utf-8')
		print pack
	#print str(url_search)
		result = mail.run(pack)		#calls mail script and sends the String to be sent as a text file
		if result:
			print("tweet sent")
		else:
			print("tweet error")
	else:
		print("Error in Google Search")
	return result
Exemplo n.º 6
0
def config(q):  #q is the Query that comes from Twitter
    lines = configuration_array()  #returns an array with the configuration
    config = split_obj_on_equal(lines)  #create result map with key and val
    url = package(config, q)  #package & build the url for the GET request
    url_search = get_json(url)  #returns JSON from the GET request
    pack = package_text_file(url_search,
                             q)  #creates a Text file the content to email
    if pack != "":  #if the GET request doesn't include valid JSON, we neglect it
        pack = pack.encode('utf-8')
        print pack
        #print str(url_search)
        result = mail.run(
            pack
        )  #calls mail script and sends the String to be sent as a text file
        if result:
            print("tweet sent")
        else:
            print("tweet error")
    else:
        print("Error in Google Search")
    return result
Exemplo n.º 7
0
    F_day = F_month
    F_month = F_month[0:6]

    print(F_day, F_month)
    F_sleep = cf.get("config", "sleep")
    #runvoice=0
    pwd = ""
    i = 0
    for user in opts2:

        if len(re.findall("\s_\s\[success\]", cf.get("user/pwd", user))) > 0:
            i = i + 1
    if len(opts2) == i:
        print("所有学生已经报名成功!程序结束运行")
        sys.exit(0)
    else:

        for user in opts2:
            print(user.split(' _ ')[1], cf.get("user/pwd", user))
            if len(re.findall("\s_\s\[success\]", cf.get("user/pwd",
                                                         user))) == 0:
                process = test.all_start(
                    user.split(' _ ')[1],
                    cf.get("user/pwd", user).split(' _ ')[0], F_province,
                    F_month, F_frequency, network, F_sleep, F_day)
            # if process!=1 and runvoice==0:
        # 	# 	runvoice=1
        # 	# 	winsound.PlaySound('SystemExit', winsound.SND_ALIAS)
        mail.run()
Exemplo n.º 8
0
	F_month=cf.get("config","F_month")
	if len(F_month)<6 or len(F_month)>8:
		print("月份配置错误")
		break

	F_day=F_month
	F_month=F_month[0:6]

	print(F_day,F_month)
	F_sleep=cf.get("config","sleep")
	#runvoice=0
	pwd=""
	i=0
	for user in opts2:
		
		if len(re.findall("\s_\s\[success\]",cf.get("user/pwd",user)))>0:
			i=i+1
	if len(opts2)==i:
		print("所有学生已经报名成功!程序结束运行")
		sys.exit(0)
	else:

		for user in opts2:
			print(user.split(' _ ')[1],cf.get("user/pwd",user))
			if len(re.findall("\s_\s\[success\]",cf.get("user/pwd",user)))==0:
				process=test.all_start(user.split(' _ ')[1],cf.get("user/pwd",user).split(' _ ')[0],F_province,F_month,F_frequency,network,F_sleep,F_day)
			# if process!=1 and runvoice==0:
		# 	# 	runvoice=1
		# 	# 	winsound.PlaySound('SystemExit', winsound.SND_ALIAS)
		mail.run()
Exemplo n.º 9
0
            cur_stock_releation = conn.cursor()
            releation_mid(100, "releation_mid")
            print("step2 releation_mid完成" + str(
                time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(
                    time.time()))))
            writelog("计算相关性用时" + str(time.time() - time2))
            time.sleep(80)
            #print(scipy.stats.norm.cdf(3,1,2))
            loadcsv_add_clear()
            print("step3 loadcsv_add_clear完成" + str(
                time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(
                    time.time()))))
            writelog("整体用时" + str(time.time() - time1))

            mail.run("mail.ini", "测试结果," + checkDB() + ",邮件发出时间" + str(
                time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(
                    time.time()))))  #test()
            cur_stock.close()

            cur_result.close()
            cur_d.close()
            cur_check.close()
            cur_result_DB.close()
            cur_stock_releation.close()
            conn.commit()
            conn.close()

    #print(scipy.stats.norm.ppf(0.99,0.00468906,0.49432524))

    # while(1):
Exemplo n.º 10
0
			cur_stock=conn.cursor()
			cur_result=conn.cursor()
			cur_d=conn.cursor()
			cur_check=conn.cursor()
			cur_result_DB=conn.cursor()
			cur_stock_releation=conn.cursor()
			releation_mid(100,"releation_mid")
			print("step2 releation_mid完成"+str(time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))))
			writelog("计算相关性用时"+str(time.time()-time2))
			time.sleep(80)
			#print(scipy.stats.norm.cdf(3,1,2))
			loadcsv_add_clear()
			print("step3 loadcsv_add_clear完成"+str(time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))))
			writelog("整体用时"+str(time.time()-time1))

			mail.run("mail.ini","测试结果,"+checkDB()+",邮件发出时间"+str(time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))))#test()
			cur_stock.close()

			cur_result.close()
			cur_d.close()
			cur_check.close()
			cur_result_DB.close()
			cur_stock_releation.close()
			conn.commit()
			conn.close()



	#print(scipy.stats.norm.ppf(0.99,0.00468906,0.49432524))

	# while(1):
Exemplo n.º 11
0
			print("step0 有文件生成"+str(time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))))
			checktick()
			time1=time.time()
			loadcsv_add()
			print("step1 loadcsv_add完成"+str(time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))))
			time2=time.time()
			releation_mid(100)
			print("step2 releation_mid完成"+str(time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))))
			writelog("计算相关性用时"+str(time.time()-time2))
			#print(scipy.stats.norm.cdf(3,1,2))
			loadcsv_add_clear()
			print("step3 loadcsv_add_clear完成"+str(time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))))
			checkDB()
			writelog("整体用时"+str(time.time()-time1))

			mail.run()#test()
			conn.commit()
			




	#print(scipy.stats.norm.ppf(0.99,0.00468906,0.49432524))

	# while(1):

	# 	if  (os.path.getsize("C:/Users/Administrator/AppData/Roaming/MeaQuotes/Terminal/50CA3DFB510CC5A8F28B48D1BF2A5702/MQL4/Files/API_callback.csv")!=0):
	# 		conn=pymysql.connect(host='localhost',user='******',passwd='123456',db='stock_foreign',port=3306)
	# 		cur_stock=conn.cursor()
	# 		cur_action=conn.cursor()
	# 		cur_result=conn.cursor()
Exemplo n.º 12
0
                    time.time()))))
            time2 = time.time()
            releation_mid(100)
            print("step2 releation_mid完成" + str(
                time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(
                    time.time()))))
            writelog("计算相关性用时" + str(time.time() - time2))
            #print(scipy.stats.norm.cdf(3,1,2))
            loadcsv_add_clear()
            print("step3 loadcsv_add_clear完成" + str(
                time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(
                    time.time()))))
            checkDB()
            writelog("整体用时" + str(time.time() - time1))

            mail.run()  #test()
            conn.commit()

    #print(scipy.stats.norm.ppf(0.99,0.00468906,0.49432524))

    # while(1):

    # 	if  (os.path.getsize("C:/Users/Administrator/AppData/Roaming/MeaQuotes/Terminal/50CA3DFB510CC5A8F28B48D1BF2A5702/MQL4/Files/API_callback.csv")!=0):
    # 		conn=pymysql.connect(host='localhost',user='******',passwd='123456',db='stock_foreign',port=3306)
    # 		cur_stock=conn.cursor()
    # 		cur_action=conn.cursor()
    # 		cur_result=conn.cursor()
    # 		print("有新增数据入库"+str(time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))))

    # 		cur_stock.execute("delete from releation")
    # 		loadcsv_add()