]> Zhao Yanbai Git Server - acecode.git/commitdiff
调整目录
authorroot <zhaoyanbai@126.com>
Thu, 30 Oct 2014 06:56:11 +0000 (06:56 +0000)
committerroot <zhaoyanbai@126.com>
Thu, 30 Oct 2014 06:56:11 +0000 (06:56 +0000)
14 files changed:
tools/GetWanIP.py [deleted file]
tools/comm/Makefile [moved from tools/Makefile with 94% similarity]
tools/comm/cls [moved from tools/cls with 100% similarity]
tools/comm/countc.c [moved from tools/countc.c with 100% similarity]
tools/comm/cpuid.cc [moved from tools/cpuid.cc with 100% similarity]
tools/comm/cs [moved from tools/cs with 100% similarity]
tools/comm/htc.c [moved from tools/htc.c with 100% similarity]
tools/comm/htn.c [moved from tools/htn.c with 100% similarity]
tools/hack/gscs [deleted file]
tools/hack/scs2hex [deleted file]
tools/oldtools/NetDetector.py [moved from tools/NetDetector.py with 100% similarity]
tools/oldtools/genpwd.py [moved from tools/genpwd.py with 100% similarity]
tools/oldtools/nth.cc [moved from tools/nth.cc with 100% similarity]
tools/python/GetWanIP.py

diff --git a/tools/GetWanIP.py b/tools/GetWanIP.py
deleted file mode 100755 (executable)
index a6629fc..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# ------------------------------------------------------------------------
-#   File Name: GetWanIP.py
-#      Author: Zhao Yanbai
-#              Thu Oct 30 04:34:37 2014
-# Description: none
-# ------------------------------------------------------------------------
-import os
-import re,urllib2
-import smtplib  
-import ConfigParser
-from email.mime.text import MIMEText  
-
-'''
-    CONFIG FILE SAMPLE
-[EMAIL]
-MAILTO  = xxx@xx.com
-MAILHOST= smtp.xx.com
-MAILUSER= xxxxx
-USERNICK= xxx
-MAILPASS= *****
-MAILPOSTFIX= xx.com
-'''
-'''
-    CONTAB
-* * * * * root cd /xxx/xxx/xxx/ && python GetWanIP.py >> ./xxx.log 2>&1
-'''
-
-CONFIG_FILE_PATH = '/etc/GetWanIP.conf'
-TMP_FILE_PATH = './WanIP.txt'
-  
-mailto_list=[] 
-mail_host=""        #设置服务器
-mail_user=""        #用户名
-user_nick=""
-mail_pass=""        #口令 
-mail_postfix=""     #发件箱的后缀
-
-class GetWanIP:
-    def GetIP(self):
-        try:
-            print "Try ip.qq.com"
-            WanIP = self.Visit("http://ip.qq.com")
-        except:
-            WanIP = "Failed to Get WanIP!!!"
-        return WanIP
-    def Visit(self,url):
-        opener = urllib2.urlopen(url)
-        if url == opener.geturl():
-            str = opener.read()
-        return re.search('\d+\.\d+\.\d+\.\d+',str).group(0)
-
-
-def send_mail(to_list,sub,content):                                 #to_list:收件人;sub:主题;content:邮件内容
-    me=user_nick+"<"+mail_user+"@"+mail_postfix+">"                   #这里的hello可以任意设置,收到信后,将按照设置显示
-    msg = MIMEText(content,_subtype='html',_charset='gb2312')       #创建一个实例,这里设置为html格式邮件
-    msg['Subject'] = sub                #设置主题
-    msg['From'] = me  
-    msg['To'] = ";".join(to_list)  
-    try:  
-        s = smtplib.SMTP()  
-        s.connect(mail_host)                        #连接smtp服务器
-        s.login(mail_user,mail_pass)                #登陆服务器
-        s.sendmail(me, to_list, msg.as_string())    #发送邮件
-        s.close()  
-        return True  
-    except Exception, e:  
-        print str(e)  
-        return False  
-if __name__ == '__main__':  
-    try :
-        fd = open(TMP_FILE_PATH)
-        try :
-            OldWanIP = fd.readline().strip()
-        except :
-            OldWanIP = '0.0.0.0'
-        fd.close()
-    except :
-        OldWanIP = '0.0.0.0'
-
-    getWanIP = GetWanIP()
-    WanIP = getWanIP.GetIP()
-
-    cnfp = ConfigParser.ConfigParser()
-    cnfp.read(CONFIG_FILE_PATH)
-    mailto_list.append(cnfp.get('EMAIL', 'MAILTO'))
-    mail_host = cnfp.get('EMAIL', 'MAILHOST')
-    mail_user = cnfp.get('EMAIL', 'MAILUSER')
-    user_nick = cnfp.get('EMAIL', 'USERNICK')
-    mail_pass = cnfp.get('EMAIL', 'MAILPASS')
-    mail_postfix = cnfp.get('EMAIL', 'MAILPOSTFIX')
-
-    if OldWanIP != WanIP :
-        s = 'WanIP has Changed From ' + OldWanIP + ' To ' + WanIP
-        print s
-        if send_mail(mailto_list,"New WanIP", s):  
-            print "发送成功"  
-            fd = open(TMP_FILE_PATH, 'w+')
-            fd.write(WanIP+'\n')
-            fd.close()
-        else:  
-            print "发送失败"  
similarity index 94%
rename from tools/Makefile
rename to tools/comm/Makefile
index dd95bb0b7738113412cc232d5c9be639efadbdc8..4cd3efb062b707cf4d2d42185f00e25f2c35e911 100644 (file)
@@ -13,6 +13,7 @@ DST   = /usr/local/bin/
 every: $(BINS)
        cp $(BINS) $(DST)
        cp $(SCRIPTS) $(DST)
