test

#! /usr/bin/env python
import os,sys
import time

def main():
    url_dnsrbl3=r'curl -connect-timeout 100 -m 900 -X GET https://dgarchive.caad.fkie.fraunhofer.de/today/3/dnsrbl -u yd0str:soapdoorwivettlcamweir >'
    url_today=r'curl -connect-timeout 10 -m 900 -X GET https://dgarchive.caad.fkie.fraunhofer.de/today -u yd0str:soapdoorwivettlcamweir >'
    url_dnsrbl=r'curl -connect-timeout 10 -m 900 -X GET https://dgarchive.caad.fkie.fraunhofer.de/today/dnsrbl -u yd0str:soapdoorwivettlcamweir >'
    nowtime=time.strftime('%Y-%m-%d',time.localtime())
    #updatetime=time.strftime('%H:%M:%S',time.localtime())
    updatetime=r'08:18:08'
    print updatetime
    if not os.path.exists(r'/home/w131/yd/dga_data_analysis/dga_family_path/dgarchive_domain/'):
        os.mkdir('/home/w131/yd/dga_data_analysis/dga_family_path/dgarchive_domain/')
    out_dnsrbl3=nowtime+'_dnsrbl_3'
    out_today=nowtime+'_today'
    out_dnsrbl=nowtime+'_dnsrbl'
    os.system("%s %s" % (url_dnsrbl3,r'/home/w131/yd/dga_data_analysis/dga_family_path/dgarchive_domain/'+out_dnsrbl3))
    os.system("%s %s" % (url_today,r'/home/w131/yd/dga_data_analysis/dga_family_path/dgarchive_domain/'+out_today))
    os.system("%s %s" % (url_dnsrbl,r'/home/w131/yd/dga_data_analysis/dga_family_path/dgarchive_domain/'+out_dnsrbl))
    if sys.argv[1]=="t":
        while 1:
            if updatetime==time.strftime('%H:%M:%S',time.localtime()):
                nowtime=time.strftime('%Y-%m-%d',time.localtime())
                out_dnsrbl3=nowtime+'_dnsrbl_3'
                out_today=nowtime+'_today'
                out_dnsrbl=nowtime+'_dnsrbl'
                os.system("%s %s" % (url_dnsrbl3,r'/home/w131/yd/dga_data_analysis/dga_family_path/dgarchive_domain/'+out_dnsrbl3))
                os.system("%s %s" % (url_today,r'/home/w131/yd/dga_data_analysis/dga_family_path/dgarchive_domain/'+out_today))
                os.system("%s %s" % (url_dnsrbl,r'/home/w131/yd/dga_data_analysis/dga_family_path/dgarchive_domain/'+out_dnsrbl))
                time.sleep(86000)
if __name__=='__main__':
    main()

  

上一篇:Java8新特性之日期处理Java 8日期时间API的重点


下一篇:计算多少天后的日期