+       rm $(BINS) -f
 .PHONY:clean
 clean:
        rm $(BINS) -f
similarity index 100%
rename from tools/cls
rename to tools/comm/cls
similarity index 100%
rename from tools/countc.c
rename to tools/comm/countc.c
similarity index 100%
rename from tools/cpuid.cc
rename to tools/comm/cpuid.cc
similarity index 100%
rename from tools/cs
rename to tools/comm/cs
similarity index 100%
rename from tools/htc.c
rename to tools/comm/htc.c
similarity index 100%
rename from tools/htn.c
rename to tools/comm/htn.c
diff --git a/tools/hack/gscs b/tools/hack/gscs
deleted file mode 100755 (executable)
index 5a10544..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/env perl
-# ------------------------------------------------------------------------
-#   File Name: gscs
-#      Author: Zhao Yanbai
-#              Tue Feb 14 13:42:22 2012
-# Description:  Generate Shell Code String
-#               在对可执行文件执行objdump -d xxx > xxx.S后
-#               在xxx.S中找到ShellCode处的代码将之生成成
-#               \x55\x89\xe5\x90\x90\x90\x90\xb8\xbb\xaa\x00\x00\x5d\xc3
-#               式的客串
-# ------------------------------------------------------------------------
-use strict;
-# Find Shell Code
-
-my $file = @ARGV[0];
-my $line = int(@ARGV[1]);
-
-unless($file) {
-    print "Error: no input file!\n";
-}
-
-
-open S, "<", $file;
-
-my $find=0;
-
-if($line) {
-    my $cl = 0;
-    while((++$cl<$line) && <S>) { }
-    $find=1 if $cl == $line;
-} else {
-    while(<S>) {
-        if(m#(\d|[a-fA-F])+ <(.+)>:.*#) {
-            if(lc($2) eq "shellcode") {
-                $find = 1;
-                last;
-            }
-        }
-    }
-}
-
-exit unless $find;
-
-my $codeline;
-while(<S>) {
-    if(m#.*:\t(.+\t).*#) {
-        $codeline = $1;
-        $codeline =~ s/\s+$//;
-        my @code = split(" ", $codeline);
-        foreach (@code) {
-            print "\\x" . $_;
-        }
-    } else {
-        last;
-    }
-}
-
-print "\n";
-
-close S;
diff --git a/tools/hack/scs2hex b/tools/hack/scs2hex
deleted file mode 100755 (executable)
index 484d63c..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env perl
-# ------------------------------------------------------------------------
-#   File Name: scs2hex.pl
-#      Author: Zhao Yanbai
-#              Tue Feb 14 15:13:02 2012
-# Description: Shell Code String ==> Hex
-# ------------------------------------------------------------------------
-use strict;
-
-my $infile = @ARGV[0];
-my $outfile= @ARGV[1];
-
-unless($infile) {
-    print "Error: No Input and Output File\n";
-    exit;
-}
-unless($outfile) {
-    print "Error: No Output File\n";
-    exit;
-}
-
-open S, "<", $infile;
-open D, ">", $outfile;
-
-while(<S>) {
-    my $v = $_;
-    chop($v);
-    my @a = split(/\\x/, $v);
-    $v = "";
-    foreach (@a) {
-        $v .= $_;
-    }
-    print D pack("H*", $v);
-}
-
-close D;
-close S;
similarity index 100%
rename from tools/genpwd.py
rename to tools/oldtools/genpwd.py
similarity index 100%
rename from tools/nth.cc
rename to tools/oldtools/nth.cc
index fe2c1feb5905309284d5ae9c2010133c28a328e7..54905e6fbb59ba499e66b50a961d8638087fbc8d 100755 (executable)
@@ -96,7 +96,7 @@ if __name__ == '__main__':
     if OldWanIP != WanIP :
         s = 'WanIP has Changed From ' + OldWanIP + ' To ' + WanIP
         log.info(s)
-        if send_mail(mailto_list,"New WanIP", s):  
+        if send_mail(mailto_list,u'外网IP有变动', s):  
             log.info('发送成功')
             fd = open(TMP_FILE_PATH, 'w+')
             fd.write(WanIP+'\n')